diff options
Diffstat (limited to 'subex')
-rw-r--r-- | subex/parse.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/subex/parse.go b/subex/parse.go index 24ff3d1..4b1aa6e 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -61,7 +61,7 @@ func parseNonStringLiteral(l RuneReader) (literals []walk.Atom) { continue } switch r { - case '`': + case '`', '~': return literals case ' ', '\t': continue @@ -91,6 +91,8 @@ func parseNonStringLiteral(l RuneReader) (literals []walk.Atom) { literals = append(literals, walk.ArrayBegin) case ']': literals = append(literals, walk.ArrayEnd) + default: + panic("Invalid literal") } } } @@ -295,6 +297,13 @@ func parseSubex(l RuneReader, minPower int) SubexAST { for _, literal := range literals { lhs = SubexASTConcat {lhs, SubexASTCopyAtom {literal}} } + case '~': + literals := parseNonStringLiteral(l) + var replacement []OutputContent + for _, literal := range literals { + replacement = append(replacement, OutputAtomLiteral {literal}) + } + lhs = SubexASTOutput {replacement} default: lhs = SubexASTCopyAtom{atom: walk.StringAtom(r)} } |