Back
Type Name Operations
ImageMagick-6 Open
X11 Open
arpa Open
asm Open
asm-generic Open
bind9 Open
bind9-export Open
bits Open
bsock Open
c++ Open
curl Open
drm Open
e2p Open
event2 Open
ext2fs Open
finclude Open
fontconfig Open
freetype2 Open
fstrm Open
gdb Open
gdbm Open
ghostscript Open
gnu Open
google Open
gssapi Open
gssrpc Open
jasper Open
json-c Open
kadm5 Open
krb5 Open
libdb Open
libexslt Open
libltdl Open
libpng16 Open
libxml2 Open
libxslt Open
linux Open
lve Open
lzma Open
misc Open
mtd Open
mysql Open
ncurses Open
ncursesw Open
net Open
netash Open
netatalk Open
netax25 Open
neteconet Open
netinet Open
netipx Open
netiucv Open
netpacket Open
netrom Open
netrose Open
nfs Open
openssl Open
pcp Open
perf Open
protobuf-c Open
protocols Open
python2.7 Open
python3.6m Open
python3.8 Open
rdma Open
rpc Open
rpcsvc Open
scsi Open
security Open
selinux Open
sepol Open
sodium Open
sound Open
sys Open
tirpc Open
uuid Open
video Open
webp Open
xcb Open
xen Open
FlexLexer.h
a.out.h
aio.h
aliases.h
alloca.h
ar.h
argp.h
argz.h
assert.h
autosprintf.h
byteswap.h
bzlib.h
com_err.h
complex.h
cpio.h
cpuidle.h
crypt.h
ctype.h
curses.h
cursesapp.h
cursesf.h
cursesm.h
cursesp.h
cursesw.h
cursslk.h
db.h
db_185.h
dbm.h
dirent.h
dlfcn.h
elf.h
endian.h
entities.h
envz.h
err.h
errno.h
error.h
eti.h
etip.h
evdns.h
event.h
evhttp.h
evrpc.h
evutil.h
execinfo.h
expat.h
expat_config.h
expat_external.h
fcntl.h
features.h
fenv.h
fmtmsg.h
fnmatch.h
form.h
fpu_control.h
fstab.h
fstrm.h
fts.h
ftw.h
gconv.h
gcrypt.h
gd.h
gd_color_map.h
gd_errors.h
gd_io.h
gdbm.h
gdcache.h
gdfontg.h
gdfontl.h
gdfontmb.h
gdfonts.h
gdfontt.h
gdfx.h
gdpp.h
getopt.h
gettext-po.h
glob.h
gnu-versions.h
gnumake.h
gpg-error.h
gpgrt.h
grp.h
gshadow.h
gssapi.h
iconv.h
idn-free.h
idn-int.h
idna.h
ieee754.h
ifaddrs.h
inttypes.h
jconfig-64.h
jconfig.h
jerror.h
jmorecfg.h
jpegint.h
jpeglib.h
kdb.h
keyutils.h
krad.h
krb5.h
langinfo.h
lastlog.h
libaio.h
libgen.h
libintl.h
limits.h
link.h
locale.h
ltdl.h
lzma.h
magic.h
malloc.h
math.h
mcheck.h
memory.h
menu.h
mntent.h
monetary.h
mqueue.h
nc_tparm.h
ncurses.h
ncurses_dll.h
ndbm.h
netdb.h
nl_types.h
nss.h
obstack.h
panel.h
paths.h
pcre.h
pcre2.h
pcre2posix.h
pcre_scanner.h
pcre_stringpiece.h
pcrecpp.h
pcrecpparg.h
pcreposix.h
png.h
pngconf.h
pnglibconf.h
poll.h
pr29.h
printf.h
proc_service.h
profile.h
pthread.h
pty.h
punycode.h
pwd.h
re_comp.h
regex.h
regexp.h
resolv.h
sched.h
search.h
semaphore.h
setjmp.h
sgtty.h
shadow.h
signal.h
sodium.h
spawn.h
stab.h
stdc-predef.h
stdint.h
stdio.h
stdio_ext.h
stdlib.h
string.h
stringprep.h
strings.h
syscall.h
sysexits.h
syslog.h
tar.h
term.h
term_entry.h
termcap.h
termio.h
termios.h
tgmath.h
thread_db.h
threads.h
tic.h
tiff.h
tiffconf-64.h
tiffconf.h
tiffio.h
tiffio.hxx
tiffvers.h
time.h
tld.h
ttyent.h
uchar.h
ucontext.h
ulimit.h
unctrl.h
unistd.h
utime.h
utmp.h
utmpx.h
values.h
verto-module.h
verto.h
wait.h
wchar.h
wctype.h
wordexp.h
zconf.h
zlib.h

File Transfer

Upload files to current directory

File Editor: pcre_scanner.h

// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat // // Regular-expression based scanner for parsing an input stream. // // Example 1: parse a sequence of "var = number" entries from input: // // Scanner scanner(input); // string var; // int number; // scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter // while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) { // ...; // } #ifndef _PCRE_SCANNER_H #define _PCRE_SCANNER_H #include #include #include #include #include namespace pcrecpp { class PCRECPP_EXP_DEFN Scanner { public: Scanner(); explicit Scanner(const std::string& input); ~Scanner(); // Return current line number. The returned line-number is // one-based. I.e. it returns 1 + the number of consumed newlines. // // Note: this method may be slow. It may take time proportional to // the size of the input. int LineNumber() const; // Return the byte-offset that the scanner is looking in the // input data; int Offset() const; // Return true iff the start of the remaining input matches "re" bool LookingAt(const RE& re) const; // Return true iff all of the following are true // a. the start of the remaining input matches "re", // b. if any arguments are supplied, matched sub-patterns can be // parsed and stored into the arguments. // If it returns true, it skips over the matched input and any // following input that matches the "skip" regular expression. bool Consume(const RE& re, const Arg& arg0 = RE::no_arg, const Arg& arg1 = RE::no_arg, const Arg& arg2 = RE::no_arg // TODO: Allow more arguments? ); // Set the "skip" regular expression. If after consuming some data, // a prefix of the input matches this RE, it is automatically // skipped. For example, a programming language scanner would use // a skip RE that matches white space and comments. // // scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/"); // // Skipping repeats as long as it succeeds. We used to let people do // this by writing "(...)*" in the regular expression, but that added // up to lots of recursive calls within the pcre library, so now we // control repetition explicitly via the function call API. // // You can pass NULL for "re" if you do not want any data to be skipped. void Skip(const char* re); // DEPRECATED; does *not* repeat void SetSkipExpression(const char* re); // Temporarily pause "skip"ing. This // Skip("Foo"); code ; DisableSkip(); code; EnableSkip() // is similar to // Skip("Foo"); code ; Skip(NULL); code ; Skip("Foo"); // but avoids creating/deleting new RE objects. void DisableSkip(); // Reenable previously paused skipping. Any prefix of the input // that matches the skip pattern is immediately dropped. void EnableSkip(); /***** Special wrappers around SetSkip() for some common idioms *****/ // Arranges to skip whitespace, C comments, C++ comments. // The overall RE is a disjunction of the following REs: // \\s whitespace // //.*\n C++ comment // /[*](.|\n)*?[*]/ C comment (x*? means minimal repetitions of x) // We get repetition via the semantics of SetSkipExpression, not by using * void SkipCXXComments() { SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/"); } void set_save_comments(bool comments) { save_comments_ = comments; } bool save_comments() { return save_comments_; } // Append to vector ranges the comments found in the // byte range [start,end] (inclusive) of the input data. // Only comments that were extracted entirely within that // range are returned: no range splitting of atomically-extracted // comments is performed. void GetComments(int start, int end, std::vector *ranges); // Append to vector ranges the comments added // since the last time this was called. This // functionality is provided for efficiency when // interleaving scanning with parsing. void GetNextComments(std::vector *ranges); private: std::string data_; // All the input data StringPiece input_; // Unprocessed input RE* skip_; // If non-NULL, RE for skipping input bool should_skip_; // If true, use skip_ bool skip_repeat_; // If true, repeat skip_ as long as it works bool save_comments_; // If true, aggregate the skip expression // the skipped comments // TODO: later consider requiring that the StringPieces be added // in order by their start position std::vector *comments_; // the offset into comments_ that has been returned by GetNextComments int comments_offset_; // helper function to consume *skip_ and honour // save_comments_ void ConsumeSkip(); }; } // namespace pcrecpp #endif /* _PCRE_SCANNER_H */