Am Freitag, 24. Februar 2017 um 17:30:39, schrieb Jean-Marc Lasgouttes <lasgout...@lyx.org> > Le 24/02/2017 à 17:17, Kornel Benko a écrit : > > Little net-search gives for example: > > http://stackoverflow.com/questions/13526884/inconsistency-between-boostregex-and-stdregex > > http://stackoverflow.com/questions/7589672/boost-regex-vs-c11-regex > > http://stackoverflow.com/questions/26696250/difference-between-stdregex-match-stdregex-search > > > > Citing from the first url: > > gcc of course doesn't support the tr1/c++11 regex, but to give a more > > general answer, > > boost.regex's default is perl 5, according to its documentation, while > > C++ default is > > ECMAScript, extended by several locale-dependent elements of POSIX BRE. > > > > Kornel > > > > The first link points to this: > http://www.boost.org/doc/libs/1_52_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.perl_extended_patterns > which explains that perl extended patterns start with ``(?''. So all we > have to do is some grep and: > > src/Buffer.cpp:// chktex should be run with these flags disabled: 3, 22, > 25, 30, 38(?) > src/LayoutFile.cpp: > "(?:\\[([^,]*)(?:,.*)*\\])*\\s*\\{(.*)\\}\\s*"); > src/frontends/qt4/GuiApplication.cpp: QRegExp re( > "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ > ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" ); > src/frontends/qt4/GuiDocument.cpp: // disable if there aren't any > modules (?), if none of them is chosen > src/frontends/qt4/GuiThesaurus.cpp: QRegExp > re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$"); > src/frontends/qt4/GuiThesaurus.cpp: QRegExp > rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$"); > src/frontends/qt4/GuiThesaurus.cpp: QRegExp > re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$"); > src/frontends/qt4/GuiThesaurus.cpp: QRegExp > rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$"); > src/frontends/qt4/GuiWorkArea.cpp: // FIXME(?): > src/frontends/qt4/LaTeXHighlighter.cpp: QRegExp > exprComment("(?:^|[^\\\\])(?:\\\\\\\\)*(%).*$"); > src/insets/InsetTabular.cpp: // FIXME(?): do we need > a second metrics call? > src/lyxfind.cpp: escape_map.push_back(P("\\", > "(?:\\\\|\\\\backslash)")); > src/lyxfind.cpp: escape_map.push_back(P("~", > "(?:\\\\textasciitilde|\\\\sim)")); > src/lyxfind.cpp: escape_map.push_back(P("^", > "(?:\\^|\\\\textasciicircum\\{\\}|\\\\mathcircumflex)")); > src/lyxfind.cpp: escape_map.push_back(P("\\\\", > "(?:\\\\\\\\|\\\\backslash|\\\\textbackslash\\{\\})")); > src/lyxfind.cpp: escape_map.push_back(P("\\^", > "(?:\\^|\\\\textasciicircum\\{\\}|\\\\mathcircumflex)")); > > Of course, only the last ones in lyxfonc.cpp matter here. The others are > interesting if only because I see now that we also use QRegex, which > seems to accept perl extensions. > > So for now, we need to understand what is this syntax and use the > ECMAscript equivalent. AFAICS, the only for used is (?:, described as:
Or use the POSIX-extension? See http://eli.thegreenplace.net/2012/11/14/some-notes-on-posix-regular-expressions Shoudn't then the regexes be compatible with boost-POSIX? In our sources we test for 'LYX_USE_STD_REGEX' only in src/frontends/qt4/GuiCitation.cpp, but I'd expect to see this also in src/regex.cpp > (?:pattern) lexically groups pattern, without generating an > additional sub-expression. > > I do not know how important this thing is. What would go wrong if we > just removed the grouping? Don't know either. > JMarc Kornel
signature.asc
Description: This is a digitally signed message part.