Mercurial > octave
annotate liboctave/util/lo-regexp.h @ 20791:f7084eae3318
maint: Use Octave coding conventions for #if statements.
* mk-opts.pl, dialog.h, find-files-dialog.h, find-files-model.h,
file-editor-tab.h, octave-qscintilla.h, octave-txt-lexer.h, main-window.h,
octave-cmd.h, octave-dock-widget.h, octave-gui.h, thread-manager.h,
workspace-model.h, workspace-view.h, builtins.h, Cell.h, bitfcns.cc,
c-file-ptr-stream.h, cdisplay.h, comment-list.h, cutils.h, data.h, debug.h,
defaults.in.h, defun-dld.h, defun-int.h, defun.h, dirfns.h, display.h,
dynamic-ld.h, error.h, event-queue.h, file-io.h, filter.cc, getrusage.cc,
gl-render.h, gl2ps-renderer.h, graphics.in.h, gripes.h, help.h, hook-fcn.h,
input.h, jit-ir.h, jit-typeinfo.h, jit-util.h, load-path.h, load-save.h,
ls-ascii-helper.h, ls-hdf5.h, ls-mat-ascii.h, ls-mat4.h, ls-mat5.h,
ls-oct-binary.h, ls-oct-text.h, ls-utils.h, oct-errno.h, oct-fstrm.h,
oct-handle.h, oct-hdf5-types.h, oct-hdf5.h, oct-hist.h, oct-iostrm.h,
oct-lvalue.h, oct-map.h, oct-obj.h, oct-prcstrm.h, oct-procbuf.h,
oct-stdstrm.h, oct-stream.h, oct-strstrm.h, oct.h, octave-link.h, pager.h,
pr-output.h, procstream.h, profiler.h, pt-jit.h, sighandlers.cc, sighandlers.h,
siglist.h, sparse-xdiv.h, sparse-xpow.h, symtab.h, syscalls.cc, sysdep.h,
toplev.cc, toplev.h, utils.h, variables.h, workspace-element.h, xdiv.h,
xnorm.h, xpow.h, dmperm.cc, oct-qhull.h, mkbuiltins, oct-conf.in.h,
ov-base-diag.h, ov-base-int.h, ov-base-mat.h, ov-base-scalar.h,
ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h, ov-bool.h,
ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h, ov-classdef.h, ov-colon.h,
ov-complex.h, ov-cs-list.h, ov-cx-diag.h, ov-cx-mat.h, ov-cx-sparse.h,
ov-dld-fcn.h, ov-fcn-handle.h, ov-fcn-inline.h, ov-fcn.h, ov-float.h,
ov-flt-complex.h, ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h,
ov-flt-re-mat.h, ov-int-traits.h, ov-int16.h, ov-int32.h, ov-int64.h,
ov-int8.h, ov-java.h, ov-lazy-idx.h, ov-mex-fcn.h, ov-null-mat.h, ov-perm.h,
ov-range.h, ov-re-diag.h, ov-re-mat.h, ov-re-sparse.h, ov-scalar.h,
ov-str-mat.h, ov-struct.h, ov-type-conv.h, ov-typeinfo.h, ov-uint16.h,
ov-uint32.h, ov-uint64.h, ov-uint8.h, ov-usr-fcn.h, ov.h, octave.h, ops.h,
options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.h, pt-array-list.h,
pt-assign.h, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h,
pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.h, pt-eval.h,
pt-except.h, pt-exp.h, pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-idx.h,
pt-jump.h, pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-select.h,
pt-stmt.h, pt-unop.h, pt-walk.h, pt.h, token.h, version.in.h, Array-util.h,
Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CNDArray.h, CRowVector.h,
CSparse.h, DiagArray2.h, MArray-decl.h, MArray-defs.h, MArray.h, MDiagArray2.h,
MSparse.h, Matrix.h, MatrixType.h, PermMatrix.h, Range.h, Sparse.h,
boolMatrix.h, boolNDArray.h, boolSparse.h, chMatrix.h, chNDArray.h,
dColVector.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, dRowVector.h, dSparse.h,
dim-vector.h, fCColVector.h, fCDiagMatrix.h, fCMatrix.h, fCNDArray.h,
fCRowVector.h, fColVector.h, fDiagMatrix.h, fMatrix.h, fNDArray.h,
fRowVector.h, idx-vector.h, int16NDArray.h, int32NDArray.h, int64NDArray.h,
int8NDArray.h, intNDArray.h, uint16NDArray.h, uint32NDArray.h, uint64NDArray.h,
uint8NDArray.h, f77-fcn.h, lo-error.h, quit.h, CmplxAEPBAL.h, CmplxCHOL.h,
CmplxGEPBAL.h, CmplxHESS.h, CmplxLU.h, CmplxQR.h, CmplxQRP.h, CmplxSCHUR.h,
CmplxSVD.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.h,
DASRT.h, DASSL.h, DET.h, EIG.h, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h,
Quad.h, SparseCmplxCHOL.h, SparseCmplxLU.h, SparseCmplxQR.cc, SparseCmplxQR.h,
SparseQR.h, SparsedbleCHOL.h, SparsedbleLU.h, base-aepbal.h, base-dae.h,
base-de.h, base-lu.h, base-min.h, base-qr.h, bsxfun-decl.h, bsxfun-defs.cc,
bsxfun.h, dbleAEPBAL.h, dbleCHOL.h, dbleGEPBAL.h, dbleHESS.h, dbleLU.h,
dbleQR.h, dbleQRP.h, dbleSCHUR.h, dbleSVD.h, eigs-base.cc, fCmplxAEPBAL.h,
fCmplxCHOL.h, fCmplxGEPBAL.h, fCmplxHESS.h, fCmplxLU.h, fCmplxQR.h,
fCmplxQRP.h, fCmplxSCHUR.h, fCmplxSVD.h, fEIG.h, floatAEPBAL.h, floatCHOL.h,
floatGEPBAL.h, floatHESS.h, floatLU.h, floatQR.h, floatQRP.h, floatSCHUR.h,
floatSVD.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h,
oct-convn.h, oct-fftw.h, oct-norm.h, oct-rand.h, oct-spparms.h, randmtzig.c,
sparse-base-chol.h, sparse-base-lu.h, sparse-dmsolve.cc, Sparse-diag-op-defs.h,
Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, mk-ops.awk,
mx-base.h, mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h,
sparse-mk-ops.awk, dir-ops.h, file-ops.h, file-stat.h, lo-sysdep.h,
mach-info.h, oct-env.h, oct-group.h, oct-openmp.h, oct-passwd.h,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.h, pathlen.h, sysdir.h,
syswait.h, action-container.h, base-list.h, byte-swap.h, caseless-str.h,
cmd-edit.h, cmd-hist.h, data-conv.h, functor.h, glob-match.h, kpse.cc,
lo-array-gripes.h, lo-cutils.h, lo-ieee.h, lo-macros.h, lo-math.h, lo-regexp.h,
lo-traits.h, lo-utils.h, oct-alloc.h, oct-base64.h, oct-binmap.h, oct-cmplx.h,
oct-glob.h, oct-inttypes.h, oct-locbuf.h, oct-mutex.h, oct-refcount.h,
oct-rl-edit.h, oct-rl-hist.h, oct-shlib.h, oct-sort.h, oct-sparse.h,
pathsearch.h, singleton-cleanup.h, sparse-sort.h, sparse-util.h, statdefs.h,
str-vec.h, sun-utils.h, unwind-prot.h, url-transfer.h:
Use Octave coding conventions for #if statements.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 03 Dec 2015 10:23:38 -0800 |
parents | 4197fc428c7d |
children | 1473547f50f5 |
rev | line source |
---|---|
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
1 /* |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
2 |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14024
diff
changeset
|
3 Copyright (C) 2012 John W. Eaton |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
4 Copyright (C) 2005-2015 David Bateman |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
5 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 This file is part of Octave. |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 Octave is free software; you can redistribute it and/or modify it |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 under the terms of the GNU General Public License as published by the |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 Free Software Foundation; either version 3 of the License, or (at your |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
11 option) any later version. |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
12 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
16 for more details. |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
17 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 along with Octave; see the file COPYING. If not, see |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 <http://www.gnu.org/licenses/>. |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
21 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
22 */ |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 #if ! defined (octave_lo_regexp_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
25 #define octave_lo_regexp_h 1 |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
27 #include <list> |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
28 #include <sstream> |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
29 #include <string> |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
30 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
31 #include "Array.h" |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
32 #include "Matrix.h" |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
33 #include "base-list.h" |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
34 #include "str-vec.h" |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
35 |
14281
b4d7de953066
Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14138
diff
changeset
|
36 class |
b4d7de953066
Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14138
diff
changeset
|
37 OCTAVE_API |
b4d7de953066
Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14138
diff
changeset
|
38 regexp |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
39 { |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
40 public: |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
41 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
42 class opts; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
43 class match_data; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
44 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
45 regexp (const std::string& pat = "", |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
46 const regexp::opts& opt = regexp::opts (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
47 const std::string& w = "regexp") |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
48 : pattern (pat), options (opt), data (0), named_pats (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
49 nnames (0), named_idx (), who (w) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
50 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
51 compile_internal (); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
52 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
53 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
54 regexp (const regexp& rx) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
55 : pattern (rx.pattern), data (rx.data), named_pats (rx.named_pats), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
56 nnames (rx.nnames), named_idx (rx.named_idx) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
57 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
58 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
59 regexp& operator = (const regexp& rx) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
60 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
61 if (this != &rx) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
62 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
63 pattern = rx.pattern; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
64 data = rx.data; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
65 named_pats = rx.named_pats; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
66 nnames = rx.nnames; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
67 named_idx = rx.named_idx; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
68 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
69 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
70 return *this; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
71 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
72 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
73 ~regexp (void) { free (); } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
74 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
75 void compile (const std::string& pat, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
76 const regexp::opts& opt = regexp::opts ()) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
77 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
78 pattern = pat; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
79 options = opt; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
80 compile_internal (); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
81 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
82 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
83 match_data match (const std::string& buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
84 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
85 bool is_match (const std::string& buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
86 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
87 Array<bool> is_match (const string_vector& buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
88 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
89 std::string replace (const std::string& buffer, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
90 const std::string& replacement); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
91 |
14449
8cdfd3cabea3
maint: Use class for regexp::opts declaration.
Rik <octave@nomad.inbox5.com>
parents:
14281
diff
changeset
|
92 class opts |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
93 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
94 public: |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
95 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
96 opts (void) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
97 : x_case_insensitive (false), x_dotexceptnewline (false), |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
98 x_emptymatch (false), x_freespacing (false), x_lineanchors (false), |
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
99 x_once (false) { } |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
100 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
101 opts (const opts& o) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
102 : x_case_insensitive (o.x_case_insensitive), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
103 x_dotexceptnewline (o.x_dotexceptnewline), |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
104 x_emptymatch (o.x_emptymatch), |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
105 x_freespacing (o.x_freespacing), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
106 x_lineanchors (o.x_lineanchors), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
107 x_once (o.x_once) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
108 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
109 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
110 opts& operator = (const opts& o) |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
111 { |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
112 if (this != &o) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
113 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
114 x_case_insensitive = o.x_case_insensitive; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
115 x_dotexceptnewline = o.x_dotexceptnewline; |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
116 x_emptymatch = o.x_emptymatch; |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
117 x_freespacing = o.x_freespacing; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
118 x_lineanchors = o.x_lineanchors; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
119 x_once = o.x_once; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
120 } |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
121 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
122 return *this; |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
123 } |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
124 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
125 ~opts (void) { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
126 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
127 void case_insensitive (bool val) { x_case_insensitive = val; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
128 void dotexceptnewline (bool val) { x_dotexceptnewline = val; } |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
129 void emptymatch (bool val) { x_emptymatch = val; } |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
130 void freespacing (bool val) { x_freespacing = val; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
131 void lineanchors (bool val) { x_lineanchors = val; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
132 void once (bool val) { x_once = val; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
133 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
134 bool case_insensitive (void) const { return x_case_insensitive; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
135 bool dotexceptnewline (void) const { return x_dotexceptnewline; } |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
136 bool emptymatch (void) const { return x_emptymatch; } |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
137 bool freespacing (void) const { return x_freespacing; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
138 bool lineanchors (void) const { return x_lineanchors; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
139 bool once (void) const { return x_once; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
140 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
141 private: |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
142 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
143 bool x_case_insensitive; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
144 bool x_dotexceptnewline; |
14536
6d5c951ec520
Add 'emptymatch', 'noemptymatch' options to regular expressions.
Rik <octave@nomad.inbox5.com>
parents:
14449
diff
changeset
|
145 bool x_emptymatch; |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
146 bool x_freespacing; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
147 bool x_lineanchors; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
148 bool x_once; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
149 }; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
150 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
151 class match_element |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
152 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
153 public: |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
154 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
155 match_element (const string_vector& nt, const string_vector& t, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
156 const std::string& ms, const Matrix& te, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
157 double s, double e) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
158 : x_match_string (ms), x_named_tokens (nt), x_tokens (t), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
159 x_token_extents (te), x_start (s), x_end (e) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
160 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
161 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
162 match_element (const match_element &a) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
163 : x_match_string (a.x_match_string), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
164 x_named_tokens (a.x_named_tokens), x_tokens (a.x_tokens), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
165 x_token_extents (a.x_token_extents), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
166 x_start (a.x_start), x_end (a.x_end) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
167 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
168 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
169 std::string match_string (void) const { return x_match_string; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
170 string_vector named_tokens (void) const { return x_named_tokens; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
171 string_vector tokens (void) const { return x_tokens; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
172 Matrix token_extents (void) const { return x_token_extents; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
173 double start (void) const { return x_start; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
174 double end (void) const { return x_end; } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
175 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
176 private: |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
177 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
178 std::string x_match_string; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
179 string_vector x_named_tokens; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
180 string_vector x_tokens; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
181 Matrix x_token_extents; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
182 double x_start; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
183 double x_end; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
184 }; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
185 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
186 class match_data : public octave_base_list<match_element> |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
187 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
188 public: |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
189 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
190 match_data (void) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
191 : octave_base_list<match_element> (), named_pats () |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
192 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
193 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
194 match_data (const std::list<match_element>& l, const string_vector& np) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
195 : octave_base_list<match_element> (l), named_pats (np) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
196 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
197 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
198 match_data (const match_data& rx_lst) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
199 : octave_base_list<match_element> (rx_lst), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
200 named_pats (rx_lst.named_pats) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
201 { } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
202 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
203 match_data& operator = (const match_data& rx_lst) |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
204 { |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
205 if (this != &rx_lst) |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
206 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
207 octave_base_list<match_element>::operator = (rx_lst); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
208 named_pats = rx_lst.named_pats; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
209 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
210 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
211 return *this; |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
212 } |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
213 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
214 ~match_data (void) { } |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
215 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
216 string_vector named_patterns (void) { return named_pats; } |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
217 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
218 private: |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
219 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
220 string_vector named_pats; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
221 }; |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
222 |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
223 private: |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
224 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
225 // The pattern we've been asked to match. |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
226 std::string pattern; |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
227 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
228 opts options; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
229 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
230 // Internal data describing the regular expression. |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
231 void *data; |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
232 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
233 std::string m; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
234 string_vector named_pats; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
235 int nnames; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
236 Array<int> named_idx; |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
237 std::string who; |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
238 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
239 void free (void); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
240 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
241 void compile_internal (void); |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
242 }; |
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
243 |
14024
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
244 inline regexp::match_data |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
245 regexp_match (const std::string& pat, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
246 const std::string& buffer, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
247 const regexp::opts& opt = regexp::opts (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
248 const std::string& who = "regexp") |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
249 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
250 regexp rx (pat, opt, who); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
251 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
252 return rx.match (buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
253 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
254 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
255 inline bool |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
256 is_regexp_match (const std::string& pat, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
257 const std::string& buffer, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
258 const regexp::opts& opt = regexp::opts (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
259 const std::string& who = "regexp") |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
260 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
261 regexp rx (pat, opt, who); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
262 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
263 return rx.is_match (buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
264 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
265 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
266 inline Array<bool> |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
267 is_regexp_match (const std::string& pat, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
268 const string_vector& buffer, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
269 const regexp::opts& opt = regexp::opts (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
270 const std::string& who = "regexp") |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
271 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
272 regexp rx (pat, opt, who); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
273 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
274 return rx.is_match (buffer); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
275 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
276 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
277 inline std::string |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
278 regexp_replace (const std::string& pat, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
279 const std::string& buffer, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
280 const std::string& replacement, |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
281 const regexp::opts& opt = regexp::opts (), |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
282 const std::string& who = "regexp") |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
283 { |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
284 regexp rx (pat, opt, who); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
285 |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
286 return rx.replace (buffer, replacement); |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
287 } |
fc9f204faea0
refactor regexp (bug #34440)
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
288 |
7779
791231dac333
Add regexp matching to Fwho and Fclear
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
289 #endif |