[antlr-interest] Rewrite only if rule returns non-empty result

Christian chwchw at gmx.de
Thu Oct 27 05:12:45 PDT 2011


Perhaps, you need more information about unary_expr:

unary_expr
  : cast_expression
  | '+' unary_expression -> ^(POSITIVE unary_expression)
  | '-' unary_expression -> ^(NEGATIVE unary_expression)
  | '!' unary_expression
  | '~' unary_expression
  | PRE_INC unary_expression
  | pre_decrement_expression
  | primary_or_array_creation_expression '++'? '--'?
  | pointer_indirection_expression
  | addressof_expression
  ;

Am 26.10.2011 12:29, schrieb Christian:
> Hi community,
>
> I have the following rule:
>
> unary_expression
>   : unary_expr -> ^(UNARY_EXPRESSION unary_expr)
>   ;
>
> I want to rewrite it only if unary_expr returns a non-empty result.
> Actually, I want to solve the
> org.antlr.runtime.tree.RewriteEmptyStreamException: rule unary_expr. I
> think, it is quite easy, but I am too new to ANTLR.
>
> Regards,
> Christian
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



More information about the antlr-interest mailing list