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/parser.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/parser.go')
-rw-r--r-- | compiler/parser.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/parser.go b/compiler/parser.go index 623a174..8658231 100644 --- a/compiler/parser.go +++ b/compiler/parser.go @@ -74,7 +74,10 @@ func parse(regexps map[int][]byte) (astNode, *symbolTable, error) { root = newAltNode(root, n) } } - positionSymbols(root, 1) + _, err := positionSymbols(root, 1) + if err != nil { + return nil, nil, err + } return root, genSymbolTable(root), nil } |