Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Jan 8, 2019
1 parent 3b371f7 commit 311a336
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 71 deletions.
12 changes: 6 additions & 6 deletions vm/lex.go
Expand Up @@ -28,26 +28,26 @@ func (l *Lexer) Lex(v *yySymType) int {
v.str = l.s.TokenText()
switch v.str {
case "for":
tok = FOR
tok = cfor
case "in":
tok = IN
tok = in
default:
tok = IDENT
tok = ident
}
case scanner.Int:
tok = LIT
tok = lit
v.lit, err = strconv.ParseInt(l.s.TokenText(), 10, 64)
if err != nil {
return -1
}
case scanner.Float:
tok = LIT
tok = lit
v.lit, _ = strconv.ParseFloat(l.s.TokenText(), 64)
if err != nil {
return -1
}
case scanner.String:
tok = LIT
tok = lit
s := l.s.TokenText()
if len(s) >= 2 {
v.lit = s[1 : len(s)-1]
Expand Down
124 changes: 62 additions & 62 deletions vm/parser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vm/parser.go.y
Expand Up @@ -14,15 +14,15 @@ package vm
%type<expr> expr
%type<exprs> exprs
%token<str> ident
%token<lit> lit for in
%token<lit> lit cfor in

%%

stmt : for ident in expr
stmt : cfor ident in expr
{
yylex.(*Lexer).e = &ForExpr{$2, "", $4}
}
| for ident ',' ident in expr
| cfor ident ',' ident in expr
{
yylex.(*Lexer).e = &ForExpr{$2, $4, $6}
}
Expand Down

0 comments on commit 311a336

Please sign in to comment.