Implement string literals in gdt expression parser - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/expr-lexer.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2013年05月13日 18:20:21 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2013年05月13日 18:20:21 +0200
commit8609bf03ac6479678c489c559a8596ef6488af20 (patch)
treeee798c4ced7a8d15189eaad13f3a6ed39bfb3e33 /expr-lexer.lua
parent3401c496044f22a9b4b57950e526cbe21e2077f4 (diff)
downloadgsl-shell-8609bf03ac6479678c489c559a8596ef6488af20.tar.gz
Implement string literals in gdt expression parser
Diffstat (limited to 'expr-lexer.lua')
-rw-r--r--expr-lexer.lua 4
1 files changed, 4 insertions, 0 deletions
diff --git a/expr-lexer.lua b/expr-lexer.lua
index c075d8a5..c13b1c38 100644
--- a/expr-lexer.lua
+++ b/expr-lexer.lua
@@ -52,6 +52,10 @@ function expr_lexer.next_token(lexer)
lexer:skip('%s*')
if lexer.n > len(lexer.src) then return {type= 'EOF'} end
local c = lexer:char()
+ if c == '\'' then
+ local str = lexer:consume("'[^']+'")
+ return {type= 'literal', value = str:sub(2, -2)}
+ end
if c == '[' then
local str = lexer:consume('%b[]')
return {type= 'ident', value= str:sub(2,-2)}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月28日 11:36:39 +0000

AltStyle によって変換されたページ (->オリジナル) /