org.antlr.v4.test.runtime.templates.ParserExec.AlternateQuotes.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-testsuite Show documentation
Show all versions of runtime-testsuite Show documentation
A collection of tests for ANTLR 4 Runtime libraries.
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