Skip to content

Commit e877db2

Browse files
committed
JS octal escape fix
1 parent 76afa5f commit e877db2

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

core/src/main/antlr4/org/evomaster/core/parser/RegexEcma262.g4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ BaseChar
247247
;
248248

249249
fragment OctalEscapeSequence
250-
: OctalDigit OctalDigit? OctalDigit?
250+
: OctalDigit
251+
| OctalDigit OctalDigit
252+
| [0-3] OctalDigit OctalDigit
251253
;
252254

253255
fragment UnicodeEscapeSequence

core/src/test/kotlin/org/evomaster/core/parser/GeneRegexEcma262VisitorTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,8 @@ open class GeneRegexEcma262VisitorTest : RegexTestTemplate(){
380380
checkCanSample("""\c""", "\\c", 100)
381381
checkCanSample("""\c*""", "\\c*", 100)
382382
checkCanSample("""\c0""", "\\c0", 100)
383-
checkCanSample("""\0""", "\u0000", 100)
383+
checkCanSample("""\0\000""", "\u0000\u0000", 100)
384384
checkCanSample("""\001\007""", "\u0001\u0007", 100)
385-
checkCanSample("""\123""", "\u0053", 100)
386-
checkCanSample("""\777""", "\u01ff", 100)
385+
checkCanSample("""\123\377""", "\u0053\u00ff", 100)
387386
}
388387
}

0 commit comments

Comments
 (0)