Merge pull request #102 from z7zmey/issue-101

fix constant string fail "{\"
This commit is contained in:
Vadym Slizov 2020-01-08 09:35:32 +02:00 committed by GitHub
commit 7ad2a2c24f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 344 additions and 340 deletions

File diff suppressed because it is too large Load Diff

View File

@ -120,9 +120,10 @@ func (lex *Lexer) Lex(lval Lval) int {
| "\n" @constant_string_new_line -> double_qoute | "\n" @constant_string_new_line -> double_qoute
), ),
double_qoute_nondollar: ( double_qoute_nondollar: (
(any - [$"\r\n]) -> double_qoute (any - [\\$"\r\n]) -> double_qoute
| "\r" @constant_string_new_line -> double_qoute | "\r" @constant_string_new_line -> double_qoute
| "\n" @constant_string_new_line -> double_qoute | "\n" @constant_string_new_line -> double_qoute
| "\\" -> double_qoute_any
| '"' -> final | '"' -> final
), ),
double_qoute_nonvarname: ( double_qoute_nonvarname: (

View File

@ -496,6 +496,7 @@ func TestConstantStrings(t *testing.T) {
"{" "{"
"{a" "{a"
"\{$" "\{$"
"{\""
` `
expected := []string{ expected := []string{