Skip to content

Commit cfc10bc

Browse files
committed
feat(highlight-pattern): highlight dot
1 parent 40242d7 commit cfc10bc

File tree

1 file changed

+6
-1
lines changed
  • feature/matcher/src/commonMain/kotlin/com/neoutils/neoregex/feature/matcher/model

1 file changed

+6
-1
lines changed

feature/matcher/src/commonMain/kotlin/com/neoutils/neoregex/feature/matcher/model/Syntax.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ interface Syntax {
4040
private val charSetRegex = """(\\{2})|(\\\[)|(\[\^?)((?:\\{2}|\\\]|[^\]])*)(\])?""".toRegex()
4141
private val groupRegex = """(\\{2})|(\\\[)|(\[(?:\\{2}|\\\]|[^\]])*\]?)|(\\\()|(\((?:\?[:=!])?)((?:\\{2}|\\\)|\\\[|\[(?:\\{2}|\\\]|[^\]])*\]?|[^\)])*)(\))?""".toRegex()
4242
private val quantifierRegex = """(\\{2})|(\\\[)|(\[(?:\\{2}|\\\]|[^\]])*\]?)|(\\\{)|(\{\w,?\w?\})""".toRegex()
43-
private val escapeReservedRegex = """(\\{2})|(\\[{}()\[\]$^+*?|\w])""".toRegex()
43+
private val escapeReservedRegex = """(\\{2})|(\\[{}()\[\]$^+*?|.\w])""".toRegex()
4444
private val escapedCharRegex = """(\\{2})|(\\[DdWwSsHhVvR])""".toRegex()
4545
private val anchorsRegex = """(\\{2})|(\\[$^])|(\\[AZzBbG])|([$^])""".toRegex()
4646
private val controlsRegex = """(\\{2})|(\\[tnfrae])""".toRegex()
4747
private val modifierRegex = """(\\{2})|(\\\[)|(\[(?:\\{2}|\\\]|[^\]])*\]?)|(\\[+*?])|([+*?])""".toRegex()
48+
private val dotRegex = """(\\{2})|(\\\[)|(\[(?:\\{2}|\\\]|[^\]])*\]?)|(\\\.)|(\.)""".toRegex()
4849
private val alternationRegex = """(\\{2})|(\\\[)|(\[(?:\\{2}|\\\]|[^\]])*\]?)|(\\\|)|(\|)""".toRegex()
4950
private val charSetRangeRegex = """\w(-)\w""".toRegex()
5051

@@ -125,6 +126,10 @@ interface Syntax {
125126
put(4, charSetSpanStyle.copy(color = Color.Unspecified))
126127
put(5, charSetSpanStyle)
127128
}
129+
130+
dotRegex.match {
131+
put(5, SpanStyle(color = escapedCharColor))
132+
}
128133
}
129134

130135
groupRegex.script { match ->

0 commit comments

Comments
 (0)