aboutsummaryrefslogtreecommitdiff
path: root/compiler/parser.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-04-11 20:12:54 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-04-12 22:43:29 +0900
commitfd1e20085306c60520d6b44938097cb3145c35f0 (patch)
tree608a89ad04673394fb8eb364c32c3cf86591d204 /compiler/parser.go
parentFix grammar the parser accepts (diff)
downloadtre-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.go5
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
}