|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectantlr.TreeParser
org.apache.jdo.impl.jdoql.jdoqlc.Semantic
public class Semantic
This class defines the semantic analysis of the JDOQL compiler. Input of this pass is the AST as produced by the parser, that consists of JDOQLAST nodes. The result is a typed JDOQLAST tree.
TBD:
Field Summary | |
---|---|
static java.lang.String[] |
_tokenNames
|
static antlr.collections.impl.BitSet |
_tokenSet_0
|
protected JavaType |
candidateClass
Candidate class. |
protected ErrorMsg |
errorMsg
The error message support class. |
protected static I18NHelper |
msg
I18N support |
protected ParameterTable |
paramtab
The query parameter table |
protected SymbolTable |
symtab
Symbol table handling names of variables and parameters. |
protected TypeNames |
typeNames
Table of type names handling imports. |
protected TypeSupport |
typeSupport
The type support. |
protected VariableChecker |
varChecker
The variable checker. |
protected VariableTable |
vartab
The variable table. |
Fields inherited from class antlr.TreeParser |
---|
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth |
Constructor Summary | |
---|---|
Semantic()
|
Method Summary | |
---|---|
protected JDOQLAST |
addCharacterCast(JDOQLAST ast,
JavaType common)
The query runtime has a problem with binary or relational expressions having an operand of type char or Character. |
protected JDOQLAST |
analyseBinaryArithmeticExpr(JDOQLAST op,
JDOQLAST leftAST,
JDOQLAST rightAST)
Analyses a binary arithmetic expression +, -, *, /. |
protected JavaType |
analyseBitwiseExpr(JDOQLAST op,
JDOQLAST leftAST,
JDOQLAST rightAST)
Analyses a bitwise/logical operation (&, |, ^) |
protected JDOQLAST |
analyseCollectionCall(JDOQLAST dot,
JDOQLAST collection,
JDOQLAST method,
JDOQLAST args)
Analyses a call for an object that implements Collection. |
protected JDOQLAST |
analyseComplementExpr(JDOQLAST op,
JDOQLAST argAST)
Analyses a complement expression. |
protected JavaType |
analyseComplementExprType(JDOQLAST op,
JDOQLAST argAST)
Analyses a complement expression. |
protected JavaType |
analyseConditionalExpr(JDOQLAST op,
JDOQLAST leftAST,
JDOQLAST rightAST)
Analyses a boolean conditional operation (&&, ||) |
protected JDOQLAST |
analyseDefinedIdentifier(JDOQLAST ident)
This method analyses an identifier defined in the current scope which is a field, variable or parameter defined in the symbol table. |
protected JDOQLAST |
analyseDotExpr(JDOQLAST dot,
JDOQLAST expr,
JDOQLAST ident,
JDOQLAST args)
This method analyses a dot expression of the form expr.ident or expr.ident(params) where expr itself can again be a dot expression. |
protected JDOQLAST |
analyseFieldAccess(JDOQLAST objectExpr,
JDOQLAST ident,
JavaType classType,
JavaField javaField)
|
protected void |
analyseOrderingExpression(JDOQLAST expr)
This method analyses the expression of a single ordering definition. |
protected JDOQLAST |
analyseRelationalExpr(JDOQLAST op,
JDOQLAST leftAST,
JDOQLAST rightAST)
Analyses a relational operation. |
protected JDOQLAST |
analyseStaticFieldAccess(JDOQLAST typename,
JDOQLAST ident,
JavaType classType,
JavaField javaField)
|
protected JDOQLAST |
analyseStringCall(JDOQLAST dot,
JDOQLAST string,
JDOQLAST method,
JDOQLAST args)
Analyses a call for an object of type String. |
protected JDOQLAST |
analyseUnaryArithmeticExpr(JDOQLAST op,
JDOQLAST argAST)
Analyses a unary expression + and - |
protected JavaType |
analyseUnaryArithmeticExprType(JDOQLAST op,
JDOQLAST argAST)
Analyses a unary expression + and - |
void |
argList(antlr.collections.AST _t)
|
void |
args(antlr.collections.AST _t)
|
void |
binaryArithmeticExpr(antlr.collections.AST _t)
|
void |
bitwiseExpr(antlr.collections.AST _t)
|
void |
candidateClass(antlr.collections.AST _t)
|
protected void |
checkConstraints(JDOQLAST ast,
java.lang.String dependentVariable,
VariableChecker tab)
|
protected void |
checkConstraints(JDOQLAST ast,
VariableChecker tab)
|
protected void |
checkContainsArgs(JDOQLAST collection,
JDOQLAST method,
JDOQLAST args)
Check the arguments of a contains call. |
protected void |
checkIsEmptyArgs(JDOQLAST args)
Check the arguments of a isEmpty call. |
protected void |
checkStringCallArgs(JDOQLAST method,
JDOQLAST args)
Check the arguments of a startWith or endWith call. |
void |
complementExpr(antlr.collections.AST _t)
|
void |
conditionalExpr(antlr.collections.AST _t)
|
void |
contains(antlr.collections.AST _t)
|
JDOQLAST |
createQueryTree(java.lang.Class candidateClass,
JDOQLAST importsAST,
JDOQLAST paramsAST,
JDOQLAST varsAST,
JDOQLAST orderingAST,
JDOQLAST filterAST)
Combines partial ASTs into one query AST. |
void |
declareImport(antlr.collections.AST _t)
|
void |
declareParameter(antlr.collections.AST _t)
|
void |
declareVariable(antlr.collections.AST _t)
|
java.lang.String |
dotExpr(antlr.collections.AST _t)
|
void |
endsWith(antlr.collections.AST _t)
|
void |
expression(antlr.collections.AST _t)
|
java.lang.String |
exprNoCheck(antlr.collections.AST _t,
boolean insideDotExpr)
|
void |
fieldAccess(antlr.collections.AST _t)
|
void |
filter(antlr.collections.AST _t)
|
protected JavaField |
getCollectionField(JDOQLAST expr)
|
protected JavaType |
getCommonOperandType(JavaType left,
JavaType right)
Returns the common type info for the specified operand types. |
java.lang.String |
identifier(antlr.collections.AST _t,
boolean insideDotExpr)
|
void |
imports(antlr.collections.AST _t)
|
void |
init(TypeSupport typeSupport,
ParameterTable paramtab,
VariableTable vartab,
ErrorMsg errorMsg)
|
void |
isEmpty(antlr.collections.AST _t)
|
void |
literal(antlr.collections.AST _t)
|
void |
navigation(antlr.collections.AST _t)
|
void |
ordering(antlr.collections.AST _t)
|
void |
orderSpec(antlr.collections.AST _t)
|
void |
parameterAccess(antlr.collections.AST _t)
|
void |
parameters(antlr.collections.AST _t)
|
java.lang.String |
primary(antlr.collections.AST _t,
boolean insideDotExpr)
|
void |
primitiveType(antlr.collections.AST _t)
|
java.lang.String |
qualifiedName(antlr.collections.AST _t)
|
void |
query(antlr.collections.AST _t)
|
void |
relationalExpr(antlr.collections.AST _t)
|
void |
reportError(antlr.RecognitionException ex)
|
void |
reportError(java.lang.String s)
|
void |
startsWith(antlr.collections.AST _t)
|
void |
staticFieldAccess(antlr.collections.AST _t)
|
void |
type(antlr.collections.AST _t)
|
void |
unaryArithmeticExpr(antlr.collections.AST _t)
|
void |
variableAccess(antlr.collections.AST _t)
|
void |
variables(antlr.collections.AST _t)
|
Methods inherited from class antlr.TreeParser |
---|
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ErrorMsg errorMsg
protected SymbolTable symtab
protected TypeNames typeNames
protected TypeSupport typeSupport
protected ParameterTable paramtab
protected VariableTable vartab
protected VariableChecker varChecker
protected JavaType candidateClass
protected static final I18NHelper msg
public static final java.lang.String[] _tokenNames
public static final antlr.collections.impl.BitSet _tokenSet_0
Constructor Detail |
---|
public Semantic()
Method Detail |
---|
public void init(TypeSupport typeSupport, ParameterTable paramtab, VariableTable vartab, ErrorMsg errorMsg)
public void reportError(antlr.RecognitionException ex)
reportError
in class antlr.TreeParser
public void reportError(java.lang.String s)
reportError
in class antlr.TreeParser
public JDOQLAST createQueryTree(java.lang.Class candidateClass, JDOQLAST importsAST, JDOQLAST paramsAST, JDOQLAST varsAST, JDOQLAST orderingAST, JDOQLAST filterAST)
protected void analyseOrderingExpression(JDOQLAST expr)
expr
- the expression of an ordering definitionprotected JDOQLAST analyseDotExpr(JDOQLAST dot, JDOQLAST expr, JDOQLAST ident, JDOQLAST args)
expr
- the left hand side of the dot expressionident
- the right hand side of the dot expressionargs
- arguments (in the case of a call)
protected JDOQLAST analyseFieldAccess(JDOQLAST objectExpr, JDOQLAST ident, JavaType classType, JavaField javaField)
protected JDOQLAST analyseStaticFieldAccess(JDOQLAST typename, JDOQLAST ident, JavaType classType, JavaField javaField)
protected JDOQLAST analyseDefinedIdentifier(JDOQLAST ident)
ident
- the identifier AST
protected JDOQLAST analyseCollectionCall(JDOQLAST dot, JDOQLAST collection, JDOQLAST method, JDOQLAST args)
protected void checkContainsArgs(JDOQLAST collection, JDOQLAST method, JDOQLAST args)
protected JavaField getCollectionField(JDOQLAST expr)
protected void checkIsEmptyArgs(JDOQLAST args)
protected JDOQLAST analyseStringCall(JDOQLAST dot, JDOQLAST string, JDOQLAST method, JDOQLAST args)
protected void checkStringCallArgs(JDOQLAST method, JDOQLAST args)
protected JavaType analyseBitwiseExpr(JDOQLAST op, JDOQLAST leftAST, JDOQLAST rightAST)
op
- the bitwise/logical operatorleftAST
- left operandrightAST
- right operand
protected JavaType analyseConditionalExpr(JDOQLAST op, JDOQLAST leftAST, JDOQLAST rightAST)
op
- the conditional operatorleftAST
- left operandrightAST
- right operand
protected JDOQLAST analyseRelationalExpr(JDOQLAST op, JDOQLAST leftAST, JDOQLAST rightAST)
op
- the relational operatorleftAST
- left operandrightAST
- right operand
protected JDOQLAST analyseBinaryArithmeticExpr(JDOQLAST op, JDOQLAST leftAST, JDOQLAST rightAST)
op
- the operatorleftAST
- left operandrightAST
- right operand
protected JDOQLAST addCharacterCast(JDOQLAST ast, JavaType common)
ast
- the ast to be checkedcommon
- the type to be used inside the cast
protected JavaType getCommonOperandType(JavaType left, JavaType right)
left
- type info of left operandright
- type info of right operand
protected JDOQLAST analyseUnaryArithmeticExpr(JDOQLAST op, JDOQLAST argAST)
op
- the operatorargAST
- the opreand
protected JavaType analyseUnaryArithmeticExprType(JDOQLAST op, JDOQLAST argAST)
op
- the operatorargAST
- the operand
protected JDOQLAST analyseComplementExpr(JDOQLAST op, JDOQLAST argAST)
op
- the operatorargAST
- the operand
protected JavaType analyseComplementExprType(JDOQLAST op, JDOQLAST argAST)
op
- the operatorargAST
- the operand
protected void checkConstraints(JDOQLAST ast, VariableChecker tab)
protected void checkConstraints(JDOQLAST ast, java.lang.String dependentVariable, VariableChecker tab)
public final void query(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void candidateClass(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void imports(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void parameters(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void variables(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void ordering(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void filter(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void type(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void declareImport(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final java.lang.String qualifiedName(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void declareParameter(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void declareVariable(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void orderSpec(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void expression(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final java.lang.String exprNoCheck(antlr.collections.AST _t, boolean insideDotExpr) throws antlr.RecognitionException
antlr.RecognitionException
public final void bitwiseExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void conditionalExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void relationalExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void binaryArithmeticExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void unaryArithmeticExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void complementExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final java.lang.String primary(antlr.collections.AST _t, boolean insideDotExpr) throws antlr.RecognitionException
antlr.RecognitionException
public final void literal(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final java.lang.String dotExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final java.lang.String identifier(antlr.collections.AST _t, boolean insideDotExpr) throws antlr.RecognitionException
antlr.RecognitionException
public final void parameterAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void variableAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void fieldAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void navigation(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void contains(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void isEmpty(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void startsWith(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void endsWith(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void argList(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void args(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void staticFieldAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void primitiveType(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |