aboutsummaryrefslogtreecommitdiff
path: root/compiler/ast_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-02-20 17:36:16 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-02-20 17:36:16 +0900
commit9357758697305753a68b541b42452a8cb13eebe2 (patch)
treebc10befd50c9a0fd1c5ccc894e1e18cfbbdacb33 /compiler/ast_test.go
parentFix computation of last positions (diff)
downloadtre-9357758697305753a68b541b42452a8cb13eebe2.tar.gz
tre-9357758697305753a68b541b42452a8cb13eebe2.tar.xz
Add + and ? operators
* a+ matches 'a' one or more times. This is equivalent to aa*. * a? matches 'a' zero or one time.
Diffstat (limited to 'compiler/ast_test.go')
-rw-r--r--compiler/ast_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/ast_test.go b/compiler/ast_test.go
index 61d6064..735ccf8 100644
--- a/compiler/ast_test.go
+++ b/compiler/ast_test.go
@@ -102,6 +102,12 @@ func TestASTNode(t *testing.T) {
first: newSymbolPositionSet().add(1),
last: newSymbolPositionSet().add(1),
},
+ {
+ root: newOptionNode(newSymbolNode(nil, 0, 1)),
+ nullable: true,
+ first: newSymbolPositionSet().add(1),
+ last: newSymbolPositionSet().add(1),
+ },
}
for i, tt := range tests {
t.Run(fmt.Sprintf("#%v", i), func(t *testing.T) {