diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2017-05-13 02:11:08 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-23 12:53:53 +0200 |
commit | 98b2d4911644a8e206fe9de692e4ccaa6e3e0cb3 (patch) | |
tree | e4a2e699c7509035873692b2c6f8d64757f929c5 | |
parent | 860cbef43b482513f0518efd8096e1916e782bb6 (diff) |
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..
-rw-r--r-- | src/ragel/ragel.rl | 4 |
1 files changed, 2 insertions, 2 deletions
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 |