All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.antlr.v4.test.runtime.templates.ParserExec.AlternateQuotes.stg Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
TestType() ::= "CompositeParser"

Options ::= [
	"SlaveIsLexer": true,
	"Debug": false
]

Grammar ::= [
	"ModeTagsParser": {}
]

SlaveGrammars ::= [
	"ModeTagsLexer": {}
]

Input() ::= ""

Rule() ::= "file_"

Output() ::= ""

Errors() ::= ""

grammar(grammarName, slaveGrammarName) ::= <<
parser grammar ;
options { tokenVocab=; } // use tokens from .g4
file_: (tag | TEXT)* ;
tag : '«' ID '»'
    | '«' '/' ID '»'
    ;
>>

slaveGrammar(grammarName) ::= <<
lexer grammar ;
// Default mode rules (the SEA)
OPEN  : '«'     -> mode(ISLAND) ;       // switch to ISLAND mode
TEXT  : ~'«'+ ;                         // clump all text together
mode ISLAND;
CLOSE : '»'     -> mode(DEFAULT_MODE) ; // back to SEA mode
SLASH : '/' ;
ID    : [a-zA-Z]+ ;                     // match/send ID in tag to parser
>>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy