diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-11-05 20:32:53 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-11-06 02:18:35 +0900 |
commit | a0aa647770ac6458e9b4749c3efa38d56e2fe4fe (patch) | |
tree | 117c30b994b1624b19a9fae485c9802f2a8bcc72 /driver/parser.go | |
parent | Remove anonymous symbol system (diff) | |
download | urubu-a0aa647770ac6458e9b4749c3efa38d56e2fe4fe.tar.gz urubu-a0aa647770ac6458e9b4749c3efa38d56e2fe4fe.tar.xz |
Move the skip table from lexer-related data to parser-related data
Diffstat (limited to 'driver/parser.go')
-rw-r--r-- | driver/parser.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/driver/parser.go b/driver/parser.go index b7f12ff..a152c3d 100644 --- a/driver/parser.go +++ b/driver/parser.go @@ -35,6 +35,9 @@ type Grammar interface { // TerminalCount returns a terminal symbol count of grammar. TerminalCount() int + // SkipTerminal returns true when a terminal symbol must be skipped on syntax analysis. + SkipTerminal(terminal int) bool + // EOF returns the EOF symbol. EOF() int @@ -63,9 +66,6 @@ type VToken interface { // Position returns (row, column) pair. Position() (int, int) - - // Skip returns true when a token must be skipped on syntax analysis. - Skip() bool } type TokenStream interface { @@ -275,7 +275,7 @@ func (p *Parser) nextToken() (VToken, error) { return nil, err } - if tok.Skip() { + if p.gram.SkipTerminal(tok.TerminalID()) { continue } |