diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-21 09:53:04 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-21 09:53:04 +0100 |
commit | f1e5bc37723a4faa30bbfeed392c31489914eb50 (patch) | |
tree | 3515317bfd9a509d4bef0392ec0cbf3da35d71eb /subex/parse.go | |
parent | 3cb886859e9b4df4ece183583dfd8b5ba7a59584 (diff) | |
download | stred-go-f1e5bc37723a4faa30bbfeed392c31489914eb50.tar |
Add subex syntax to copy across booleans, numbers, strings and values
Diffstat (limited to 'subex/parse.go')
-rw-r--r-- | subex/parse.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/subex/parse.go b/subex/parse.go index 5675ae0..106663d 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -281,7 +281,7 @@ func parseSubex(l RuneReader, minPower int) SubexAST { case '[': rangeParts := parseRangeSubex(l) lhs = SubexASTRange {rangeParts} - case ')', '|', ';', '{', '+', '-', '*', '/', '$': + case ')', '|', ';', '{', '+', '-', '*', '/', '!', '$': l.Rewind() return nil case '=': @@ -289,6 +289,16 @@ func parseSubex(l RuneReader, minPower int) SubexAST { lhs = SubexASTOutput{replacement} case '.': lhs = SubexASTCopyAny{} + case '?': + lhs = SubexASTCopyBool{} + case '%': + lhs = SubexASTCopyNumber{} + case '_': + lhs = SubexASTCopyStringAtom{} + case '#': + lhs = SubexASTCopyString{} + case ',': + lhs = SubexASTCopyValue{} case '"': lhs = SubexASTCopyAtom {walk.StringTerminal{}} case '`': |