r4659@macbookpro: aamine | 2009-05-03 19:08:18 +0900

* net/loveruby/cflat/parser/Parser.jj: sizeof TYPE requires one more lookahead because EXPR of "sizeof EXPR" may have parentheses, too.  We can distinguish type and expr by 1 look ahead, because Head of type() == head of typeref() == head of typeref_base().  typeref_base has unique terminal on head.
 


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4172 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2009-05-03 14:46:13 +00:00
parent 87b5b09506
commit 3c409c9bf4
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,11 @@
Sun May 3 19:08:07 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/parser/Parser.jj: sizeof TYPE requires one
more lookahead because EXPR of "sizeof EXPR" may have parentheses,
too. We can distinguish type and expr by 1 look ahead, because
Head of type() == head of typeref() == head of typeref_base().
typeref_base has unique terminal on head.
Sat May 2 09:49:23 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/Compiler.java: refactoring: rename

View File

@ -1228,7 +1228,7 @@ ExprNode unary():
| "~" n=term() { return new UnaryOpNode("~", n); }
| "*" n=term() { return new DereferenceNode(n); }
| "&" n=term() { return new AddressNode(n); }
| LOOKAHEAD(2) <SIZEOF> "(" t=type() ")"
| LOOKAHEAD(3) <SIZEOF> "(" t=type() ")"
{
return new SizeofTypeNode(t, size_t());
}