From 8087a503f00913fc7b26e75d9549f6b99adf3242 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sun, 7 May 2017 17:01:49 +0300 Subject: 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 ':'. --- src/ragel/ragel.rl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ragel') 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; }%% -- cgit v1.2.3-70-g09d2