aboutsummaryrefslogtreecommitdiff
path: root/driver/parser.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-05-21 14:01:09 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-05-22 15:44:47 +0900
commitb5ad1d30df993d68cc64c140bf1005b5490f2605 (patch)
tree919e3102866b4dcf4ed58c0a48227ee0c81f1f5d /driver/parser.go
parentProhibit applying #left, #right, #assign, and #prec to an error symbol (diff)
downloadcotia-b5ad1d30df993d68cc64c140bf1005b5490f2605.tar.gz
cotia-b5ad1d30df993d68cc64c140bf1005b5490f2605.tar.xz
Stop supporting SLR(1) and always use LALR(1)
Diffstat (limited to 'driver/parser.go')
-rw-r--r--driver/parser.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/driver/parser.go b/driver/parser.go
index dbebec3..14e9752 100644
--- a/driver/parser.go
+++ b/driver/parser.go
@@ -5,9 +5,6 @@ import (
)
type Grammar interface {
- // Class returns a class of grammar.
- Class() string
-
// InitialState returns the initial state of a parser.
InitialState() int
@@ -88,7 +85,7 @@ type SyntaxError struct {
type ParserOption func(p *Parser) error
-// DisableLAC disables LAC (lookahead correction). When the grammar has the LALR class, LAC is enabled by default.
+// DisableLAC disables LAC (lookahead correction). LAC is enabled by default.
func DisableLAC() ParserOption {
return func(p *Parser) error {
p.disableLAC = true
@@ -121,10 +118,6 @@ func NewParser(toks TokenStream, gram Grammar, opts ...ParserOption) (*Parser, e
stateStack: &stateStack{},
}
- if p.gram.Class() != "lalr" {
- p.disableLAC = true
- }
-
for _, opt := range opts {
err := opt(p)
if err != nil {