<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'subex/parse.go')
-rw-r--r--subex/parse.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/subex/parse.go b/subex/parse.go
index 9e47e0b..b1d54ac 100644
--- a/subex/parse.go
+++ b/subex/parse.go
@@ -39,7 +39,7 @@ func parseTerminatorAtomLiteral(termType rune, l RuneReader) walk.Atom {
case '@':
return expectBracket(l, walk.ArrayBegin, walk.ArrayEnd)
case '~':
- return expectBracket(l, walk.StartString{}, walk.EndString{})
+ return expectBracket(l, walk.StringTerminal{}, walk.StringTerminal{})
case '#':
return expectBracket(l, walk.MapBegin, walk.MapEnd)
default:
@@ -193,6 +193,8 @@ func parseReplacement(l RuneReader) (output []OutputContent) {
for _, literal := range literals {
output = append(output, OutputAtomLiteral {literal})
}
+ case '"':
+ output = append(output, OutputAtomLiteral {walk.StringTerminal{}})
default:
output = append(output, OutputAtomLiteral{atom: walk.StringAtom(r)})
}
@@ -218,6 +220,9 @@ func parseRangeSubex(l RuneReader) map[walk.Atom]walk.Atom {
literals := parseNonStringLiteral(l)
froms = append(froms, literals...)
continue
+ } else if fromsStart == '"' {
+ froms = append(froms, walk.StringTerminal{})
+ continue
} else {
atom := parseTerminatorAtomLiteral(fromsStart, l)
if atom != nil {
@@ -252,6 +257,9 @@ func parseRangeSubex(l RuneReader) map[walk.Atom]walk.Atom {
literals := parseNonStringLiteral(l)
tos = append(tos, literals...)
continue
+ } else if tosStart == '"' {
+ tos = append(tos, walk.StringTerminal{})
+ continue
} else {
atom := parseTerminatorAtomLiteral(tosStart, l)
if atom != nil {
@@ -307,6 +315,8 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
lhs = SubexASTOutput{replacement}
case '.':
lhs = SubexASTCopyAny{}
+ case '"':
+ lhs = SubexASTCopyAtom {walk.StringTerminal{}}
case '@', '#', '~':
lhs = SubexASTCopyAtom{atom: parseTerminatorAtomLiteral(r, l)}
case '`':