Merge pull request #70 from d5/fix69

Remove unused tokens
This commit is contained in:
Daniel Kang 2019-01-31 12:43:12 -08:00 committed by GitHub
commit 6420628310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 15 deletions

View file

@ -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())
}

View file

@ -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,
}

View file

@ -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

View file

@ -68,9 +68,7 @@ const (
_operatorEnd
_keywordBeg
Break
Case
Continue
Default
Else
For
Func
@ -78,8 +76,6 @@ const (
Immutable
If
Return
Switch
Var
True
False
In
@ -145,9 +141,7 @@ var tokens = [...]string{
Colon: ":",
Question: "?",
Break: "break",
Case: "case",
Continue: "continue",
Default: "default",
Else: "else",
For: "for",
Func: "func",
@ -155,8 +149,6 @@ var tokens = [...]string{
Immutable: "immutable",
If: "if",
Return: "return",
Switch: "switch",
Var: "var",
True: "true",
False: "false",
In: "in",