I want to recognize a function definition and skip it before passing tokens
to the parser.The function definition starts with "FUNCTION" ,ends with
"END_FUNCTION".
Also it could be nested,for example:
FUNCTION value_range_aggregate_rep_item(agg
   : AGGREGATE OF representation_item) : BOOLEAN;

  FUNCTION cri(agg : AGGREGATE OF representation_item) : BOOLEAN;
   BEGIN
    IF (SIZEOF(agg) = 3)
     AND
    (SIZEOF(QUERY(i1 <* agg | ('AUTOMOTIVE_DESIGN.' +
       'MEASURE_REPRESENTATION_ITEM' IN TYPEOF(i1)))) = 3)
     THEN
      RETURN (TRUE);
     ELSE
      RETURN (FALSE);
    END_IF;
   END;
  END_FUNCTION;
  BEGIN
   IF ((SIZEOF(agg) = 3)
   AND (SIZEOF(QUERY(i <* agg | (
      'AUTOMOTIVE_DESIGN.' +
      'COMPOUND_REPRESENTATION_ITEM' IN TYPEOF(i))
      AND cri(i\compound_representation_item.item_element))) = 1))
    THEN
     RETURN (TRUE);
    ELSE
     RETURN (FALSE);
   END_IF;
  END;
 END_FUNCTION;


How to write this lexer rule?
I tried, but failed. Check the following wrong lexer rule I wrote:

FUNCTION_DECL
: 'FUNCTION'
 {
                       $channel=HIDDEN;
         }
         ( options {greedy=false;} : . )*  FUNCTION_DECL ( options
{greedy=false;} : . )*  'END_FUNCTION' SEMI
;


I couldn't get it complied with no error.
Could anyone help me with this?
Thank you.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to