summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/semantic-tokens.lua7
-rw-r--r--script/parser/ast.lua37
-rw-r--r--script/parser/grammar.lua3
3 files changed, 47 insertions, 0 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index cd4a0086..37eabda7 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -127,6 +127,13 @@ Care['nonstandardSymbol.comment'] = function (source, results)
type = define.TokenTypes.comment,
}
end
+Care['nonstandardSymbol.continue'] = function (source, results)
+ results[#results+1] = {
+ start = source.start,
+ finish = source.finish,
+ type = define.TokenTypes.keyword,
+ }
+end
local function buildTokens(results, text, lines)
local tokens = {}
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 / {}))