February 18, 2008

* Added org.antlr.tool.Strip (reads from file arg or stdin, emits to  
stdout)
   to strip actions from a grammar.

Leon: you can use this now for morph and can remove your strip...let  
me know if it's good enough.

Sample input:

/** sdkfljdksafl
  * sakljd
  */
grammar T; // ckjfdsl

options {k=1; output=AST;}

@parser::header {...}

@members {
akdsfljklas
}

z
scope A;
         :       q=a[34] ids+=ID
         ;

a[int i] returns [float f]
options {k=1;}
@init {rmoeve}
  : {sfkljlsf} B^
  | '3' -> '3'
{aaa}
;

b
scope {
         String name;
}
  : B
         -> {$arg!=null&&op!=null}?      ^($op RULE_REF $arg)
         ->                              ^(RULE_REF $arg)
  ;

c : {true}? B | {false}?=> C ;

/** dsklfjds */

fragment A : '0' {foo} ;
B : ~A
'z' ;


Output:

/** sdkfljdksafl
  * sakljd
  */
grammar T; // ckjfdsl

options {k=1; output=AST;}

@parser::header {...}


z
        :       a ID
        ;

a
options {k=1;}
  :  B
  | '3' ;

b
  : B
                 ;

c : /*{true}?*/ B | /*{false}?=>*/ C ;

/** dsklfjds */

fragment A : '0' {foo} ;
B : ~A
'z' ;

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to