cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ovi...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/flow flow.g
Date Thu, 07 Mar 2002 02:12:08 GMT
ovidiu      02/03/06 18:12:08

  Modified:    src/scratchpad/schecoon/src/org/apache/cocoon/flow flow.g
  Log:
  Cleaned up.
  
  Revision  Changes    Path
  1.5       +100 -85   xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/flow/flow.g
  
  Index: flow.g
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/flow/flow.g,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- flow.g	3 Mar 2002 18:12:22 -0000	1.4
  +++ flow.g	7 Mar 2002 02:12:08 -0000	1.5
  @@ -21,40 +21,50 @@
       ;
   
   expr
  -    :   elem        // Elementary expression
  +    :   assignment  // Simple expressions
  +    |   block       // A sequence of expressions
       |   function    // Function declaration
       |   varDecl     // Variable declaration
  -    |   "if" LPAREN elem RPAREN expr
  +    |   "if" LPAREN expr RPAREN expr
           (
  -			// CONFLICT: the old "dangling-else" problem...
  -			//           ANTLR generates proper code matching
  -			//			 as soon as possible.  Hush warning.
  +                        // CONFLICT: the old "dangling-else" problem...
  +                        //           ANTLR generates proper code matching
  +                        //           as soon as possible.  Hush warning.
               options {
                   warnWhenFollowAmbig = false;
  -            }
  -        :   "else" elem
  +            }:
  +            "else" expr
           )?
  -    |   "return" (elem|function)?
  -    |   "try" elem (handler)+
  -    |   "throw" elem
  +    |   "return" expr
  +    |   "try" expr
  +        (
  +            // CONFLICT: Similar with the dangling else
  +            options {
  +                warnWhenFollowAmbig = false;
  +            }:
  +            handler
  +        )+
  +    |   "throw" expr
   
           // The following expressions should be rewritten using macros,
           // when they become available
       |   "import" identifierStar
  -    |   "while" LPAREN elem RPAREN expr
  -    |   "switch" LPAREN elem RPAREN casesGroup
  -    |   "for" LPAREN (varDecl|elemList) SEMI elemList SEMI elemList RPAREN expr
  -    |   "foreach" LPAREN IDENT "in" elem RPAREN expr
  -    |   "do" elem "while" LPAREN elem RPAREN
  -    ;
  -
  -elem
  -    :   assignment  // Simple expressions
  -    |   block       // A sequence of expressions
  +    |   "while" LPAREN expr RPAREN expr
  +    |   "switch" LPAREN expr RPAREN casesGroup
  +    |   "for" LPAREN exprList SEMI exprList SEMI exprList RPAREN expr
  +    |   "foreach" LPAREN IDENT "in" expr RPAREN expr
  +    |   "do" expr "while" LPAREN expr RPAREN
       ;
   
  -elemList
  -    :   elem (COMMA elem)*
  +exprList
  +    :   expr
  +        (
  +            // CONFLICT: Similar with the dangling else
  +            options {
  +                warnWhenFollowAmbig = false;
  +            }:
  +            COMMA expr
  +        )*
       ;
   
   // A function is either named or unnamed. A named function is //
  @@ -76,35 +86,35 @@
   
   // Variable declaration
   varDecl
  -    :   "var" assignment (COMMA assignment)*
  +    :   "var" exprList
       ;
   
   casesGroup
  -	:	(	// CONFLICT: to which case group do the statements bind?
  -			//           ANTLR generates proper code: it groups the
  -			//           many "case"/"default" labels together then
  -			//           follows them with the statements
  -			options {
  -				warnWhenFollowAmbig = false;
  -			}
  -			:
  -			aCase
  -		)+
  -		caseSList
  -	;
  +        :       (       // CONFLICT: to which case group do the statements bind?
  +                        //           ANTLR generates proper code: it groups the
  +                        //           many "case"/"default" labels together then
  +                        //           follows them with the statements
  +                        options {
  +                                warnWhenFollowAmbig = false;
  +                        }
  +                        :
  +                        aCase
  +                )+
  +                caseSList
  +        ;
   
   aCase
  -	:	("case" elem | "default") COLON
  -	;
  +        :       ("case" expr | "default") COLON
  +        ;
   
   caseSList
  -	:	exprs
  -	;
  +        :       exprs
  +        ;
   
   // Handler for a try expression
   handler
  -    :   "catch" LPAREN IDENT IDENT RPAREN block
  -    |   "finally" block
  +    :   "catch" LPAREN expr IDENT RPAREN expr
  +    |   "finally" expr
       ;
   
   identifierStar
  @@ -193,10 +203,10 @@
               LBRACK assignment RBRACK
   
               // Method invocation
  -        |   DOT LPAREN elemList RPAREN
  +        |   DOT LPAREN exprList RPAREN
   
               // Function invocation
  -        |   LPAREN elemList RPAREN
  +        |   LPAREN exprList RPAREN
           )*
       ;
   
  @@ -221,9 +231,9 @@
   //   [a: 1, b: 2, c: 3] -> dictionary
   // Use a syntactic predicate to disambiguate on ':'
   arrayOrDict
  -    :   (LBRACK elem COLON)=>
  -        LBRACK elem COLON elem (COMMA elem COLON elem)* RBRACK
  -    |   LBRACK elemList RBRACK
  +    :   (LBRACK expr COLON)=>
  +        LBRACK expr COLON expr (COMMA expr COLON expr)* RBRACK
  +    |   LBRACK exprList RBRACK
       ;
   
   
  @@ -235,45 +245,45 @@
       testLiterals=false;    // don't automatically test for literals
   }
   
  -QUESTION		:	'?'		;
  -LPAREN			:	'('		;
  -RPAREN			:	')'		;
  -LBRACK			:	'['		;
  -RBRACK			:	']'		;
  -LCURLY			:	'{'		;
  -RCURLY			:	'}'		;
  -COLON			:	':'		;
  -COMMA			:	','		;
  -ASSIGN			:	'='		;
  -EQUAL			:	"=="	;
  -LNOT			:	'!'		;
  -BNOT			:	'~'		;
  -NOT_EQUAL		:	"!="	;
  -DIV				:	'/'		;
  -DIV_ASSIGN		:	"/="	;
  -PLUS			:	'+'		;
  -PLUS_ASSIGN		:	"+="	;
  -INC				:	"++"	;
  -MINUS			:	'-'		;
  -MINUS_ASSIGN	:	"-="	;
  -DEC				:	"--"	;
  -STAR			:	'*'		;
  -STAR_ASSIGN		:	"*="	;
  -MOD				:	'%'		;
  -MOD_ASSIGN		:	"%="	;
  -GE				:	">="	;
  -GT				:	">"		;
  -LE				:	"<="	;
  -LT				:	'<'		;
  -BXOR			:	'^'		;
  -BXOR_ASSIGN		:	"^="	;
  -BOR				:	'|'		;
  -BOR_ASSIGN		:	"|="	;
  -LOR				:	"||"	;
  -BAND			:	'&'		;
  -BAND_ASSIGN		:	"&="	;
  -LAND			:	"&&"	;
  -SEMI			:	';'		;
  +QUESTION                :       '?'             ;
  +LPAREN                  :       '('             ;
  +RPAREN                  :       ')'             ;
  +LBRACK                  :       '['             ;
  +RBRACK                  :       ']'             ;
  +LCURLY                  :       '{'             ;
  +RCURLY                  :       '}'             ;
  +COLON                   :       ':'             ;
  +COMMA                   :       ','             ;
  +ASSIGN                  :       '='             ;
  +EQUAL                   :       "=="    ;
  +LNOT                    :       '!'             ;
  +BNOT                    :       '~'             ;
  +NOT_EQUAL               :       "!="    ;
  +DIV                             :       '/'             ;
  +DIV_ASSIGN              :       "/="    ;
  +PLUS                    :       '+'             ;
  +PLUS_ASSIGN             :       "+="    ;
  +INC                             :       "++"    ;
  +MINUS                   :       '-'             ;
  +MINUS_ASSIGN    :       "-="    ;
  +DEC                             :       "--"    ;
  +STAR                    :       '*'             ;
  +STAR_ASSIGN             :       "*="    ;
  +MOD                             :       '%'             ;
  +MOD_ASSIGN              :       "%="    ;
  +GE                              :       ">="    ;
  +GT                              :       ">"             ;
  +LE                              :       "<="    ;
  +LT                              :       '<'             ;
  +BXOR                    :       '^'             ;
  +BXOR_ASSIGN             :       "^="    ;
  +BOR                             :       '|'             ;
  +BOR_ASSIGN              :       "|="    ;
  +LOR                             :       "||"    ;
  +BAND                    :       '&'             ;
  +BAND_ASSIGN             :       "&="    ;
  +LAND                    :       "&&"    ;
  +SEMI                    :       ';'             ;
   
   protected
   PANYS   :   ('a'..'z'|'A'..'Z'|'@'|'#'|'$'|'_'|'?');
  @@ -448,3 +458,8 @@
       :   'f'|'F'|'d'|'D'
       ;
   
  +
  +// Local Variables:
  +// tab-width: 8
  +// indent-tabs-mode: nil
  +// End:
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message