diff --git a/cpp/ql/test/library-tests/regex/parse.expected b/cpp/ql/test/library-tests/regex/parse.expected index fe733db3b56..148b8af0ac5 100644 --- a/cpp/ql/test/library-tests/regex/parse.expected +++ b/cpp/ql/test/library-tests/regex/parse.expected @@ -26,6 +26,18 @@ #-----| [RegExpConstant, RegExpNormalChar] b +#-----| [RegExpConstant, RegExpEscape] \f + +#-----| [RegExpConstant, RegExpEscape] \v + +#-----| [RegExpConstant, RegExpNormalChar] d + +#-----| [RegExpConstant, RegExpNormalChar] c + +#-----| [RegExpConstant, RegExpNormalChar] b + +#-----| [RegExpConstant, RegExpNormalChar] a + #-----| [RegExpConstant, RegExpEscape] \0 #-----| [RegExpConstant, RegExpEscape] \0 @@ -187,6 +199,10 @@ #-----| 1 -> [RegExpConstant, RegExpEscape] \n #-----| 2 -> [RegExpConstant, RegExpNormalChar] b +#-----| [RegExpSequence] \f\v +#-----| 0 -> [RegExpConstant, RegExpEscape] \f +#-----| 1 -> [RegExpConstant, RegExpEscape] \v + #-----| [RegExpSequence] [A-F[[=b=]]a-f] #-----| 0 -> [RegExpCharacterClass] [A-F[[=b=]] #-----| 1 -> [RegExpConstant, RegExpNormalChar] a-f] @@ -409,6 +425,18 @@ #-----| 0 -> [RegExpConstant, RegExpNormalChar] foo #-----| 1 -> [RegExpConstant, RegExpNormalChar] bar +#-----| [RegExpQuantifier] d{2,3}? +#-----| 0 -> [RegExpConstant, RegExpNormalChar] d + +#-----| [RegExpOpt] c?? +#-----| 0 -> [RegExpConstant, RegExpNormalChar] c + +#-----| [RegExpPlus] b+? +#-----| 0 -> [RegExpConstant, RegExpNormalChar] b + +#-----| [RegExpStar] a*? +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + #-----| [RegExpPlus] a+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] a diff --git a/cpp/ql/test/library-tests/regex/regexp.cpp b/cpp/ql/test/library-tests/regex/regexp.cpp index 64fe2095232..15e35eb0ca2 100644 --- a/cpp/ql/test/library-tests/regex/regexp.cpp +++ b/cpp/ql/test/library-tests/regex/regexp.cpp @@ -92,6 +92,13 @@ std::regex r_ctrl2("[\\cZ]"); std::regex r_nul1("\\0"); std::regex r_nul2("[\\0]"); +// Lazy quantifiers and additional supported escapes +std::regex r_lazy1("a*?"); +std::regex r_lazy2("b+?"); +std::regex r_lazy3("c??"); +std::regex r_lazy4("d{2,3}?"); +std::regex r_fv("\\f\\v"); + // String literal spellings for location tests std::regex r_loc_plain("a\\nb"); std::basic_regex r_loc_L(L"abc"); diff --git a/cpp/ql/test/library-tests/regex/regexp.expected b/cpp/ql/test/library-tests/regex/regexp.expected index 56ba3c9ea1a..8bde18a3aa8 100644 --- a/cpp/ql/test/library-tests/regex/regexp.expected +++ b/cpp/ql/test/library-tests/regex/regexp.expected @@ -93,6 +93,8 @@ term | file://:0:0:0:0 | \\cZ | RegExpConstant,RegExpEscape | | file://:0:0:0:0 | \\d | RegExpCharacterClassEscape | | file://:0:0:0:0 | \\d\\D | RegExpSequence | +| file://:0:0:0:0 | \\f | RegExpConstant,RegExpEscape | +| file://:0:0:0:0 | \\f\\v | RegExpSequence | | file://:0:0:0:0 | \\n | RegExpConstant,RegExpEscape | | file://:0:0:0:0 | \\n | RegExpConstant,RegExpEscape | | file://:0:0:0:0 | \\n\\r\\t | RegExpSequence | @@ -101,6 +103,7 @@ term | file://:0:0:0:0 | \\s\\S | RegExpSequence | | file://:0:0:0:0 | \\t | RegExpConstant,RegExpEscape | | file://:0:0:0:0 | \\u0061 | RegExpConstant,RegExpEscape | +| file://:0:0:0:0 | \\v | RegExpConstant,RegExpEscape | | file://:0:0:0:0 | \\w | RegExpCharacterClassEscape | | file://:0:0:0:0 | \\w | RegExpCharacterClassEscape | | file://:0:0:0:0 | \\w | RegExpCharacterClassEscape | @@ -122,7 +125,9 @@ term | file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | a* | RegExpStar | +| file://:0:0:0:0 | a*? | RegExpStar | | file://:0:0:0:0 | a*b+c?d | RegExpSequence | | file://:0:0:0:0 | a+ | RegExpPlus | | file://:0:0:0:0 | a-f | RegExpCharacterRange | @@ -155,15 +160,21 @@ term | file://:0:0:0:0 | b | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | b | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | b | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | b | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | b+ | RegExpPlus | | file://:0:0:0:0 | b+ | RegExpPlus | +| file://:0:0:0:0 | b+? | RegExpPlus | | file://:0:0:0:0 | bar | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | bar | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | c | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | c | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | c | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | c? | RegExpOpt | +| file://:0:0:0:0 | c?? | RegExpOpt | | file://:0:0:0:0 | cd | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | d | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | d | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | d{2,3}? | RegExpQuantifier | | file://:0:0:0:0 | e | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | f | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | f | RegExpConstant,RegExpNormalChar | @@ -208,12 +219,14 @@ regExpNormalCharValue | file://:0:0:0:0 | \\cA | cA | | file://:0:0:0:0 | \\cZ | cZ | | file://:0:0:0:0 | \\d | d | +| file://:0:0:0:0 | \\f | \u000c | | file://:0:0:0:0 | \\n | \n | | file://:0:0:0:0 | \\n | \n | | file://:0:0:0:0 | \\r | \r | | file://:0:0:0:0 | \\s | s | | file://:0:0:0:0 | \\t | \t | | file://:0:0:0:0 | \\u0061 | a | +| file://:0:0:0:0 | \\v | \u000b | | file://:0:0:0:0 | \\w | w | | file://:0:0:0:0 | \\w | w | | file://:0:0:0:0 | \\w | w | @@ -233,6 +246,7 @@ regExpNormalCharValue | file://:0:0:0:0 | a | a | | file://:0:0:0:0 | a | a | | file://:0:0:0:0 | a | a | +| file://:0:0:0:0 | a | a | | file://:0:0:0:0 | a-f] | a-f] | | file://:0:0:0:0 | a-f] | a-f] | | file://:0:0:0:0 | abc | abc | @@ -254,12 +268,15 @@ regExpNormalCharValue | file://:0:0:0:0 | b | b | | file://:0:0:0:0 | b | b | | file://:0:0:0:0 | b | b | +| file://:0:0:0:0 | b | b | | file://:0:0:0:0 | bar | bar | | file://:0:0:0:0 | bar | bar | | file://:0:0:0:0 | c | c | | file://:0:0:0:0 | c | c | +| file://:0:0:0:0 | c | c | | file://:0:0:0:0 | cd | cd | | file://:0:0:0:0 | d | d | +| file://:0:0:0:0 | d | d | | file://:0:0:0:0 | e | e | | file://:0:0:0:0 | f | f | | file://:0:0:0:0 | f | f |