diff options
Diffstat (limited to 'subex/parse.go')
-rw-r--r-- | subex/parse.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/subex/parse.go b/subex/parse.go index d825f75..b6bf2f6 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -516,7 +516,14 @@ func parseSubex(l RuneReader, minPower int, inType Type) (lhs SubexAST, outType lhs = SubexASTCopyNumber{} case '`': outType = inType - lhs = parseValueReplacement(l, '`') + switch inType { + case ValueType: + lhs = parseValueReplacement(l, '`') + case RuneType: + lhs = parseRuneReplacement(l, '`') + default: + panic("Invalid inType") + } case ' ': if inType == RuneType { outType = RuneType @@ -540,6 +547,7 @@ func parseSubex(l RuneReader, minPower int, inType Type) (lhs SubexAST, outType loop: for { if minPower <= 20 { next, outType2 := parseSubex(l, 21, inType) + // TODO: next might legitimately be SubexASTEmpty, e.g. `` if next != nil && (next != SubexASTEmpty{}) { outType = resolveTypes(outType, outType2) lhs = SubexASTConcat{lhs, next} |