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")) 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()) list = append(list, p.parseStmt())
} }

View file

@ -8,6 +8,4 @@ var stmtStart = map[token.Token]bool{
token.For: true, token.For: true,
token.If: true, token.If: true,
token.Return: 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.Semicolon, ";"},
{token.Colon, ":"}, {token.Colon, ":"},
{token.Break, "break"}, {token.Break, "break"},
{token.Case, "case"},
{token.Continue, "continue"}, {token.Continue, "continue"},
{token.Default, "default"},
{token.Else, "else"}, {token.Else, "else"},
{token.For, "for"}, {token.For, "for"},
{token.Func, "func"}, {token.Func, "func"},
{token.If, "if"}, {token.If, "if"},
{token.Return, "return"}, {token.Return, "return"},
{token.Switch, "switch"},
{token.Var, "var"},
} }
// combine // combine

View file

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