Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ql/model/p2ql.bnf')
-rw-r--r--bundles/org.eclipse.equinox.p2.ql/model/p2ql.bnf67
1 files changed, 67 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ql/model/p2ql.bnf b/bundles/org.eclipse.equinox.p2.ql/model/p2ql.bnf
new file mode 100644
index 000000000..476f54187
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ql/model/p2ql.bnf
@@ -0,0 +1,67 @@
+condition
+ : orExpression ( '?' orExpression ':' orExpression )?
+ ;
+
+orExpression : andExpression ( '||' andExpression )* ;
+
+andExpression : binaryExpression ( '&&' binaryExpression )* ;
+
+binaryExpression : notExpression ( op notExpression )?;
+
+op : '=' | '!=' | '>' | '>=' | '<' | '<=' | '~=' ;
+
+notExpression
+ : '!' notExpression
+ | collectionExpression
+ ;
+
+collectionExpression
+ : memberExpression ( '.' collectionFunction )*
+ ;
+
+memberExpression : constructor ( ( '.' ID ) | ( '[' memberExpression ']' ) )* ;
+
+constructor
+ : ( filter | version | range | class ) '(' unaryExpression ')'
+ | set '(' ( collectionExpression ( ',' collectionExpression )* )? ')'
+ | unaryExpression
+ ;
+
+collectionFunction
+ : ( select | reject | exists | all | traverse ) '(' lambdaDefinition ')'
+ | limit '(' memberExpression ')'
+ | unique '(' memberExpression? ')'
+ | latest '(' lambdaDefinition? ')'
+ ;
+
+lambdaDefinition
+ : initializer ( ',' initializer )* ( ',' '{' lambda '}' )?
+ | '{' lambda '}'
+ | lambda
+ ;
+
+initializer
+ : '_'
+ | condition
+ ;
+
+lambda
+ : ( ID ( ',' ID )* )? '|' condition
+ ;
+
+unaryExpression
+ : '(' condition ')'
+ | '[' condition ( ',' condition )* ']' // #array construct
+ | '/' regexpPattern '/'
+ | STRING
+ | INT
+ | parameter
+ | 'null'
+ | 'true'
+ | 'false'
+ | ID
+ ;
+
+parameter
+ : '$' INT | ID
+ ;

Back to the top