diff --git a/cpp/ql/test/library-tests/regex/parse.expected b/cpp/ql/test/library-tests/regex/parse.expected index 2ab6e455bd5..420e3f043ae 100644 --- a/cpp/ql/test/library-tests/regex/parse.expected +++ b/cpp/ql/test/library-tests/regex/parse.expected @@ -40,6 +40,32 @@ #-----| [RegExpConstant, RegExpNormalChar] F +#-----| [RegExpConstant, RegExpNormalChar] [ + +#-----| [RegExpConstant, RegExpNormalChar] [ + +#-----| [RegExpConstant, RegExpNormalChar] . + +#-----| [RegExpConstant, RegExpNormalChar] b + +#-----| [RegExpConstant, RegExpNormalChar] . + +#-----| [RegExpConstant, RegExpNormalChar] ]a-f] + +#-----| [RegExpConstant, RegExpNormalChar] [ + +#-----| [RegExpConstant, RegExpNormalChar] . + +#-----| [RegExpConstant, RegExpNormalChar] a + +#-----| [RegExpConstant, RegExpNormalChar] . + +#-----| [RegExpConstant, RegExpNormalChar] ] + +#-----| [RegExpConstant, RegExpNormalChar] A + +#-----| [RegExpConstant, RegExpNormalChar] F + #-----| [RegExpConstant, RegExpNormalChar] a #-----| [RegExpConstant, RegExpNormalChar] f @@ -171,6 +197,14 @@ #-----| 1 -> [RegExpConstant, RegExpEscape] \n #-----| 2 -> [RegExpConstant, RegExpNormalChar] b +#-----| [RegExpSequence] [A-F[[.b.]]a-f] +#-----| 0 -> [RegExpCharacterClass] [A-F[[.b.] +#-----| 1 -> [RegExpConstant, RegExpNormalChar] ]a-f] + +#-----| [RegExpSequence] [[.a.]] +#-----| 0 -> [RegExpCharacterClass] [[.a.] +#-----| 1 -> [RegExpConstant, RegExpNormalChar] ] + #-----| [RegExpSequence] [[:alpha:]][[:digit:]] #-----| 0 -> [RegExpCharacterClass] [[:alpha:]] #-----| 1 -> [RegExpCharacterClass] [[:digit:]] @@ -263,6 +297,10 @@ #-----| 0 -> [RegExpConstant, RegExpNormalChar] A #-----| 1 -> [RegExpConstant, RegExpNormalChar] F +#-----| [RegExpCharacterRange] A-F +#-----| 0 -> [RegExpConstant, RegExpNormalChar] A +#-----| 1 -> [RegExpConstant, RegExpNormalChar] F + #-----| [RegExpCharacterRange] a-f #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] f @@ -293,6 +331,20 @@ #-----| [RegExpCharacterClass] [\cZ] #-----| 0 -> [RegExpConstant, RegExpEscape] \cZ +#-----| [RegExpCharacterClass] [A-F[[.b.] +#-----| 0 -> [RegExpCharacterRange] A-F +#-----| 1 -> [RegExpConstant, RegExpNormalChar] [ +#-----| 2 -> [RegExpConstant, RegExpNormalChar] [ +#-----| 3 -> [RegExpConstant, RegExpNormalChar] . +#-----| 4 -> [RegExpConstant, RegExpNormalChar] b +#-----| 5 -> [RegExpConstant, RegExpNormalChar] . + +#-----| [RegExpCharacterClass] [[.a.] +#-----| 0 -> [RegExpConstant, RegExpNormalChar] [ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] . +#-----| 2 -> [RegExpConstant, RegExpNormalChar] a +#-----| 3 -> [RegExpConstant, RegExpNormalChar] . + #-----| [RegExpCharacterClass] [A-F[:digit:]a-f] #-----| 0 -> [RegExpCharacterRange] A-F diff --git a/cpp/ql/test/library-tests/regex/regexp.cpp b/cpp/ql/test/library-tests/regex/regexp.cpp index 18c3b8d3e48..ebf3b49367f 100644 --- a/cpp/ql/test/library-tests/regex/regexp.cpp +++ b/cpp/ql/test/library-tests/regex/regexp.cpp @@ -70,6 +70,10 @@ std::regex r_posix2("[[:alpha:][:digit:]]"); // A single character class containing two ranges and one POSIX bracket expression std::regex r_posix3("[A-F[:digit:]a-f]"); +// POSIX collating symbols +std::regex r_posix_coll1("[[.a.]]"); +std::regex r_posix_coll2("[A-F[[.b.]]a-f]"); + // *Not* a POSIX bracket expression; just a regular character class. std::regex r_posix4("[:digit:]"); diff --git a/cpp/ql/test/library-tests/regex/regexp.expected b/cpp/ql/test/library-tests/regex/regexp.expected index f8bb2b9b726..18707fb6a52 100644 --- a/cpp/ql/test/library-tests/regex/regexp.expected +++ b/cpp/ql/test/library-tests/regex/regexp.expected @@ -23,6 +23,10 @@ term | file://:0:0:0:0 | (foo)*bar | RegExpSequence | | file://:0:0:0:0 | (o\|b) | RegExpGroup | | file://:0:0:0:0 | - | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | . | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | . | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | . | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | . | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | . | RegExpDot | | file://:0:0:0:0 | . | RegExpDot | | file://:0:0:0:0 | .* | RegExpStar | @@ -32,16 +36,26 @@ 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-F | RegExpCharacterRange | | file://:0:0:0:0 | A-F | RegExpCharacterRange | | file://:0:0:0:0 | A-F | RegExpCharacterRange | | file://:0:0:0:0 | A-F] | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | A-Z | RegExpCharacterRange | | file://:0:0:0:0 | F | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | F | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | F | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | Z | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | [ | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | [ | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | [ | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | [ | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | [123] | RegExpCharacterClass | | file://:0:0:0:0 | [A-F[:digit:]a-f] | RegExpCharacterClass | +| file://:0:0:0:0 | [A-F[[.b.] | RegExpCharacterClass | +| file://:0:0:0:0 | [A-F[[.b.]]a-f] | RegExpSequence | +| file://:0:0:0:0 | [[.a.] | RegExpCharacterClass | +| file://:0:0:0:0 | [[.a.]] | RegExpSequence | | file://:0:0:0:0 | [[:alpha:][:digit:]] | RegExpCharacterClass | | file://:0:0:0:0 | [[:alpha:]] | RegExpCharacterClass | | file://:0:0:0:0 | [[:alpha:]][[:digit:]] | RegExpSequence | @@ -91,6 +105,8 @@ term | file://:0:0:0:0 | \| | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | ] | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | ] | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | ] | RegExpConstant,RegExpNormalChar | +| file://:0:0:0:0 | ]a-f] | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | _ | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | | file://:0:0:0:0 | a | RegExpConstant,RegExpNormalChar | @@ -104,6 +120,7 @@ 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*b+c?d | RegExpSequence | | file://:0:0:0:0 | a+ | RegExpPlus | @@ -135,6 +152,7 @@ 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 | bar | RegExpConstant,RegExpNormalChar | @@ -163,15 +181,24 @@ regExpNormalCharValue | file://:0:0:0:0 | 9 | 9 | | file://:0:0:0:0 | !a | !a | | file://:0:0:0:0 | - | - | +| file://:0:0:0:0 | . | . | +| file://:0:0:0:0 | . | . | +| file://:0:0:0:0 | . | . | +| file://:0:0:0:0 | . | . | | file://:0:0:0:0 | : | : | | 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 | F | F | | file://:0:0:0:0 | F | F | +| file://:0:0:0:0 | F | F | | file://:0:0:0:0 | Z | Z | | file://:0:0:0:0 | [ | [ | +| file://:0:0:0:0 | [ | [ | +| file://:0:0:0:0 | [ | [ | +| file://:0:0:0:0 | [ | [ | | file://:0:0:0:0 | \\0 | 0 | | file://:0:0:0:0 | \\0 | 0 | | file://:0:0:0:0 | \\D | D | @@ -194,6 +221,8 @@ regExpNormalCharValue | file://:0:0:0:0 | \| | \| | | file://:0:0:0:0 | ] | ] | | file://:0:0:0:0 | ] | ] | +| file://:0:0:0:0 | ] | ] | +| file://:0:0:0:0 | ]a-f] | ]a-f] | | file://:0:0:0:0 | _ | _ | | file://:0:0:0:0 | a | a | | file://:0:0:0:0 | a | a | @@ -207,6 +236,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 | abc | abc | | file://:0:0:0:0 | abc | abc | | file://:0:0:0:0 | abc | abc | @@ -226,6 +256,7 @@ 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 |