diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-02-20 17:36:16 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-02-20 17:36:16 +0900 |
commit | 9357758697305753a68b541b42452a8cb13eebe2 (patch) | |
tree | bc10befd50c9a0fd1c5ccc894e1e18cfbbdacb33 /compiler/ast_test.go | |
parent | Fix computation of last positions (diff) | |
download | tre-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.go | 6 |
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) { |