Skip to content

Commit

Permalink
Merge pull request #70 from d5/fix69
Browse files Browse the repository at this point in the history
Remove unused tokens
  • Loading branch information
d5 authored Jan 31, 2019
2 parents 61e534e + 061d800 commit 6420628
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion compiler/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (p *Parser) parseStmtList() (list []ast.Stmt) {
defer un(trace(p, "StatementList"))
}

for p.token != token.Case && p.token != token.Default && p.token != token.RBrace && p.token != token.EOF {
for p.token != token.RBrace && p.token != token.EOF {
list = append(list, p.parseStmt())
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/parser/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ var stmtStart = map[token.Token]bool{
token.For: true,
token.If: true,
token.Return: true,
token.Switch: true,
token.Var: true,
}
4 changes: 0 additions & 4 deletions compiler/scanner/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,12 @@ func TestScanner_Scan(t *testing.T) {
{token.Semicolon, ";"},
{token.Colon, ":"},
{token.Break, "break"},
{token.Case, "case"},
{token.Continue, "continue"},
{token.Default, "default"},
{token.Else, "else"},
{token.For, "for"},
{token.Func, "func"},
{token.If, "if"},
{token.Return, "return"},
{token.Switch, "switch"},
{token.Var, "var"},
}

// combine
Expand Down
8 changes: 0 additions & 8 deletions compiler/token/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,14 @@ const (
_operatorEnd
_keywordBeg
Break
Case
Continue
Default
Else
For
Func
Error
Immutable
If
Return
Switch
Var
True
False
In
Expand Down Expand Up @@ -145,18 +141,14 @@ var tokens = [...]string{
Colon: ":",
Question: "?",
Break: "break",
Case: "case",
Continue: "continue",
Default: "default",
Else: "else",
For: "for",
Func: "func",
Error: "error",
Immutable: "immutable",
If: "if",
Return: "return",
Switch: "switch",
Var: "var",
True: "true",
False: "false",
In: "in",
Expand Down

0 comments on commit 6420628

Please sign in to comment.