1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-23 21:29:15 +02:00

Avoid empty matches in MLIR lexer

Ensure at least one character is matched else lexing ends up making no forward progress.
This commit is contained in:
jpienaar 2019-12-01 10:02:20 -08:00 committed by Alec Thomas
parent 15c7468f37
commit 352e19d7f2

@ -27,7 +27,7 @@ var Mlir = internal.Register(MustNewLexer(
{`0[xX][a-fA-F0-9]+`, LiteralNumber, nil},
{`-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?`, LiteralNumber, nil},
{`[=<>{}\[\]()*.,!:]|x\b`, Punctuation, nil},
{`[\w\d]*`, Text, nil},
{`[\w\d]+`, Text, nil},
},
"whitespace": {
{`(\n|\s)+`, Text, nil},