aboutsummaryrefslogtreecommitdiff
path: root/driver/parser.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-11-05 20:32:53 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-11-06 02:18:35 +0900
commita0aa647770ac6458e9b4749c3efa38d56e2fe4fe (patch)
tree117c30b994b1624b19a9fae485c9802f2a8bcc72 /driver/parser.go
parentRemove anonymous symbol system (diff)
downloadurubu-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.go8
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
}