lphy.base.parser.newick.NewickParser.g4 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lphy-base Show documentation
Show all versions of lphy-base Show documentation
The standard library of LPhy, which contains the required generative distributions and basic functions.
The newest version!
parser grammar NewickParser;
options { tokenVocab=NewickLexer; }
tree: node ';'? EOF;
node: ('(' node (COMMA node)* ')')? post ;
post: label? nodeMeta=meta? (':' lengthMeta=meta? length=number)? ;
label: number | STRING ;
meta: '[&' attrib (ACOMMA attrib)* ']' ;
attrib: attribKey=ASTRING '=' attribValue ;
attribValue: attribNumber | ASTRING | vector;
number: INT | FLOAT | FLOAT_SCI;
attribNumber: AINT | AFLOAT | AFLOAT_SCI;
vector: '{' attribValue (ACOMMA attribValue)* '}' ;