X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.re;h=e57353662c59fef7bef95e4adffeeba710074900;hp=2cdb1e84bf0dbcc59b5b0f7eabe86376dbca024b;hb=7a210012b049742d95928175e4ebb0e565f9bda7;hpb=c101a4de2983791d5892e60d765b73b6b3ccf6f8 diff --git a/src/parser.re b/src/parser.re index 2cdb1e8..e573536 100644 --- a/src/parser.re +++ b/src/parser.re @@ -455,19 +455,40 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input character: ; /*!re2c - "'" { if (escaped) goto character; cur -= 1; NEWTOKEN(PSI_T_QUOTED_CHAR); cur += 1; token->flags = char_width; goto start; } EOL { NEWLINE(); goto character; } - "\\" { escaped = !escaped; } - * { goto character; } + "\\" { escaped = !escaped; goto character; } + "'" { + if (escaped) { + escaped = false; + goto character; + } + cur -= 1; + NEWTOKEN(PSI_T_QUOTED_CHAR); + cur += 1; + token->flags = char_width; + goto start; + } + * { escaped = false; goto character; } */ + string: ; /*!re2c - "\"" { if (escaped) goto string; cur -= 1; NEWTOKEN(PSI_T_QUOTED_STRING); cur += 1; token->flags = char_width; goto start; } EOL { NEWLINE(); goto string; } "\\" { escaped = !escaped; goto string; } - * { goto string; } + "\"" { + if (escaped) { + escaped = false; + goto string; + } + cur -= 1; + NEWTOKEN(PSI_T_QUOTED_STRING); + cur += 1; + token->flags = char_width; + goto start; + } + * { escaped = false; goto string; } */