[OLINGO-834] Delete AntLR dependecies
This commit is contained in:
parent
010642c506
commit
26080f420a
|
@ -49,10 +49,6 @@
|
|||
<artifactId>odata-commons-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
|
|
|
@ -45,10 +45,6 @@
|
|||
<artifactId>odata-commons-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
@ -84,42 +80,6 @@
|
|||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/antlr4</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>antlr4</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!--<arguments><argument>-atn</argument></arguments> -->
|
||||
<listener>true</listener>
|
||||
<visitor>true</visitor>
|
||||
<!--maven antlr plugin has trouble with grammer import if the grammerfiles
|
||||
are not directly inside src/main/antlr4, hence we have to set the libDirectory -->
|
||||
<libDirectory>src/main/antlr4/org/apache/olingo/server/core/uri/antlr</libDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
|
|
|
@ -1,424 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
lexer grammar UriLexer;
|
||||
|
||||
//;==============================================================================
|
||||
// Mode "DEFAULT_MODE": Processes everything before the first '?' char.
|
||||
// On '?' the next mode "MODE_QUERY" is used.
|
||||
// The percent encoding rules are defined in RFC3986; ABNF rule "path-rootless" applies.
|
||||
//;==============================================================================
|
||||
QM : '?' -> pushMode(MODE_QUERY); //first query parameter
|
||||
AMP : '&' -> pushMode(MODE_QUERY); //more query parameters
|
||||
STRING : '\'' -> more, pushMode(MODE_STRING) ; //reads up to next single '
|
||||
QUOTATION_MARK : '\u0022' -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
|
||||
SEARCH_INLINE : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH); //
|
||||
FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
|
||||
STRING_JSON : '"' -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
|
||||
|
||||
GEOGRAPHY : G E O G R A P H Y SQUOTE -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
|
||||
GEOMETRY : G E O M E T R Y SQUOTE -> pushMode(MODE_ODATA_GEO);
|
||||
|
||||
//Letters for case insensitivity
|
||||
fragment A : 'A'|'a';
|
||||
fragment B : 'B'|'b';
|
||||
fragment D : 'D'|'d';
|
||||
fragment E : 'E'|'e';
|
||||
fragment F : 'F'|'f';
|
||||
fragment G : 'G'|'g';
|
||||
fragment H : 'H'|'h';
|
||||
fragment I : 'I'|'i';
|
||||
fragment L : 'L'|'l';
|
||||
fragment M : 'M'|'m';
|
||||
fragment N : 'N'|'n';
|
||||
fragment O : 'O'|'o';
|
||||
fragment P : 'P'|'p';
|
||||
fragment R : 'R'|'r';
|
||||
fragment S : 'S'|'s';
|
||||
fragment T : 'T'|'t';
|
||||
fragment U : 'U'|'u';
|
||||
fragment Y : 'Y'|'y';
|
||||
fragment Z : 'Z'|'z';
|
||||
|
||||
//special chars
|
||||
OPEN : '(';
|
||||
CLOSE : ')';
|
||||
COMMA : ',';
|
||||
SLASH : '/';
|
||||
POINT : '.';
|
||||
AT : '@';
|
||||
EQ : '=' ;
|
||||
STAR : '*';
|
||||
SEMI : ';';
|
||||
COLON : ':';
|
||||
|
||||
EQ_sq : '=' -> type(EQ);
|
||||
AMP_sq : '&' -> type(AMP), popMode;
|
||||
fragment WS : ( ' ' | '\u0009' );
|
||||
WSP : WS+;
|
||||
|
||||
//JSON support
|
||||
BEGIN_OBJECT : WS* '{' WS*;
|
||||
END_OBJECT : WS* '}' WS*;
|
||||
|
||||
BEGIN_ARRAY : WS* '[' WS*;
|
||||
END_ARRAY : WS* ']' WS*;
|
||||
|
||||
|
||||
//alpha stuff
|
||||
fragment ALPHA : 'a'..'z' | 'A'..'Z';
|
||||
fragment ALPHA_A_TO_F : 'a'..'f' | 'A'..'F';
|
||||
fragment DIGIT : '0'..'9';
|
||||
fragment DIGITS : DIGIT+;
|
||||
fragment HEXDIG : DIGIT | ALPHA_A_TO_F;
|
||||
fragment ODI_LEADINGCHARACTER : ALPHA | '_'; //TODO; add Unicode characters from the categories L or Nl
|
||||
fragment ODI_CHARACTER : ALPHA | '_' | DIGIT; //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
|
||||
|
||||
//helper for date/time values
|
||||
fragment ONE_TO_NINE : '1'..'9';
|
||||
fragment ZERO_TO_FIFTYNINE : ('0'..'5') DIGIT;
|
||||
fragment FRACTIONALSECONDS : DIGIT+;
|
||||
fragment SECOND : ZERO_TO_FIFTYNINE;
|
||||
fragment MINUTE : ZERO_TO_FIFTYNINE;
|
||||
fragment HOUR : ('0' | '1') DIGIT | '2' ( '0'..'3');
|
||||
fragment DAY : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
|
||||
fragment MONTH : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
|
||||
fragment YEAR : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
|
||||
|
||||
//tags starting with $
|
||||
BATCH : '$batch';
|
||||
ENTITY : '$entity';
|
||||
METADATA : '$metadata';
|
||||
|
||||
ALL : '$all';
|
||||
CROSSJOIN : '$crossjoin';
|
||||
|
||||
VALUE : '$value';
|
||||
REF : '$ref';
|
||||
COUNT : '$count';
|
||||
|
||||
//inlined query parameters ( e.g. $skip)
|
||||
TOP_I : '$top' -> type(TOP);
|
||||
SKIP_QO_I : '$skip' -> type(SKIP_QO);
|
||||
FILTER_I : '$filter' -> type(FILTER);
|
||||
ORDERBY_I : '$orderby'-> type(ORDERBY);
|
||||
SELECT_I : '$select' -> type(SELECT);
|
||||
EXPAND_I : '$expand' -> type(EXPAND);
|
||||
LEVELS_I : '$levels' -> type(LEVELS);
|
||||
MAX: 'max';
|
||||
|
||||
ROOT : '$root/';
|
||||
|
||||
//rest
|
||||
NULLVALUE : 'null';
|
||||
|
||||
TRUE : 'true';
|
||||
FALSE : 'false';
|
||||
BOOLEAN : T R U E | F A L S E;
|
||||
PLUS : '+';
|
||||
|
||||
MINUS : '-';
|
||||
SIGN : PLUS | '-';
|
||||
INT : SIGN? DIGITS;
|
||||
DECIMAL : INT '.' DIGITS (('e'|'E') SIGN? DIGITS)?;
|
||||
NANINFINITY : 'NaN' | '-INF' | 'INF';
|
||||
//primary types
|
||||
BINARY : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE;
|
||||
DATE : YEAR '-' MONTH '-' DAY;
|
||||
DATETIMEOFFSET : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
|
||||
fragment DUSECONDFRAG : DIGITS ('.' DIGITS)? 'S';
|
||||
fragment DUTIMEFRAG : 'T' (
|
||||
( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?)
|
||||
| (DIGITS 'M' DUSECONDFRAG?)
|
||||
| DUSECONDFRAG
|
||||
)?;
|
||||
fragment DUDAYTIMEFRAG : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
|
||||
DURATION : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
|
||||
TIMEOFDAY : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
|
||||
fragment GUIDVALUE : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-'
|
||||
HEXDIG HEXDIG HEXDIG HEXDIG '-'
|
||||
HEXDIG HEXDIG HEXDIG HEXDIG '-'
|
||||
HEXDIG HEXDIG HEXDIG HEXDIG '-'
|
||||
HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
|
||||
GUID : GUIDVALUE;
|
||||
|
||||
//expression tokens
|
||||
ASC : 'asc';
|
||||
DESC : 'desc';
|
||||
MUL : 'mul';
|
||||
DIV : 'div';
|
||||
MOD : 'mod';
|
||||
HAS : 'has';
|
||||
|
||||
ADD : 'add';
|
||||
SUB : 'sub';
|
||||
|
||||
ANY_LAMDA : 'any';
|
||||
ALL_LAMDA : 'all';
|
||||
|
||||
GT : 'gt';
|
||||
GE : 'ge';
|
||||
LT : 'lt';
|
||||
LE : 'le';
|
||||
ISOF : 'isof';
|
||||
|
||||
EQ_ALPHA : 'eq';
|
||||
NE : 'ne';
|
||||
|
||||
AND : 'and';
|
||||
OR : 'or';
|
||||
|
||||
|
||||
NOT : 'not';
|
||||
|
||||
|
||||
IT : '$it';
|
||||
ITSLASH : '$it/';
|
||||
LEVELS : '$levels';
|
||||
|
||||
CONTAINS_WORD : 'contains(';
|
||||
STARTSWITH_WORD : 'startswith(';
|
||||
ENDSWITH_WORD : 'endswith(';
|
||||
LENGTH_WORD : 'length(';
|
||||
INDEXOF_WORD : 'indexof(';
|
||||
SUBSTRING_WORD : 'substring(';
|
||||
TOLOWER_WORD : 'tolower(';
|
||||
TOUPPER_WORD : 'toupper(';
|
||||
TRIM_WORD : 'trim(';
|
||||
CONCAT_WORD : 'concat(';
|
||||
YEAR_WORD : 'year(';
|
||||
MONTH_WORD : 'month(';
|
||||
DAY_WORD : 'day(';
|
||||
HOUR_WORD : 'hour(';
|
||||
MINUTE_WORD : 'minute(';
|
||||
SECOND_WORD : 'second(';
|
||||
FRACTIONALSECONDS_WORD : 'fractionalseconds(';
|
||||
TOTALSECONDS_WORD : 'totalseconds(';
|
||||
DATE_WORD : 'date(';
|
||||
TIME_WORD : 'time(';
|
||||
TOTALOFFSETMINUTES_WORD : 'totaloffsetminutes(';
|
||||
|
||||
MINDATETIME_WORD : 'mindatetime(';
|
||||
MAXDATETIME_WORD : 'maxdatetime(';
|
||||
NOW_WORD : 'now(';
|
||||
|
||||
ROUND_WORD : 'round(';
|
||||
FLOOR_WORD : 'floor(';
|
||||
CEILING_WORD : 'ceiling(';
|
||||
|
||||
GEO_DISTANCE_WORD : 'geo.distance(';
|
||||
GEO_LENGTH_WORD : 'geo.length(';
|
||||
GEO_INTERSECTS_WORD : 'geo.intersects(';
|
||||
ISOF_WORD : 'isof(';
|
||||
CAST_WORD : 'cast(';
|
||||
|
||||
COLLECTION_REF : 'Collection($ref)';
|
||||
COLLECTION_ENTITY_TYPE : 'Collection(Edm.EntityType)';
|
||||
COLLECTION_COMPLEX_TYPE : 'Collection(Edm.ComplexType)';
|
||||
COLLECTION : 'Collection(' -> type(COLLECTION);
|
||||
|
||||
//used in fragment only
|
||||
DELETED_ENTITY : '$deletedEntity';
|
||||
LINK : '$link';
|
||||
DELETED_LINK : '$deletedLink';
|
||||
DELTA : '$delta';
|
||||
|
||||
ODATAIDENTIFIER : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
|
||||
|
||||
//handle characters that failed to match any other token
|
||||
ERROR_CHARACTER : .;
|
||||
|
||||
//;==============================================================================
|
||||
// Mode "QUERY": Processes everything between the first '?' and the '#' char.
|
||||
// On '?' the next mode "FRAGMENT" is used.
|
||||
// The percent encoding rules are defined in RFC3986; ABNF rule "query" applies.
|
||||
mode MODE_QUERY;
|
||||
//;==============================================================================
|
||||
|
||||
FRAGMENT_q : '#' -> type(FRAGMENT);
|
||||
FILTER : '$filter' -> pushMode(DEFAULT_MODE);
|
||||
ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
|
||||
EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
|
||||
SELECT : '$select' -> pushMode(DEFAULT_MODE);
|
||||
SKIP_QO : '$skip' -> pushMode(DEFAULT_MODE);
|
||||
SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST);
|
||||
TOP : '$top' -> pushMode(DEFAULT_MODE);
|
||||
LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
|
||||
FORMAT : '$format' -> pushMode(MODE_SYSTEM_QUERY_PCHAR);
|
||||
COUNT_q : '$count' -> type(COUNT), pushMode(DEFAULT_MODE);
|
||||
REF_q : '$ref' -> type(REF);
|
||||
VALUE_q : '$value' -> type(VALUE);
|
||||
ID : '$id' -> pushMode(MODE_SYSTEM_QUERY_REST);
|
||||
SEARCH : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH);
|
||||
|
||||
EQ_q : '=' -> type(EQ);
|
||||
AMP_q : '&' -> type(AMP);
|
||||
|
||||
AT_Q : '@' -> pushMode(DEFAULT_MODE);
|
||||
|
||||
CUSTOMNAME : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
|
||||
|
||||
//handle characters that failed to match any other token
|
||||
ERROR_CHARACTER_q : .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_SYSTEM_QUERY_PCHAR;
|
||||
//;==============================================================================
|
||||
|
||||
AMP_sqp : '&' -> type(AMP), popMode;
|
||||
|
||||
fragment ALPHA_sqp : 'a'..'z'|'A'..'Z';
|
||||
fragment A_TO_F_sqp : 'a'..'f'|'A'..'F';
|
||||
fragment DIGIT_sqp : '0'..'9';
|
||||
fragment HEXDIG_sqp : DIGIT_sqp | A_TO_F_sqp;
|
||||
fragment PCT_ENCODED_sqp : '%' HEXDIG_sqp HEXDIG_sqp;
|
||||
fragment SUB_DELIMS_sqp : '$' | /*'&' |*/ '\'' | EQ_sqp | OTHER_DELIMS_sqp;
|
||||
fragment OTHER_DELIMS_sqp : '!' | '(' | ')' | '*' | '+' | ',' | ';';
|
||||
fragment UNRESERVED_sqp : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~';
|
||||
fragment PCHAR : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@';
|
||||
fragment PCHARSTART : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | /*'&' |*/ '\'' | OTHER_DELIMS_sqp | ':' | '@';
|
||||
|
||||
ATOM : [Aa][Tt][Oo][Mm];
|
||||
JSON : [Jj][Ss][Oo][Nn];
|
||||
XML : [Xx][Mm][Ll];
|
||||
|
||||
PCHARS : PCHARSTART PCHAR*;
|
||||
|
||||
SLASH_sqp : '/' -> type(SLASH);
|
||||
EQ_sqp : '=' -> type(EQ);
|
||||
FRAGMENT_sqp : '#' -> type(FRAGMENT), pushMode(MODE_FRAGMENT);
|
||||
|
||||
//handle characters that failed to match any other token
|
||||
ERROR_CHARACTER_sqp : .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_FRAGMENT;
|
||||
// Read the remaining characters of a URI queryparameter up to an & or #
|
||||
// character.
|
||||
//;==============================================================================
|
||||
|
||||
REST_F : ~('\r'|'\n')* -> type(REST), popMode;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_SYSTEM_QUERY_REST;
|
||||
// Read the remaining characters of a URI queryparameter up to an & or #
|
||||
// character.
|
||||
//;==============================================================================
|
||||
|
||||
AMP_sqr : '&' -> type(AMP), popMode;
|
||||
FRAGMENT_sqr : '#' -> type(FRAGMENT), popMode;
|
||||
|
||||
EQ_sqr : '=' -> type(EQ);
|
||||
REST : ~[&#=] ~[&#]*;
|
||||
ERROR_CHARACTER_sqmr : .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_SYSTEM_QUERY_SEARCH;
|
||||
//;==============================================================================
|
||||
|
||||
NOT_sqc : 'NOT' -> type(NOT);
|
||||
AND_sqc : 'AND' -> type(AND);
|
||||
OR_sqc : 'OR' -> type(OR);
|
||||
EQ_sqc : '=' -> type(EQ);
|
||||
|
||||
fragment WS_sqc : ( ' ' | '\u0009');
|
||||
WSP_sqc : WS_sqc+ -> type(WSP);
|
||||
|
||||
QUOTATION_MARK_sqc : '\u0022';
|
||||
|
||||
SEARCHWORD : ('a'..'z'|'A'..'Z')+;
|
||||
SEARCHPHRASE : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc;
|
||||
|
||||
// Follow Set
|
||||
CLOSE_qs : ')' -> popMode, type(CLOSE);
|
||||
SEMI_qs : ';' -> popMode, type(SEMI);
|
||||
AMP_qs : '&' -> popMode, type(AMP);
|
||||
ERROR_CHARACTER_sqms : .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_STRING;
|
||||
// Reads the remaining characters up to an ' character.
|
||||
// Any "'" characters inside a string are expressed as double "''".
|
||||
//;==============================================================================
|
||||
|
||||
STRING_s : ('\'\'' | ~[\u0027] )* '\'' -> type(STRING), popMode;
|
||||
ERROR_CHARACTER_sm : EOF | .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_JSON_STRING;
|
||||
// Reads the remaining characters up to an " character.
|
||||
// Any """ characters inside a string are escaped with "\".
|
||||
//;==============================================================================
|
||||
|
||||
STRING_IN_JSON : (ESCAPED_JSON_CHAR | ~["\\])* '"' -> popMode;
|
||||
fragment ESCAPED_JSON_CHAR : '\\' (["\\/bfnrt] | UNICODE_CHAR);
|
||||
fragment UNICODE_CHAR : 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT;
|
||||
fragment HEX_DIGIT : [0-9a-fA-F];
|
||||
ERROR_CHARACTER_jsm : EOF | .;
|
||||
|
||||
//;==============================================================================
|
||||
mode MODE_ODATA_GEO;
|
||||
//;==============================================================================
|
||||
|
||||
fragment C_ : 'c'|'C';
|
||||
fragment D_ : 'd'|'D';
|
||||
fragment E_ : 'e'|'E';
|
||||
fragment G_ : 'g'|'G';
|
||||
fragment H_ : 'h'|'H';
|
||||
fragment I_ : 'i'|'I';
|
||||
fragment L_ : 'l'|'L';
|
||||
fragment M_ : 'm'|'M';
|
||||
fragment N_ : 'n'|'N';
|
||||
fragment O_ : 'o'|'O';
|
||||
fragment P_ : 'p'|'P';
|
||||
fragment R_ : 'r'|'R';
|
||||
fragment S_ : 's'|'S';
|
||||
fragment T_ : 't'|'T';
|
||||
fragment U_ : 'u'|'U';
|
||||
fragment Y_ : 'y'|'Y';
|
||||
|
||||
fragment SP_g : ' '; //'\u0020'; // a simple space
|
||||
fragment WS_g : ( ' ' | '\u0009' );
|
||||
|
||||
OPEN_g : '(' -> type(OPEN);
|
||||
CLOSE_g : ')' -> type(CLOSE);
|
||||
COMMA_g : ',' -> type(COMMA);
|
||||
WSP_g : WS_g+ -> type(WSP);
|
||||
POINT_g : '.' -> type(POINT);
|
||||
AT_g : '@' -> type(AT);
|
||||
SEMI_g : ';' -> type(SEMI);
|
||||
EQ_g : '=' -> type(EQ);
|
||||
|
||||
fragment DIGIT_g : '0'..'9';
|
||||
fragment DIGITS_g : DIGIT_g+;
|
||||
SIGN_g : ('+' | '-') -> type(SIGN);
|
||||
INT_g : SIGN_g? DIGITS_g -> type(INT);
|
||||
DECIMAL_g : 'SS' INT_g '.' DIGITS_g (('e'|'E') SIGN_g? DIGITS_g)? -> type(DECIMAL);
|
||||
COLLECTION_g : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
|
||||
LINESTRING : L_ I_ N_ E_ S_ T_ R_ I_ N_ G_ ;
|
||||
MULTILINESTRING : M_ U_ L_ T_ I_ L_ I_ N_ E_ S_ T_ R_ I_ N_ G_;
|
||||
MULTIPOINT : M_ U_ L_ T_ I_ P_ O_ I_ N_ T_ ;
|
||||
MULTIPOLYGON : M_ U_ L_ T_ I_ P_ O_ L_ Y_ G_ O_ N_;
|
||||
GEO_POINT : P_ O_ I_ N_ T_;
|
||||
POLYGON : P_ O_ L_ Y_ G_ O_ N_ ;
|
||||
|
||||
SRID : S_ R_ I_ D_;
|
||||
|
||||
SQUOTE : '\'' -> popMode;
|
||||
|
||||
ERROR_CHARACTER_g : .;
|
|
@ -1,447 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
|
||||
grammar UriParser;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// This grammar refers to the "odata-abnf-construction-rules.txt" Revision 517.
|
||||
// URL: https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/ABNF/odata-abnf-construction-rules.txt?rev=517
|
||||
|
||||
// While contructing this grammar we tried to keep it close to the ABNF.
|
||||
// However this is not really possible in order to support
|
||||
// - percent decoding
|
||||
// - operator precedence
|
||||
// - having a context free grammar ( without java snipplets to add context)
|
||||
// - generating the parser in different target languages
|
||||
// Currently not supported are
|
||||
// - $search
|
||||
// - geometry data
|
||||
// - json data in url
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
options {
|
||||
language = Java;
|
||||
tokenVocab = UriLexer;
|
||||
}
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 0. URI
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
batchEOF : BATCH EOF;
|
||||
|
||||
entityEOF : vNS=namespace vODI=odataIdentifier;
|
||||
|
||||
metadataEOF : METADATA EOF;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 1. Resource Path
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
//resourcePathEOF : vlPS=pathSegments EOF;
|
||||
|
||||
crossjoinEOF : CROSSJOIN OPEN WSP? vlODI+=odataIdentifier WSP? ( COMMA WSP? vlODI+=odataIdentifier WSP?)* CLOSE EOF;
|
||||
|
||||
allEOF : ALL;
|
||||
|
||||
pathSegmentEOF : (pathSegment | constSegment) EOF;
|
||||
|
||||
pathSegments : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* (SLASH vCS=constSegment)?;
|
||||
|
||||
pathSegment : vNS=namespace? vODI=odataIdentifier vlNVO+=nameValueOptList*;
|
||||
|
||||
nameValueOptList : OPEN (vVO=commonExpr | vNVL=nameValueList)? CLOSE;
|
||||
nameValueList : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair WSP*)* ;
|
||||
nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
|
||||
|
||||
constSegment : (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
|
||||
|
||||
count : COUNT;
|
||||
ref : REF;
|
||||
value : VALUE;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 2. Query Options
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;//TODO can this be removed
|
||||
|
||||
queryOption : systemQueryOption;
|
||||
|
||||
systemQueryOption : expand
|
||||
| filter
|
||||
| inlinecount
|
||||
| orderBy
|
||||
| search
|
||||
| select
|
||||
| skip
|
||||
| skiptoken
|
||||
| top
|
||||
;
|
||||
|
||||
skiptoken : SKIPTOKEN EQ REST;
|
||||
expand : EXPAND EQ expandItems;
|
||||
|
||||
expandItemsEOF : expandItems EOF;
|
||||
expandItems : vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
|
||||
|
||||
|
||||
expandItem : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX) CLOSE )?
|
||||
| vEP=expandPath vEPE=expandPathExtension?;
|
||||
|
||||
|
||||
expandPath : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
|
||||
|
||||
expandPathExtension : OPEN vlEO+=expandOption ( SEMI vlEO+=expandOption )* CLOSE
|
||||
| SLASH vR=ref ( OPEN vlEOR+=expandRefOption ( SEMI vlEOR+=expandRefOption )* CLOSE )?
|
||||
| SLASH vC=count ( OPEN vlEOC+=expandCountOption ( SEMI vlEOC+=expandCountOption )* CLOSE )?
|
||||
;
|
||||
|
||||
expandCountOption : filter
|
||||
| searchInline
|
||||
;
|
||||
|
||||
expandRefOption : expandCountOption
|
||||
| orderBy
|
||||
| skip
|
||||
| top
|
||||
| inlinecount
|
||||
;
|
||||
|
||||
expandOption : expandRefOption
|
||||
| select
|
||||
| expand
|
||||
| levels;
|
||||
|
||||
levels : LEVELS EQ ( INT | MAX );
|
||||
|
||||
filter : FILTER EQ commonExpr;
|
||||
|
||||
filterExpressionEOF : commonExpr EOF;
|
||||
|
||||
orderBy : ORDERBY EQ orderList;
|
||||
|
||||
orderByEOF : orderList EOF;
|
||||
|
||||
orderList : vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
|
||||
|
||||
orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
|
||||
|
||||
skip : SKIP_QO EQ INT;
|
||||
top : TOP EQ INT;
|
||||
//format : FORMAT EQ ( ATOM | JSON | XML | PCHARS SLASH PCHARS);
|
||||
|
||||
inlinecount : COUNT EQ booleanNonCaseLiteral;
|
||||
|
||||
search : SEARCH searchSpecialToken;
|
||||
searchInline : SEARCH_INLINE searchSpecialToken;
|
||||
|
||||
searchSpecialToken : EQ WSP? searchExpr;
|
||||
|
||||
searchExpr : (NOT WSP) searchExpr
|
||||
| searchExpr searchExpr
|
||||
| searchExpr WSP searchExpr
|
||||
| searchExpr ( WSP AND WSP) searchExpr
|
||||
| searchExpr ( WSP OR WSP) searchExpr
|
||||
| searchPhrase
|
||||
| searchWord
|
||||
;
|
||||
|
||||
searchPhrase : SEARCHPHRASE;
|
||||
searchWord : SEARCHWORD;
|
||||
|
||||
select : SELECT EQ vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
|
||||
selectEOF : vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
|
||||
|
||||
selectItem : vlSS+=selectSegment ( SLASH vlSS+=selectSegment ) *;
|
||||
selectSegment : vNS=namespace? ( vODI=odataIdentifier | vS=STAR );
|
||||
|
||||
aliasAndValue : vODI=ODATAIDENTIFIER EQ vV=parameterValue;
|
||||
|
||||
parameterValue : commonExpr //TODO json not supported arrayOrObject
|
||||
;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 3. Context URL Fragments
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
contextFragment : REST; // the context fragment is only required on the client side
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 4. Expressions
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
commonExpr : OPEN commonExpr CLOSE #altPharenthesis
|
||||
| vE1=commonExpr (WSP HAS WSP) vE2=commonExpr #altHas
|
||||
| methodCallExpr #altMethod
|
||||
| ( unary WSP? ) commonExpr #altUnary
|
||||
| anyExpr #altAny
|
||||
| allExpr #altAll
|
||||
| memberExpr #altMember
|
||||
| vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr #altMult
|
||||
| vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr #altAdd
|
||||
| vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP
|
||||
| WSP vO=LE WSP ) vE2=commonExpr #altComparism
|
||||
| vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr #altEquality
|
||||
| vE1=commonExpr (WSP AND WSP) vE2=commonExpr #altAnd
|
||||
| vE1=commonExpr (WSP OR WSP) vE2=commonExpr #altOr
|
||||
| rootExpr #altRoot // $...
|
||||
| AT odataIdentifier #altAlias // @...
|
||||
| primitiveLiteral #altLiteral // ...
|
||||
| arrayOrObject #altJson
|
||||
;
|
||||
|
||||
unary : (MINUS| NOT) ;
|
||||
|
||||
rootExpr : ROOT vPs=pathSegments;
|
||||
|
||||
memberExpr : vIt=IT ( SLASH (vANY=anyExpr | vALL=allExpr))?
|
||||
| vIts=ITSLASH? vPs=pathSegments ( SLASH (vANY=anyExpr | vALL=allExpr))?;
|
||||
|
||||
anyExpr : ANY_LAMDA OPEN WSP? ( vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? )? CLOSE;
|
||||
allExpr : ALL_LAMDA OPEN WSP? vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? CLOSE;
|
||||
|
||||
methodCallExpr : indexOfMethodCallExpr
|
||||
| toLowerMethodCallExpr
|
||||
| toUpperMethodCallExpr
|
||||
| trimMethodCallExpr
|
||||
| substringMethodCallExpr
|
||||
| concatMethodCallExpr
|
||||
| lengthMethodCallExpr
|
||||
| yearMethodCallExpr
|
||||
| monthMethodCallExpr
|
||||
| dayMethodCallExpr
|
||||
| hourMethodCallExpr
|
||||
| minuteMethodCallExpr
|
||||
| secondMethodCallExpr
|
||||
| fractionalsecondsMethodCallExpr
|
||||
| totalsecondsMethodCallExpr
|
||||
| dateMethodCallExpr
|
||||
| timeMethodCallExpr
|
||||
| roundMethodCallExpr
|
||||
| floorMethodCallExpr
|
||||
| ceilingMethodCallExpr
|
||||
| geoDistanceMethodCallExpr
|
||||
| geoLengthMethodCallExpr
|
||||
| totalOffsetMinutesMethodCallExpr
|
||||
| minDateTimeMethodCallExpr
|
||||
| maxDateTimeMethodCallExpr
|
||||
| nowMethodCallExpr
|
||||
//from boolean
|
||||
| isofExpr
|
||||
| castExpr
|
||||
| endsWithMethodCallExpr
|
||||
| startsWithMethodCallExpr
|
||||
| containsMethodCallExpr
|
||||
| geoIntersectsMethodCallExpr
|
||||
;
|
||||
|
||||
|
||||
containsMethodCallExpr : CONTAINS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
startsWithMethodCallExpr : STARTSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
endsWithMethodCallExpr : ENDSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
lengthMethodCallExpr : LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
indexOfMethodCallExpr : INDEXOF_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
substringMethodCallExpr : SUBSTRING_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? ( COMMA WSP? vE3=commonExpr WSP? )? CLOSE;
|
||||
toLowerMethodCallExpr : TOLOWER_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
toUpperMethodCallExpr : TOUPPER_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
trimMethodCallExpr : TRIM_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
concatMethodCallExpr : CONCAT_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
|
||||
yearMethodCallExpr : YEAR_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
monthMethodCallExpr : MONTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
dayMethodCallExpr : DAY_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
hourMethodCallExpr : HOUR_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
minuteMethodCallExpr : MINUTE_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
secondMethodCallExpr : SECOND_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
dateMethodCallExpr : DATE_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
timeMethodCallExpr : TIME_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
|
||||
minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
|
||||
maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
|
||||
nowMethodCallExpr : NOW_WORD WSP? CLOSE;
|
||||
|
||||
roundMethodCallExpr : ROUND_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
floorMethodCallExpr : FLOOR_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
ceilingMethodCallExpr : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
|
||||
geoDistanceMethodCallExpr : GEO_DISTANCE_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
|
||||
geoIntersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
|
||||
|
||||
isofExpr : ISOF_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
|
||||
castExpr : CAST_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 5. JSON format for function parameters
|
||||
//;------------------------------------------------------------------------------
|
||||
//; Note: the query part of a URI needs to be partially percent-decoded before
|
||||
//; applying these rules, see comment at the top of this file
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
arrayOrObject : json_array
|
||||
| json_object;
|
||||
|
||||
json_array : BEGIN_ARRAY (json_value (WS* COMMA WS* json_value)*)? END_ARRAY;
|
||||
|
||||
json_value : jsonPrimitive
|
||||
| rootExpr
|
||||
| json_object
|
||||
| json_array;
|
||||
|
||||
json_object : BEGIN_OBJECT
|
||||
(json_key_value_pair (WS* COMMA WS* json_key_value_pair)*)?
|
||||
END_OBJECT;
|
||||
|
||||
json_key_value_pair : STRING_IN_JSON WS* COLON WS* json_value;
|
||||
|
||||
//; JSON syntax: adapted to URI restrictions from [RFC4627]
|
||||
jsonPrimitive : STRING_IN_JSON
|
||||
| number_in_json
|
||||
| TRUE
|
||||
| FALSE
|
||||
| NULLVALUE
|
||||
;
|
||||
|
||||
number_in_json : INT | DECIMAL;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 6. Names and identifiers
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
qualifiedtypename : namespace odataIdentifier
|
||||
| 'collection' OPEN ( namespace odataIdentifier ) CLOSE
|
||||
;
|
||||
|
||||
namespace : (odataIdentifier POINT)+;
|
||||
|
||||
odataIdentifier : ODATAIDENTIFIER;
|
||||
|
||||
//;------------------------------------------------------------------------------
|
||||
//; 7. Literal Data Values
|
||||
//;------------------------------------------------------------------------------
|
||||
|
||||
|
||||
primitiveLiteral : nullruleLiteral
|
||||
| booleanNonCaseLiteral
|
||||
| decimalLiteral //includes double and single literals
|
||||
| naninfinityLiteral
|
||||
| intLiteral //includes int16/int32 and int64 literals
|
||||
| binaryLiteral
|
||||
| dateLiteral
|
||||
| datetimeoffsetLiteral
|
||||
| durationLiteral
|
||||
| guidLiteral
|
||||
| stringLiteral
|
||||
| timeofdayLiteral
|
||||
| enumLiteral
|
||||
| geographyCollection
|
||||
| geographyLineString
|
||||
| geographyMultilineString
|
||||
| geographyMultipoint
|
||||
| geographyMultipolygon
|
||||
| geographyPoint
|
||||
| geographyPolygon
|
||||
| geometryCollection
|
||||
| geometryLineString
|
||||
| geometryMultilineString
|
||||
| geometryMultipoint
|
||||
| geometryMultipolygon
|
||||
| geometryPoint
|
||||
| geometryPolygon
|
||||
;
|
||||
|
||||
|
||||
nullruleLiteral : NULLVALUE;
|
||||
booleanNonCaseLiteral : BOOLEAN | TRUE | FALSE;
|
||||
decimalLiteral : DECIMAL;
|
||||
naninfinityLiteral : NANINFINITY;
|
||||
intLiteral : INT;
|
||||
binaryLiteral : BINARY;
|
||||
dateLiteral : DATE;
|
||||
datetimeoffsetLiteral : DATETIMEOFFSET;
|
||||
durationLiteral : DURATION;
|
||||
guidLiteral : GUID;
|
||||
stringLiteral : STRING;
|
||||
timeofdayLiteral : TIMEOFDAY;
|
||||
|
||||
enumLiteral : vNS=namespace vODI=odataIdentifier vValues=STRING;
|
||||
enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
|
||||
|
||||
geographyCollection : GEOGRAPHY fullCollectionLiteral SQUOTE;
|
||||
fullCollectionLiteral : sridLiteral collectionLiteral;
|
||||
|
||||
collectionLiteral : (COLLECTION ) OPEN geoLiteral ( COMMA geoLiteral )* CLOSE;
|
||||
|
||||
geoLiteral : collectionLiteral
|
||||
| lineStringLiteral
|
||||
| multipointLiteral
|
||||
| multilineStringLiteral
|
||||
| multipolygonLiteral
|
||||
| pointLiteral
|
||||
| polygonLiteral;
|
||||
|
||||
geographyLineString : GEOGRAPHY fullLineStringLiteral SQUOTE;
|
||||
fullLineStringLiteral : sridLiteral lineStringLiteral;
|
||||
lineStringLiteral : LINESTRING lineStringData;
|
||||
lineStringData : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
|
||||
|
||||
geographyMultilineString : GEOGRAPHY fullMultilineStringLiteral SQUOTE;
|
||||
fullMultilineStringLiteral : sridLiteral multilineStringLiteral;
|
||||
multilineStringLiteral : MULTILINESTRING OPEN ( lineStringData ( COMMA lineStringData )* )? CLOSE;
|
||||
|
||||
geographyMultipoint : GEOGRAPHY fullMultipointLiteral SQUOTE;
|
||||
fullMultipointLiteral : sridLiteral multipointLiteral;
|
||||
multipointLiteral : MULTIPOINT OPEN ( pointData ( COMMA pointData )* )? CLOSE ;
|
||||
|
||||
geographyMultipolygon : GEOGRAPHY fullmultipolygonLiteral SQUOTE;
|
||||
fullmultipolygonLiteral : sridLiteral multipolygonLiteral;
|
||||
multipolygonLiteral : MULTIPOLYGON OPEN ( polygonData ( COMMA polygonData )* )? CLOSE;
|
||||
|
||||
geographyPoint : GEOGRAPHY fullpointLiteral SQUOTE;
|
||||
fullpointLiteral : sridLiteral pointLiteral;
|
||||
|
||||
pointLiteral : GEO_POINT pointData;
|
||||
pointData : OPEN positionLiteral CLOSE;
|
||||
|
||||
positionLiteral : (DECIMAL | INT ) WSP (DECIMAL | INT ); //; longitude, then latitude
|
||||
|
||||
|
||||
geographyPolygon : GEOGRAPHY fullPolygonLiteral SQUOTE;
|
||||
fullPolygonLiteral : sridLiteral polygonLiteral;
|
||||
polygonLiteral : POLYGON polygonData;
|
||||
polygonData : OPEN ringLiteral ( COMMA ringLiteral )* CLOSE;
|
||||
ringLiteral : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
|
||||
|
||||
|
||||
geometryCollection : GEOMETRY fullCollectionLiteral SQUOTE;
|
||||
geometryLineString : GEOMETRY fullLineStringLiteral SQUOTE;
|
||||
geometryMultilineString : GEOMETRY fullMultilineStringLiteral SQUOTE;
|
||||
geometryMultipoint : GEOMETRY fullMultipointLiteral SQUOTE;
|
||||
geometryMultipolygon : GEOMETRY fullmultipolygonLiteral SQUOTE;
|
||||
geometryPoint : GEOMETRY fullpointLiteral SQUOTE;
|
||||
geometryPolygon : GEOMETRY fullPolygonLiteral SQUOTE;
|
||||
|
||||
sridLiteral : SRID EQ INT SEMI;
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.server.core.uri.parser;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
import org.antlr.v4.runtime.DiagnosticErrorListener;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
|
||||
class CheckFullContextListener extends DiagnosticErrorListener {
|
||||
|
||||
@Override
|
||||
public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
|
||||
final int charPositionInLine,
|
||||
final String msg, final RecognitionException e) {
|
||||
// System.err.println("syntaxError detected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
|
||||
final boolean exact,
|
||||
final BitSet ambigAlts, final ATNConfigSet configs) {
|
||||
// System.err.println("reportAmbiguity detected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
|
||||
final int stopIndex,
|
||||
final BitSet conflictingAlts, final ATNConfigSet configs) {
|
||||
// System.err.println("reportAttemptingFullContext detected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
|
||||
final int stopIndex, final int prediction,
|
||||
final ATNConfigSet configs) {
|
||||
// System.err.println("reportContextSensitivity detected");
|
||||
}
|
||||
|
||||
}
|
|
@ -46,10 +46,6 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -86,8 +86,6 @@
|
|||
<jackson.version>2.4.2</jackson.version>
|
||||
<aalto-xml.version>0.9.10</aalto-xml.version>
|
||||
|
||||
<antlr.version>4.5</antlr.version>
|
||||
|
||||
<android.platform.version>4.1.1.4</android.platform.version>
|
||||
<stax.api.version>1.0-2</stax.api.version>
|
||||
<woodstox.stax2-api.version>3.1.4</woodstox.stax2-api.version>
|
||||
|
@ -132,12 +130,6 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>${antlr.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
|
@ -315,11 +307,6 @@
|
|||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<version>${antlr.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.keyboardsamurais.maven</groupId>
|
||||
<artifactId>maven-timestamp-plugin</artifactId>
|
||||
|
@ -543,7 +530,6 @@
|
|||
<exclude>org/apache/olingo/**/tecsvc/**/*.class</exclude>
|
||||
<exclude>org/apache/olingo/**/fit/**/*.class</exclude>
|
||||
<exclude>org/apache/olingo/**/testutil/**/*.class</exclude>
|
||||
<exclude>org/apache/olingo/**/antlr/**/*.class</exclude>
|
||||
</excludes>
|
||||
</instrumentation>
|
||||
<check/>
|
||||
|
|
Loading…
Reference in New Issue