From b5ad1d30df993d68cc64c140bf1005b5490f2605 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 21 May 2022 14:01:09 +0900 Subject: Stop supporting SLR(1) and always use LALR(1) --- driver/parser.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'driver/parser.go') 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 { -- cgit v1.2.3