mirror of
https://github.com/sojamo/controlp5
synced 2024-11-16 11:17:56 +01:00
36 lines
678 B
ANTLR
36 lines
678 B
ANTLR
grammar XML;
|
|
|
|
document : '<Window>' element+ '</Window>' ;
|
|
|
|
element : startTag (content )? endTag
|
|
| SELF_CLOSING
|
|
;
|
|
|
|
startTag : OPEN Name attribute* CLOSE ;
|
|
|
|
endTag : OPEN_SLASH Name CLOSE ;
|
|
|
|
SELF_CLOSING : OPEN Name SLASH_CLOSE ;
|
|
|
|
attribute : Name EQUALS value ;
|
|
|
|
content : element | STRING ;
|
|
|
|
value: STRING
|
|
| NUMBER UNIT;
|
|
|
|
UNIT: 'px' | '%';
|
|
WS : [ \t\r\n]+ -> skip;
|
|
OPEN : '<' ;
|
|
OPEN_SLASH: '</' ;
|
|
CLOSE : '>' ;
|
|
SLASH_CLOSE: '/>' ;
|
|
EQUALS : '=' ;
|
|
|
|
Name : ALPHA (ALPHA | DIGIT | '.' | '-' | '_')* ;
|
|
STRING : '"' ( ~'"' )* '"' | '\'' ( ~'\'' )* '\'' ;
|
|
NUMBER : DIGIT+ ;
|
|
|
|
fragment DIGIT : [0-9] ;
|
|
fragment ALPHA : [a-zA-Z] ;
|