[antlr-interest] Java.g: variableModifier should be used in formalParameterDecls, localVariableDeclaration, forInit, and forVarControl
Terence Parr
parrt at cs.usfca.edu
Thu May 3 14:07:52 PDT 2007
Updated Java.g in examples.
Thanks!
Ter
On Apr 27, 2007, at 2:48 PM, Hiroaki Nakamura wrote:
> Hi, here is a patch for Java.g.
> I think variableModifier should be used in formalParameterDecls,
> localVariableDeclaration, forInit, and forVarControl.
>
> Unfortunately, Chapter 18 in JLS contains many bugs.
> CHAPTER 18 Syntax
> http://java.sun.com/docs/books/jls/third_edition/html/syntax.html
>
> For correct definitions, please see other chapters in JLS.
>
> 8.4.1 Formal Parameters
> http://java.sun.com/docs/books/jls/third_edition/html/
> classes.html#8.4.1
>
> 14.4 Local Variable Declaration Statements
> http://java.sun.com/docs/books/jls/third_edition/html/
> statements.html#14.4
>
> 14.14.1 The basic for Statement
> http://java.sun.com/docs/books/jls/third_edition/html/
> statements.html#14.14.1
>
> 14.14.2 The enhanced for statement
> http://java.sun.com/docs/books/jls/third_edition/html/
> statements.html#14.14.2
>
> --
> )Hiroaki Nakamura) hnakamur at gmail.com
>
> --- examples-v3/Java/Java/Java.g.orig 2007-03-15 07:14:09.000000000
> +0900
> +++ examples-v3/Java/Java/Java.g 2007-04-28 06:18:36.269430400 +0900
> @@ -360,7 +360,7 @@
> ;
>
> formalParameterDecls
> - : 'final'? annotations? type formalParameterDeclsRest?
> + : variableModifier* type formalParameterDeclsRest?
> ;
>
> formalParameterDeclsRest
> @@ -482,7 +482,7 @@
> ;
>
> localVariableDeclaration
> - : ('final' | annotation)* type variableDeclarators ';'
> + : variableModifier* type variableDeclarators ';'
> ;
>
> statement
> @@ -545,12 +545,12 @@
> ;
>
> forInit
> - : 'final'? (annotation)? type variableDeclarators
> + : variableModifier* type variableDeclarators
> | expressionList
> ;
>
> forVarControl
> - : 'final'? type Identifier ':' expression
> + : variableModifier* type Identifier ':' expression
> ;
>
> forUpdate
More information about the antlr-interest
mailing list