Appendix A. Grammar Summary

The following is a summary of the grammar of the Java query language.

COMPLETE_QUERY : SET_EXPRESSION 
	| DELIMITED_QUERY 
	;
SET_EXPRESSION : SET_EXPRESSION SET_OPERATOR SET_EXPRESSION 
	| '(' SET_EXPRESSION ')' 
	| VALUE_LIST 
	| 'execute' SET_EXPRESSION 
	| 'previous' 
	| literalString 
	| 'all' 'annotations' 
	| 'unset' nameSymbol 
	| SAVING_NAME SET_EXPRESSION 
	| SAVING_NAME TRANSFORM 
	| VALUE_EXPRESSION SET_EXPRESSION 
	| SET_EXPRESSION 'that' Identity FILTER 
	| 'class' literalString 
	| 'package' literalString 
	| 'all' 'classes' 
	| 'all' StringConstant 
	| 'all' 'packages' 
	| ImportExpression 
	| TRANSFORM SET_EXPRESSION
	# or the name of a saved set expression
	;
DELIMITED_QUERY : SET_EXPRESSION ';' 
	| DELIMITED_QUERY ';' 
	| DELIMITED_QUERY SET_EXPRESSION 
	;
SET_OPERATOR : 'union' 
	| 'intersection' 
	| 'deintersection' 
	| 'without' 
	;
VALUE_LIST : '(' ')' 
	| 'list' 
	| 'list' VALUE_EXPRESSION 
	| VALUE_EXPRESSION ',' VALUE_EXPRESSION 
	| VALUE_LIST ',' VALUE_EXPRESSION 
	;
SAVING_NAME : 'set' nameSymbol 'to' 
	;
TRANSFORM : 'same' 
	| FILTER 
	| TRANSFORM SET_OPERATOR TRANSFORM 
	| '(' TRANSFORM ')' 
	| VALUE_EXPRESSION 
	| 'recursive' '(' TRANSFORM ')' 
	| 'recursive' '(' TRANSFORM ',' TRANSFORM ')' 
	| 'uncorrelated' '(' SET_EXPRESSION ')' 
	| 'unique' 
	| 'cast' TypeSpec 
	| 'annotations' 'of' 
	| 'annotations' 'with' 
	| VALUE_EXPRESSION TRANSFORM 
	| TRANSFORM TRANSFORM 
	| TRANSFORM 'that' Identity FILTER 
	| 'arguments' 'of' 
	| 'any' 'class' 
	| 'recursive' 'base' 'classes' 'of' 
	| 'base' 'classes' 'of' 
	| 'recursive' 'derived' 'classes' 'of' 
	| 'derived' 'classes' 'of' 
	| 'methods' 'in' 
	| 'fields' 'in' 
	| 'polymorphic' 
	| 'calls' 'from' 
	| Reference 'from' 
	| StringConstant Reference 'from' 
	| Reference 'to' 
	| 'calls' 'to' 
	| 'catches' 'of' 
	| 'catches' 'in' 
	| 'fields' 'with' 
	| 'methods' 'with' 
	| 'arguments' 'with' 
	| 'packages' 'in' 
	| 'classes' 'in' 
	| 'resources' 'containing' 
	| 'resources' 'with' 'names' 
	# or the name of a saved transform
	;
VALUE_EXPRESSION : literalString 
	| number 
	| 'to' 'string' 
	| '(' VALUE_EXPRESSION ')' 
	| 'substitute' '(' VALUE_EXPRESSION ',' VALUE_EXPRESSION ')' 
	| 'substitute' '(' VALUE_EXPRESSION ',' VALUE_EXPRESSION ',' VALUE_EXPRESSION ')' 
	| GROUP_EXPRESSION 
	| VALUE_EXPRESSION '&' VALUE_EXPRESSION 
	| 'same' 
	| 'each' 
	| GROUP_EXPRESSION 'of' '(' TRANSFORM ')' 
	| 'date' '(' literalString ')' 
	| 'annotated' 'by' 
	| 'classes' 'of' 
	| Types 'of' 
	| VALUE_EXPRESSION VALUE_EXPRESSION 
	| StringConstant 
	| Types 
	| 'classes' 'containing' 
	| 'classes' 'with' 
	| 'methods' 'containing' 
	| 'methods' 'called' 'by' 
	| 'fields' 'referenced' 'by' 
	| StringConstant 'referenced' 'by' 
	| 'type' 'referenced' 'by' 
	| 'methods' 'of' 
	| 'packages' 'of' 
	| 'names' 'of' 
	| 'bundles' 'containing' 
	| 'array' 'of' 
	;
Identity : 'is' 
	| 'are' 
	;
FILTER : 'not' FILTER 
	| 'exists' '(' TRANSFORM ')' 
	| '(' FILTER ')' 
	| FILTER 'and' FILTER 
	| FILTER 'or' FILTER 
	| FILTER 'xor' FILTER 
	| VALUE_EXPRESSION RELATIONAL_OPERATOR VALUE_EXPRESSION 
	| VALUE_EXPRESSION '~=' VALUE_EXPRESSION 
	| '~' literalString 
	| 'matching' literalString 
	| 'write' 
	| 'is' 'array' 
	| 'is' 'reference' 'type' 
	| 'public' 
	| 'private' 
	| 'protected' 
	| 'package' 
	| 'abstract' 
	| 'static' 
	| 'interface' 
	| 'deprecated' 
	| 'uncalled' 
	| UncalledPolymorphic 
	;
StringConstant : 'string' 
	| 'strings' 
	;
ImportExpression : 'import' 
	| ImportExpression 'set' 
	| ImportExpression literalString 
	;
TypeSpec : 'methods' 
	| 'fields' 
	| 'arguments' 
	| 'classes' 
	;
Reference : 'reference' 
	| 'references' 
	;
GROUP_EXPRESSION : 'count' 
	| 'first' 
	;
Types : 'type' 
	| 'types' 
	;
RELATIONAL_OPERATOR : '<' 
	| '<=' 
	| '=' 
	| '!=' 
	| '>=' 
	| '>' 
	;
UncalledPolymorphic : 'uncalled' 'polymorphic' 
	;

  	
browse-by-query home antlersoft free software sourceforge project page