JTreeSS subversion repository

sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
Rev: HEAD (175) - https://secure.bioinfweb.info/Code/svn/JTreeSS / trunk / main / info.bioinfweb.jtreess.core / TreeSS.g4
Show File - TreeSS.g4  [show properties]
spinner
/*
 * JTreeSS - A Java library for reading and evaluating TreeSS documents
 * Copyright (C) 2019 Ben Stöver, Charlotte Schmitt
 * <http://bioinfweb.info/JTreeSS>
 *
 * This file is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
10   *
11   * This file is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   * GNU Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public License
17   * along with this program. If not, see <http://www.gnu.org/licenses/>.
18   */
19  grammar TreeSS;
20 
21  @header {
22      package info.bioinfweb.jtreess.reader.parser;
23  }
24  /*
25  @lexer::header {
26   package info.bioinfweb.jtreess.antlr;
27  } */
28 
29   WS : [ \t\r\n]+ -> skip ;
30   COMMENT : [/] [*] .*? [*][/] -> skip;
31  // E : 'e';
32   POW : '^';
33   LBRACE : '{';
34   RBRACE : '}';
35   DASHMATCH : '|=';
36   INCLUDES : '~=';
37   EQUAL : '=';
38   COMMA : ',';
39   SEMICOLON : ';';
40   PRECEDES : '>';
41   LBRACKET : '[';
42   RBRACKET : ']';
43   DOT : '.';
44   LPARAN : '(';
45   RPARAN : ')';
46   COLON : ':';
47   HASH : '#';
48   AT : '@';
49   PLUS : '+';
50   MINUS : '-';
51   STAR : '*';
52   DIVIDE : '/';
53   PERCENT : '%';
54   fragment INT: [0-9]+;
55   fragment DOUBLE: [0-9]* DOT [0-9]+;
56   fragment E : 'e'|'E';
57 
58 
59  // NCNAME : [:a-zA-Z_]+ [:a-zA-Z_\-.0-9];
60   DECVALUE : ((INT E MINUS? INT)|(DOUBLE E MINUS? INT)|INT|DOUBLE);
61   IDENTIFIER : [\-]? [a-zA-Z\_] [a-zA-Z\-\_0-9]*;
62   STRING : '"' .*? '"';
63   HEXDIGIT : [a-fA-F0-9];
64   COLOR : HASH (HEXDIGIT HEXDIGIT HEXDIGIT| HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT);
65 
66   unitValue : (MINUS|PLUS)? DECVALUE (IDENTIFIER|PERCENT)?;
67 
68   expression :
69   (LPARAN expression RPARAN)
70   |expression (DIVIDE | STAR) expression
71   |expression (PLUS | MINUS) expression
72   |value;
73 
74   paramList :
75   (pseudoSelector|expression) (COMMA (pseudoSelector|expression))*;
76 
77   function : IDENTIFIER LPARAN (paramList)? RPARAN;
78 
79   value :
80   unitValue
81   |function
82   |STRING
83   |IDENTIFIER
84   |COLOR;
85 
86    values : value (COMMA value)*;
87 
88   property : IDENTIFIER;
89 
90   propertyRule : property COLON values SEMICOLON;
91 
92   pseudoFunction : COLON function;
93 
94   pseudoClass : COLON IDENTIFIER;
95 
96   pseudoSelector :
97   pseudoClass
98   |pseudoFunction;
99 
100   universalSelector : STAR;
101 
102   simpleSelector : IDENTIFIER;
103 
104   idSelector : HASH IDENTIFIER;
105 
106   basicSelector :
107   simpleSelector
108   |idSelector
109   |universalSelector;
110 
111   selector :
112   basicSelector(pseudoSelector)*
113   |pseudoSelector;
114 
115   selectorRule : selector (COMMA selector)* LBRACE propertyRule* RBRACE;
116 
117   atRule : AT IDENTIFIER; /* TODO Extend expression to allow parameters or property list */
118 
119   document: (selectorRule | atRule)*;


feed icon

sventon 2.5.1

bioinfweb RSS feed bioinfweb on twitter JTreeSS on GitHub
bioinfweb - Biology & Informatics Website