diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-11 20:12:54 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-12 22:43:29 +0900 |
commit | fd1e20085306c60520d6b44938097cb3145c35f0 (patch) | |
tree | 608a89ad04673394fb8eb364c32c3cf86591d204 /compiler/dfa_test.go | |
parent | Fix grammar the parser accepts (diff) | |
download | tre-fd1e20085306c60520d6b44938097cb3145c35f0.tar.gz tre-fd1e20085306c60520d6b44938097cb3145c35f0.tar.xz |
Increase the maximum number of symbol positions per pattern
This commit increases the maximum number of symbol positions per pattern to 2^15 (= 32,768).
When the limit is exceeded, the parse method returns an error.
Diffstat (limited to 'compiler/dfa_test.go')
-rw-r--r-- | compiler/dfa_test.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/dfa_test.go b/compiler/dfa_test.go index 26ee189..dcf1ae5 100644 --- a/compiler/dfa_test.go +++ b/compiler/dfa_test.go @@ -16,12 +16,20 @@ func TestGenDFA(t *testing.T) { t.Fatalf("DFA is nil") } - symPos := func(n uint8) symbolPosition { - return newSymbolPosition(n, false) + symPos := func(n uint16) symbolPosition { + pos, err := newSymbolPosition(n, false) + if err != nil { + panic(err) + } + return pos } - endPos := func(n uint8) symbolPosition { - return newSymbolPosition(n, true) + endPos := func(n uint16) symbolPosition { + pos, err := newSymbolPosition(n, true) + if err != nil { + panic(err) + } + return pos } s0 := newSymbolPositionSet().add(symPos(1)).add(symPos(2)).add(symPos(3)) |