[antlr-interest] separating code and everything else

dk0879 <diver7 at mail.ru> diver7 at mail.ru
Thu Jan 30 03:55:26 PST 2003


Hi, help beginner, please.
I write a lexer than must separate script code and HTML code
Lexer consists of two rules:

-------------------------------------
class TemplateLexer extends Lexer;

options {
    exportVocab = Template;
    testLiterals = false;
    k = 5;
}

SCRIPT_CODE
    :  "<?php"
        (   options { generateAmbigWarnings = false; }
        :   { LA(2)!='>' }? '?'
        |   '\r' '\n'       {newline();}
        |   '\r'            {newline();}
        |   '\n'            {newline();}
        |   ~('?'|'\n'|'\r')
        )*
        "?>"

HTML_CODE
    : // How to define "everything else" in this rule
    ;

Thank you



 

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



More information about the antlr-interest mailing list