Skip to content

Commit 9dc49fd

Browse files
committed
merge cleanup
1 parent e00c9b7 commit 9dc49fd

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

core/src/main/kotlin/org/evomaster/core/parser/GeneRegexJavaVisitor.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,12 @@ class GeneRegexJavaVisitor : RegexJavaBaseVisitor<VisitResult>(){
266266
list.addAll(rec)
267267
} else {
268268
val startText = ctx.classAtom()[0].text
269-
assert(startText.length == 1 || startText.length==2) // single chars or \+ and \. escaped chars
269+
assert(startText.length == 1 || startText.length == 2) // single chars or \+ and \. escaped chars
270270

271-
val start : Char
271+
val start: Char
272272
val end: Char
273273

274-
if (startText.length==1) {
274+
if (startText.length == 1) {
275275
start = startText[0]
276276
end = if (ctx.classAtom().size == 2) {
277277
ctx.classAtom()[1].text[0]
@@ -283,7 +283,7 @@ class GeneRegexJavaVisitor : RegexJavaBaseVisitor<VisitResult>(){
283283
// This case handles the \. and \+ cases
284284
// wheren . and + should be treated as
285285
// regular chars
286-
assert(startText=="\\+" || startText=="\\.")
286+
assert(startText == "\\+" || startText == "\\.")
287287
start = startText[1]
288288
end = start
289289
}
@@ -351,12 +351,12 @@ class GeneRegexJavaVisitor : RegexJavaBaseVisitor<VisitResult>(){
351351
res.data = if(ctx.atomEscape() != null) {
352352
when (val rec = ctx.atomEscape().accept(this).genes[0]) {
353353
is CharacterClassEscapeRxGene -> {
354-
rec.charClassRepr.internalRanges
354+
rec.multiCharRange.ranges
355355
}
356356

357357
is PatternCharacterBlockGene -> {
358358
if (rec.stringBlock.length > 1) throw IllegalArgumentException("CharClass element cannot be strings")
359-
else listOf(rec.stringBlock[0] to rec.stringBlock[0])
359+
else listOf(CharacterRange(rec.stringBlock[0], rec.stringBlock[0]))
360360
}
361361

362362
else -> throw IllegalArgumentException("Unexpected CharClass content")

core/src/main/kotlin/org/evomaster/core/search/gene/regex/CharacterClassEscapeRxGene.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import kotlin.collections.contains
2222
\D Find a non-digit character
2323
\s Find a whitespace character
2424
\S Find a non-whitespace character
25+
\h Find a horizontal space character
26+
\H Find a non-horizontal space character
27+
\v Find a vertical space character
28+
\V Find a non-vertical space character
2529
\p{X} Find a character from X POSIX character class (eg:\p{Lower})
2630
*/
2731
class CharacterClassEscapeRxGene(
@@ -71,12 +75,13 @@ class CharacterClassEscapeRxGene(
7175
"Blank" to stringToListOfCharacterRanges(" \t"),
7276
"Cntrl" to listOf(CharacterRange(0, 0x1f)) + stringToListOfCharacterRanges("\u007f"),
7377
"XDigit" to listOf(CharacterRange('0', '9'), CharacterRange('a', 'f'), CharacterRange('A', 'F')),
74-
"Space" to spaceSet
78+
"Space" to spaceSet,
79+
"Pe" to stringToListOfCharacterRanges(")]}")
7580
).mapValues { (_, value) -> MultiCharacterRange(false, value) }
7681
}
7782

7883
var value: String = ""
79-
private var multiCharRange: MultiCharacterRange
84+
var multiCharRange: MultiCharacterRange
8085

8186
init {
8287
if (type[0] !in "wWdDsSvVhHp") {

0 commit comments

Comments
 (0)