[antlr-interest] help with pl/sql grammar

Ric Klaren klaren at cs.utwente.nl
Tue Apr 20 02:01:47 PDT 2004


On Mon, Apr 19, 2004 at 11:17:08AM -0500, lorena varela wrote:
> TokenStreamException: expecting '(', found 'e'

Usually means that the lexer of antlr is confused somewhere. To start with
the from_clause rule looks fishy. The '{' and '}' and a comma between them
don't make sense.

> from_clause :
> 	"FROM" 
> 	{   table_reference 
> 	  | ("THE")? "(" subquery ")" (alias)?
> 	, "," };

> subquery_factoring_clause :
> 	"WITH" 
> 	{query_name "AS" "(" subquery ")", ","} ;

This one too.

> select_list :
> 	"*"
> 	| {   query_name "." "*"
> 	    | (schema ".")? (table | view) ".*" 
> 	    | expression (("AS")? c_alias)?
> 	  , "," };

And this one..

> query_table_expression :	
> 	(schema ".")? 
> 	  ( table ( (  "PARTITION" "(" partition ")"
>         	       | "SUBPARTITION" "(" subpartition ")"
> 	            ) (sample_clause)?
> 	           | "@" dblink
>         	     | sample_clause
>         	  )?
> 	     | { view } ("@" dblink)?
> 	  )
> 	| "(" subquery (subquery_restriction_clause)? ")"
> 	| query_name
> 	;

And this...

> group_by_clause :
> 	"GROUP" "BY"
> 	{  rollup_cube_clause 
> 	 | grouping_sets_clause
> 	 | expression 
> 	 , ","}
> 	(having_clause)?;

And this...

> order_by_clause :
> 	"ORDER" ("SIBLINGS")? "BY" 
> 	{(expression | position | c_alias) 
> 	 (ascending_or_descending)? 
> 	 ("NULLS" "FIRST" | "NULLS" "LAST")?, ","} ;

And a load of others. You seem to have misunderstood the use of the curly
braces. They're for grouping action code in the native language your
generating the parser for. Check out the metalanguage section of the docs. 

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  "Good judgement comes from experience.
     Experience comes from bad judgement." --- Unknown



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list