-
Notifications
You must be signed in to change notification settings - Fork 38
Description
While I was considering looking into #417 it caught my eye that "{foo}" match the string {foo} literally rather than a substitution string.
This one also goes under the banner of behavior where lrlex passes regular expressions directly to the rust regex crate.
Currently for the following lex file:
%%
"hello" "hello"
"[abc]" "x"
[\n\ ] ;
When we run it through lrlex, it treats the first case as matching "hello" including the quotes,
and it treats the second case, as matching the characters "a", "b", ... including the quotes.
$ echo \"a\" \"hello\" | lrlex test.l -
x "a"
hello "hello"
According to POSIX:
"..."
Any string enclosed in double-quotes shall represent the characters within the double-quotes as themselves, except that -escapes (which appear in the following table) shall be recognized. Any -escape sequence shall be terminated by the closing quote. For example, "\01" "1" represents a single string: the octal value 1 followed by the character '1'.
So the expected matching input should probably be something along the lines of:
$ echo '[abc] hello' | lrlex test.l -
x "[abc]"
hello "hello"