A complete example which shows my problem.

--- ADL.g ---

grammar ADL; // Rally Application Development Language

constant_definition
: ConstDef
;

ConstDef
: {System.out.println("");} CONST 
(
(' '|'\t')* Identifier {System.out.print($Identifier.text + " ");} 
(' '|'\t')* EQUAL 
(' '|'\t')* CharString {System.out.print($CharString.text + " ");}
(' '|'\t')* SEMICOLON
)+
;

CharString
: '"' (LETTER)+ '"'
;

CONST
: 'CONST' {System.out.print("CONST ");}
;

LETTER
: ('a'..'z'|'A'..'Z')
;

DIGIT
: ('0'..'9')
;

SEMICOLON
: ';' {System.out.println(";");}
;

EQUAL
: '=' {System.out.print("= ");}
;

Identifier
: LETTER (LETTER|'_'|DIGIT)+
;

----

--- ADL.java ---

import java.io.*;
import org.antlr.runtime.*;
import org.antlr.runtime.debug.DebugEventSocketProxy;

public class ADL {

    public static void main(String args[]) throws Exception {
        ADLLexer lex = new ADLLexer(new 
ANTLRFileStream("/home/thierry/antlr/output/tid.txt"));
        CommonTokenStream tokens = new CommonTokenStream(lex);
        
        ADLParser g = new ADLParser(tokens);
        try {
          g.constant_definition();
        } catch (RecognitionException e)  {
            e.printStackTrace();
        }       
    }
}

----

--- tid.txt ---

CONST  str1 = "ok" ;
        str2="ko";
       str3 = "end";

----

$ java ADL

CONST str1 = "ok" ;
= ;
= ;

Only the first values (Identifier, CharString) are printed and not the 
following ;-(
I used antlrworks-1.2.3.

Thierry.




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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to