dont require top level parens
This commit is contained in:
parent
de3e3e5d4e
commit
0d7eb4139b
2 changed files with 13 additions and 2 deletions
13
ast/lex.go
13
ast/lex.go
|
|
@ -25,6 +25,17 @@ import (
|
||||||
const string_delims string = "\"'`"
|
const string_delims string = "\"'`"
|
||||||
|
|
||||||
func Lex(input string) *Token {
|
func Lex(input string) *Token {
|
||||||
|
ret := lex(input)
|
||||||
|
if ret.Tag != LIST {
|
||||||
|
temp := &Token{Tag: LIST}
|
||||||
|
temp.Direct(ret)
|
||||||
|
ret = temp
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func lex(input string) *Token {
|
||||||
if len(input) == 0 {
|
if len(input) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +54,7 @@ func Lex(input string) *Token {
|
||||||
(*iter).Position = pos
|
(*iter).Position = pos
|
||||||
|
|
||||||
if is_list {
|
if is_list {
|
||||||
(*iter).inner = Lex(tok)
|
(*iter).inner = lex(tok)
|
||||||
(*iter).Tag = LIST
|
(*iter).Tag = LIST
|
||||||
is_list = false
|
is_list = false
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue