diff options
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/ast.lua | 37 | ||||
-rw-r--r-- | script/parser/grammar.lua | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/script/parser/ast.lua b/script/parser/ast.lua index cfaac45b..1f697ca4 100644 --- a/script/parser/ast.lua +++ b/script/parser/ast.lua @@ -363,6 +363,33 @@ local Defs = { } end, String = function (start, quote, str, finish) + if quote == '`' then + if State.options.nonstandardSymbol and State.options.nonstandardSymbol['`'] then + else + PushError { + type = 'ERR_NONSTANDARD_SYMBOL', + start = start, + finish = finish - 1, + info = { + symbol = '"', + }, + fix = { + title = 'FIX_NONSTANDARD_SYMBOL', + symbol = '"', + { + start = start, + finish = start, + text = '"', + }, + { + start = finish - 1, + finish = finish - 1, + text = '"', + }, + } + } + end + end return { type = 'string', start = start, @@ -1512,6 +1539,16 @@ local Defs = { } } end, + MissQuote3 = function (pos) + PushError { + type = 'MISS_SYMBOL', + start = pos, + finish = pos, + info = { + symbol = "`" + } + } + end, MissEscX = function (pos) PushError { type = 'MISS_ESC_X', diff --git a/script/parser/grammar.lua b/script/parser/grammar.lua index b5c02aef..1c70dfcd 100644 --- a/script/parser/grammar.lua +++ b/script/parser/grammar.lua @@ -257,6 +257,9 @@ StringDef <- {'"'} / {"'"} {~(Esc / !%nl !"'" .)*~} -> 1 ("'" / {} -> MissQuote2) + / {'`'} + {(!%nl !'`' .)*} -> 1 + ('`' / {} -> MissQuote3) / ('[' {} {:eq: '='* :} {} '[' %nl? {(!StringClose .)*} -> 1 (StringClose / {})) |