From 98b2d4911644a8e206fe9de692e4ccaa6e3e0cb3 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sat, 13 May 2017 02:11:08 +0300 Subject: ragel.rl: mark anything as error The word label is mainly meant to define printable and conceated characters. In print_mark we use it to print tail in case we hit the valid* kleene star expression. Otherwise we will just show '^' mark on whatever byte we failed on. This allows to catch semantical failures such as having newlines at wrong place etc.. --- src/ragel/ragel.rl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ragel/ragel.rl b/src/ragel/ragel.rl index 03c6eb3..7e51030 100644 --- a/src/ragel/ragel.rl +++ b/src/ragel/ragel.rl @@ -21,8 +21,8 @@ word = print | valid*; until_err = (any when { fpc != *error })*; - print_err := (until_err <: word >red %reset <: (print - '\n')*) $char >*lead %!end %/end; - print_mark := (until_err $lead <: word >red $mark) >*lead %!end %/end; + print_err := (until_err <: (word - '\n') >red %reset <: (print - '\n')*) $char >*lead %!end %/end; + print_mark := (until_err $lead <: (any | word) >red $mark) >*lead %!end %/end; }%% static void -- cgit v1.2.3