summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2017-05-07 17:01:49 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2017-05-07 17:01:49 +0300
commit8087a503f00913fc7b26e75d9549f6b99adf3242 (patch)
tree8e6a4c84c2fa3e518f4ae173ff5d6a186f0fd9d7
parent92f1dbb651217ea062d81237c6e72eaa257c6b81 (diff)
ragel.rl: Make search_err read "p" before stop
If we stop before reading the "p" false positive may be returned since "p" may be the start of new token. Thus case like `type: 3u8[4] str;` would fail to mark the real error since '3' is not read. Thus start marking from the last valid token that is ':'.
-rw-r--r--src/ragel/ragel.rl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ragel/ragel.rl b/src/ragel/ragel.rl
index 48c4229..655bb9c 100644
--- a/src/ragel/ragel.rl
+++ b/src/ragel/ragel.rl
@@ -20,7 +20,7 @@
word = alnum*;
token = ' ' | punct;
until_err = (any when { fpc != *error })*;
- search_err := ((any | token %{ *error = fpc; }) when { fpc != ragel->p })*;
+ search_err := ((any | token %{ *error = fpc; }) when { fpc != ragel->pe && fpc <= ragel->p })*;
print_err := (until_err %red <: word %reset <: (any - '\n')*) ${ fputc(fc, stderr); } >lead %!end %/end;
print_mark := (until_err ${ fputc(' ', stderr); } %red %mark <: any word $tail) >lead %!end %/end;
}%%