I got problems matching the string:
"history":
... with the following ANTLR code (work in progress, really):
(STRING)':'
Where I have the STRING terminal defined as:
STRING : '"'('a'..'z'|'A'..'Z')+'"'
;
It works if I add the ending colon in the STRING definition itself, like
so (and then remove it from the parent rule):
STRING : '"'('a'..'z'|'A'..'Z')+'"'':'
;
... but this of course makes for a less general string definition :/ ...
Any ideas how I should go about this?
Best regards
// Samuel
Addendum: The full input string and EBNF code is as follows:
=== Input string ===
sam_to_bam.py
--input1=$source.input1
--dbkey=${input1.metadata.dbkey}
#if $source.index_source == "history":
--ref_file=$source.ref_file
#else
--ref_file="None"
#end if
--output1=$output1
--index_dir=${GALAXY_DATA_INDEX_DIR}
=== ANTLR code ===
grammar GalaxyToolConfig;
options {output=AST;}
command : binary param* ifstatement '\n' text? ELSE text? ENDIF text?
;
binary : WORD
;
param : '--' PARAMNAME '=' ( VARIABLE | STRING )
;
ifstatement
: IF ( STRING | VARIABLE ) EQ ( (STRING)':' | (VARIABLE)':' )
;
text : WORD WORD*
;
IF : '#if'
;
ELSE : '#else'
;
ENDIF : '#end if'
;
EQ : '=='
;
COLON : ':'
;
PARAMNAME: ('a'..'z')('a'..'z'|'A'..'Z'|'0'..'9'|'.'|'_')*
;
STRING : '"'('a'..'z'|'A'..'Z')+'"'
;
VARIABLE
: '$''{'?PARAMNAME'}'?
;
// CHAR :
('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'.'|'$'|'{'|'}'|'='|'"'|'-'|':'|';')
// ;
WORD : (~(' '|'\t'|'\r'|'\n'))+
;
WS : ( ' '
| '\t'
| '\r'
| '\n'
) {$channel=HIDDEN;}
;
--
System Expert / Bioinformatician
SNIC-UPPMAX / SciLifeLab Uppsala
Uppsala University, Sweden
--------------------------------------
E-mail: [email protected]
Phone: +46 (0)18 - 471 1060
WWW: http://www.uppmax.uu.se
Uppnex: https://www.uppnex.uu.se
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.