summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-22 16:20:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-22 16:20:12 +0800
commit6caedbce008b6e79a1f21ad261dd6329bdb64acb (patch)
treef18fb5741d00ba6735a0612cf3add356ec246a4c /script/parser
parent8f8298009944db48438bd2125d3fe288ae207a64 (diff)
downloadlua-language-server-6caedbce008b6e79a1f21ad261dd6329bdb64acb.zip
#282
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/ast.lua37
-rw-r--r--script/parser/grammar.lua3
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 / {}))