@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2018 the original author or authors .
* Copyright 2002 - 2019 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -155,32 +155,32 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -155,32 +155,32 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if ( t ! = null ) {
if ( t . kind = = TokenKind . ASSIGN ) { // a=b
if ( expr = = null ) {
expr = new NullLiteral ( toPos ( t . startPos - 1 , t . endPos - 1 ) ) ;
expr = new NullLiteral ( t . startPos - 1 , t . endPos - 1 ) ;
}
nextToken ( ) ;
SpelNodeImpl assignedValue = eatLogicalOrExpression ( ) ;
return new Assign ( toPos ( t ) , expr , assignedValue ) ;
return new Assign ( t . startPos , t . endPos , expr , assignedValue ) ;
}
if ( t . kind = = TokenKind . ELVIS ) { // a?:b (a if it isn't null, otherwise b)
if ( expr = = null ) {
expr = new NullLiteral ( toPos ( t . startPos - 1 , t . endPos - 2 ) ) ;
expr = new NullLiteral ( t . startPos - 1 , t . endPos - 2 ) ;
}
nextToken ( ) ; // elvis has left the building
SpelNodeImpl valueIfNull = eatExpression ( ) ;
if ( valueIfNull = = null ) {
valueIfNull = new NullLiteral ( toPos ( t . startPos + 1 , t . endPos + 1 ) ) ;
valueIfNull = new NullLiteral ( t . startPos + 1 , t . endPos + 1 ) ;
}
return new Elvis ( toPos ( t ) , expr , valueIfNull ) ;
return new Elvis ( t . startPos , t . endPos , expr , valueIfNull ) ;
}
if ( t . kind = = TokenKind . QMARK ) { // a?b:c
if ( expr = = null ) {
expr = new NullLiteral ( toPos ( t . startPos - 1 , t . endPos - 1 ) ) ;
expr = new NullLiteral ( t . startPos - 1 , t . endPos - 1 ) ;
}
nextToken ( ) ;
SpelNodeImpl ifTrueExprValue = eatExpression ( ) ;
eatToken ( TokenKind . COLON ) ;
SpelNodeImpl ifFalseExprValue = eatExpression ( ) ;
return new Ternary ( toPos ( t ) , expr , ifTrueExprValue , ifFalseExprValue ) ;
return new Ternary ( t . startPos , t . endPos , expr , ifTrueExprValue , ifFalseExprValue ) ;
}
}
return expr ;
@ -194,7 +194,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -194,7 +194,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
Token t = takeToken ( ) ; //consume OR
SpelNodeImpl rhExpr = eatLogicalAndExpression ( ) ;
checkOperands ( t , expr , rhExpr ) ;
expr = new OpOr ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpOr ( t . startPos , t . endPos , expr , rhExpr ) ;
}
return expr ;
}
@ -207,7 +207,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -207,7 +207,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
Token t = takeToken ( ) ; // consume 'AND'
SpelNodeImpl rhExpr = eatRelationalExpression ( ) ;
checkOperands ( t , expr , rhExpr ) ;
expr = new OpAnd ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpAnd ( t . startPos , t . endPos , expr , rhExpr ) ;
}
return expr ;
}
@ -224,36 +224,35 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -224,36 +224,35 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
TokenKind tk = relationalOperatorToken . kind ;
if ( relationalOperatorToken . isNumericRelationalOperator ( ) ) {
int pos = toPos ( t ) ;
if ( tk = = TokenKind . GT ) {
return new OpGT ( p os, expr , rhExpr ) ;
return new OpGT ( t . startPos , t . endP os, expr , rhExpr ) ;
}
if ( tk = = TokenKind . LT ) {
return new OpLT ( p os, expr , rhExpr ) ;
return new OpLT ( t . startPos , t . endP os, expr , rhExpr ) ;
}
if ( tk = = TokenKind . LE ) {
return new OpLE ( p os, expr , rhExpr ) ;
return new OpLE ( t . startPos , t . endP os, expr , rhExpr ) ;
}
if ( tk = = TokenKind . GE ) {
return new OpGE ( p os, expr , rhExpr ) ;
return new OpGE ( t . startPos , t . endP os, expr , rhExpr ) ;
}
if ( tk = = TokenKind . EQ ) {
return new OpEQ ( p os, expr , rhExpr ) ;
return new OpEQ ( t . startPos , t . endP os, expr , rhExpr ) ;
}
Assert . isTrue ( tk = = TokenKind . NE , "Not-equals token expected" ) ;
return new OpNE ( p os, expr , rhExpr ) ;
return new OpNE ( t . startPos , t . endP os, expr , rhExpr ) ;
}
if ( tk = = TokenKind . INSTANCEOF ) {
return new OperatorInstanceof ( toPos ( t ) , expr , rhExpr ) ;
return new OperatorInstanceof ( t . startPos , t . endPos , expr , rhExpr ) ;
}
if ( tk = = TokenKind . MATCHES ) {
return new OperatorMatches ( toPos ( t ) , expr , rhExpr ) ;
return new OperatorMatches ( t . startPos , t . endPos , expr , rhExpr ) ;
}
Assert . isTrue ( tk = = TokenKind . BETWEEN , "Between token expected" ) ;
return new OperatorBetween ( toPos ( t ) , expr , rhExpr ) ;
return new OperatorBetween ( t . startPos , t . endPos , expr , rhExpr ) ;
}
return expr ;
}
@ -267,10 +266,10 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -267,10 +266,10 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl rhExpr = eatProductExpression ( ) ;
checkRightOperand ( t , rhExpr ) ;
if ( t . kind = = TokenKind . PLUS ) {
expr = new OpPlus ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpPlus ( t . startPos , t . endPos , expr , rhExpr ) ;
}
else if ( t . kind = = TokenKind . MINUS ) {
expr = new OpMinus ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpMinus ( t . startPos , t . endPos , expr , rhExpr ) ;
}
}
return expr ;
@ -285,14 +284,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -285,14 +284,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl rhExpr = eatPowerIncDecExpression ( ) ;
checkOperands ( t , expr , rhExpr ) ;
if ( t . kind = = TokenKind . STAR ) {
expr = new OpMultiply ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpMultiply ( t . startPos , t . endPos , expr , rhExpr ) ;
}
else if ( t . kind = = TokenKind . DIV ) {
expr = new OpDivide ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpDivide ( t . startPos , t . endPos , expr , rhExpr ) ;
}
else {
Assert . isTrue ( t . kind = = TokenKind . MOD , "Mod token expected" ) ;
expr = new OpModulus ( toPos ( t ) , expr , rhExpr ) ;
expr = new OpModulus ( t . startPos , t . endPos , expr , rhExpr ) ;
}
}
return expr ;
@ -306,14 +305,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -306,14 +305,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
Token t = takeToken ( ) ; //consume POWER
SpelNodeImpl rhExpr = eatUnaryExpression ( ) ;
checkRightOperand ( t , rhExpr ) ;
return new OperatorPower ( toPos ( t ) , expr , rhExpr ) ;
return new OperatorPower ( t . startPos , t . endPos , expr , rhExpr ) ;
}
if ( expr ! = null & & peekToken ( TokenKind . INC , TokenKind . DEC ) ) {
Token t = takeToken ( ) ; //consume INC/DEC
if ( t . getKind ( ) = = TokenKind . INC ) {
return new OpInc ( toPos ( t ) , true , expr ) ;
return new OpInc ( t . startPos , t . endPos , true , expr ) ;
}
return new OpDec ( toPos ( t ) , true , expr ) ;
return new OpDec ( t . startPos , t . endPos , true , expr ) ;
}
return expr ;
}
@ -326,21 +325,21 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -326,21 +325,21 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl expr = eatUnaryExpression ( ) ;
Assert . state ( expr ! = null , "No node" ) ;
if ( t . kind = = TokenKind . NOT ) {
return new OperatorNot ( toPos ( t ) , expr ) ;
return new OperatorNot ( t . startPos , t . endPos , expr ) ;
}
if ( t . kind = = TokenKind . PLUS ) {
return new OpPlus ( toPos ( t ) , expr ) ;
return new OpPlus ( t . startPos , t . endPos , expr ) ;
}
Assert . isTrue ( t . kind = = TokenKind . MINUS , "Minus token expected" ) ;
return new OpMinus ( toPos ( t ) , expr ) ;
return new OpMinus ( t . startPos , t . endPos , expr ) ;
}
if ( peekToken ( TokenKind . INC , TokenKind . DEC ) ) {
Token t = takeToken ( ) ;
SpelNodeImpl expr = eatUnaryExpression ( ) ;
if ( t . getKind ( ) = = TokenKind . INC ) {
return new OpInc ( toPos ( t ) , false , expr ) ;
return new OpInc ( t . startPos , t . endPos , false , expr ) ;
}
return new OpDec ( toPos ( t ) , false , expr ) ;
return new OpDec ( t . startPos , t . endPos , false , expr ) ;
}
return eatPrimaryExpression ( ) ;
}
@ -362,8 +361,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -362,8 +361,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if ( start = = null | | nodes = = null ) {
return start ;
}
return new CompoundExpression ( toPos ( start . getStartPosition ( ) ,
nodes . get ( nodes . size ( ) - 1 ) . getEndPosition ( ) ) ,
return new CompoundExpression ( start . getStartPosition ( ) , nodes . get ( nodes . size ( ) - 1 ) . getEndPosition ( ) ,
nodes . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
}
@ -424,12 +422,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -424,12 +422,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl [ ] args = maybeEatMethodArgs ( ) ;
if ( args = = null ) {
push ( new VariableReference ( functionOrVariableName . stringValue ( ) ,
toPos ( t . startPos , functionOrVariableName . endPos ) ) ) ;
t . startPos , functionOrVariableName . endPos ) ) ;
return true ;
}
push ( new FunctionReference ( functionOrVariableName . stringValue ( ) ,
toPos ( t . startPos , functionOrVariableName . endPos ) , args ) ) ;
t . startPos , functionOrVariableName . endPos , args ) ) ;
return true ;
}
@ -548,11 +546,10 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -548,11 +546,10 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
BeanReference beanReference ;
if ( beanRefToken . getKind ( ) = = TokenKind . FACTORY_BEAN_REF ) {
String beanNameString = String . valueOf ( TokenKind . FACTORY_BEAN_REF . tokenChars ) + beanName ;
beanReference = new BeanReference (
toPos ( beanRefToken . startPos , beanNameToken . endPos ) , beanNameString ) ;
beanReference = new BeanReference ( beanRefToken . startPos , beanNameToken . endPos , beanNameString ) ;
}
else {
beanReference = new BeanReference ( toPos ( beanNameToken ) , beanName ) ;
beanReference = new BeanReference ( beanNameToken . startPos , beanNameToken . endPos , beanName ) ;
}
this . constructedNodes . push ( beanReference ) ;
return true ;
@ -571,7 +568,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -571,7 +568,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
Token t = takeToken ( ) ;
if ( peekToken ( TokenKind . RSQUARE ) ) {
// looks like 'T]' (T is map key)
push ( new PropertyOrFieldReference ( false , t . stringValue ( ) , toPos ( t ) ) ) ;
push ( new PropertyOrFieldReference ( false , t . stringValue ( ) , t . startPos , t . endPos ) ) ;
return true ;
}
eatToken ( TokenKind . LPAREN ) ;
@ -584,7 +581,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -584,7 +581,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
dims + + ;
}
eatToken ( TokenKind . RPAREN ) ;
this . constructedNodes . push ( new TypeReference ( toPos ( typeName ) , node , dims ) ) ;
this . constructedNodes . push ( new TypeReference ( typeName . startPos , typeName . endPos , node , dims ) ) ;
return true ;
}
return false ;
@ -598,7 +595,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -598,7 +595,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
return false ;
}
nextToken ( ) ;
this . constructedNodes . push ( new NullLiteral ( toPos ( nullToken ) ) ) ;
this . constructedNodes . push ( new NullLiteral ( nullToken . startPos , nullToken . endPos ) ) ;
return true ;
}
return false ;
@ -614,7 +611,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -614,7 +611,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl expr = eatExpression ( ) ;
Assert . state ( expr ! = null , "No node" ) ;
eatToken ( TokenKind . RSQUARE ) ;
this . constructedNodes . push ( new Projection ( nullSafeNavigation , toPos ( t ) , expr ) ) ;
this . constructedNodes . push ( new Projection ( nullSafeNavigation , t . startPos , t . endPos , expr ) ) ;
return true ;
}
@ -631,12 +628,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -631,12 +628,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if ( peekToken ( TokenKind . RCURLY , true ) ) {
// empty list '{}'
Assert . state ( closingCurly ! = null , "No token" ) ;
expr = new InlineList ( toPos ( t . startPos , closingCurly . endPos ) ) ;
expr = new InlineList ( t . startPos , closingCurly . endPos ) ;
}
else if ( peekToken ( TokenKind . COLON , true ) ) {
closingCurly = eatToken ( TokenKind . RCURLY ) ;
// empty map '{:}'
expr = new InlineMap ( toPos ( t . startPos , closingCurly . endPos ) ) ;
expr = new InlineMap ( t . startPos , closingCurly . endPos ) ;
}
else {
SpelNodeImpl firstExpression = eatExpression ( ) ;
@ -648,7 +645,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -648,7 +645,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
List < SpelNodeImpl > elements = new ArrayList < > ( ) ;
elements . add ( firstExpression ) ;
closingCurly = eatToken ( TokenKind . RCURLY ) ;
expr = new InlineList ( toPos ( t . startPos , closingCurly . endPos ) , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
expr = new InlineList ( t . startPos , closingCurly . endPos , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
}
else if ( peekToken ( TokenKind . COMMA , true ) ) { // multi-item list
List < SpelNodeImpl > elements = new ArrayList < > ( ) ;
@ -658,7 +655,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -658,7 +655,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
}
while ( peekToken ( TokenKind . COMMA , true ) ) ;
closingCurly = eatToken ( TokenKind . RCURLY ) ;
expr = new InlineList ( toPos ( t . startPos , closingCurly . endPos ) , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
expr = new InlineList ( t . startPos , closingCurly . endPos , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
}
else if ( peekToken ( TokenKind . COLON , true ) ) { // map!
@ -671,7 +668,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -671,7 +668,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
elements . add ( eatExpression ( ) ) ;
}
closingCurly = eatToken ( TokenKind . RCURLY ) ;
expr = new InlineMap ( toPos ( t . startPos , closingCurly . endPos ) , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
expr = new InlineMap ( t . startPos , closingCurly . endPos , elements . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
}
else {
throw internalException ( t . startPos , SpelMessage . OOD ) ;
@ -690,7 +687,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -690,7 +687,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
SpelNodeImpl expr = eatExpression ( ) ;
Assert . state ( expr ! = null , "No node" ) ;
eatToken ( TokenKind . RSQUARE ) ;
this . constructedNodes . push ( new Indexer ( toPos ( t ) , expr ) ) ;
this . constructedNodes . push ( new Indexer ( t . startPos , t . endPos , expr ) ) ;
return true ;
}
@ -703,17 +700,17 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -703,17 +700,17 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
nextToken ( ) ;
SpelNodeImpl expr = eatExpression ( ) ;
if ( expr = = null ) {
throw internalException ( toPos ( t ) , SpelMessage . MISSING_SELECTION_EXPRESSION ) ;
throw internalException ( t . startPos , SpelMessage . MISSING_SELECTION_EXPRESSION ) ;
}
eatToken ( TokenKind . RSQUARE ) ;
if ( t . kind = = TokenKind . SELECT_FIRST ) {
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . FIRST , toPos ( t ) , expr ) ) ;
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . FIRST , t . startPos , t . endPos , expr ) ) ;
}
else if ( t . kind = = TokenKind . SELECT_LAST ) {
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . LAST , toPos ( t ) , expr ) ) ;
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . LAST , t . startPos , t . endPos , expr ) ) ;
}
else {
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . ALL , toPos ( t ) , expr ) ) ;
this . constructedNodes . push ( new Selection ( nullSafeNavigation , Selection . ALL , t . startPos , t . endPos , expr ) ) ;
}
return true ;
}
@ -728,7 +725,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -728,7 +725,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
while ( isValidQualifiedId ( node ) ) {
nextToken ( ) ;
if ( node . kind ! = TokenKind . DOT ) {
qualifiedIdPieces . add ( new Identifier ( node . stringValue ( ) , toPos ( node ) ) ) ;
qualifiedIdPieces . add ( new Identifier ( node . stringValue ( ) , node . startPos , node . endPos ) ) ;
}
node = peekToken ( ) ;
}
@ -739,8 +736,8 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -739,8 +736,8 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
throw internalException ( node . startPos , SpelMessage . NOT_EXPECTED_TOKEN ,
"qualified ID" , node . getKind ( ) . toString ( ) . toLowerCase ( ) ) ;
}
int pos = toPos ( qualifiedIdPieces . getFirst ( ) . getStartPosition ( ) , qualifiedIdPieces . getLa st( ) . getEndPosition ( ) ) ;
return new QualifiedIdentifier ( pos , qualifiedIdPieces . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
return new QualifiedIdentifier ( qualifiedIdPieces . getFir st( ) . getStartPosition ( ) ,
qualifiedIdPieces . getLast ( ) . getEndPosition ( ) , qualifiedIdPieces . toArray ( new SpelNodeImpl [ 0 ] ) ) ;
}
private boolean isValidQualifiedId ( @Nullable Token node ) {
@ -764,12 +761,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -764,12 +761,12 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if ( args = = null ) {
// property
push ( new PropertyOrFieldReference ( nullSafeNavigation , methodOrPropertyName . stringValue ( ) ,
toPos ( methodOrPropertyName ) ) ) ;
methodOrPropertyName . startPos , methodOrPropertyName . endPos ) ) ;
return true ;
}
// method reference
push ( new MethodReference ( nullSafeNavigation , methodOrPropertyName . stringValue ( ) ,
toPos ( methodOrPropertyName ) , args ) ) ;
methodOrPropertyName . startPos , methodOrPropertyName . endPos , args ) ) ;
// TODO what is the end position for a method reference? the name or the last arg?
return true ;
}
@ -784,7 +781,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -784,7 +781,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
// It looks like a constructor reference but is NEW being used as a map key?
if ( peekToken ( TokenKind . RSQUARE ) ) {
// looks like 'NEW]' (so NEW used as map key)
push ( new PropertyOrFieldReference ( false , newToken . stringValue ( ) , toPos ( newToken ) ) ) ;
push ( new PropertyOrFieldReference ( false , newToken . stringValue ( ) , newToken . startPos , newToken . endPos ) ) ;
return true ;
}
SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId ( ) ;
@ -805,14 +802,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -805,14 +802,14 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
if ( maybeEatInlineListOrMap ( ) ) {
nodes . add ( pop ( ) ) ;
}
push ( new ConstructorReference ( toPos ( newToken ) ,
push ( new ConstructorReference ( newToken . startPos , newToken . endPos ,
dimensions . toArray ( new SpelNodeImpl [ 0 ] ) , nodes . toArray ( new SpelNodeImpl [ 0 ] ) ) ) ;
}
else {
// regular constructor invocation
eatConstructorArgs ( nodes ) ;
// TODO correct end position?
push ( new ConstructorReference ( toPos ( newToken ) , nodes . toArray ( new SpelNodeImpl [ 0 ] ) ) ) ;
push ( new ConstructorReference ( newToken . startPos , newToken . endPos , nodes . toArray ( new SpelNodeImpl [ 0 ] ) ) ) ;
}
return true ;
}
@ -841,31 +838,31 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -841,31 +838,31 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
return false ;
}
if ( t . kind = = TokenKind . LITERAL_INT ) {
push ( Literal . getIntLiteral ( t . stringValue ( ) , toPos ( t ) , 10 ) ) ;
push ( Literal . getIntLiteral ( t . stringValue ( ) , t . startPos , t . endPos , 10 ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_LONG ) {
push ( Literal . getLongLiteral ( t . stringValue ( ) , toPos ( t ) , 10 ) ) ;
push ( Literal . getLongLiteral ( t . stringValue ( ) , t . startPos , t . endPos , 10 ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_HEXINT ) {
push ( Literal . getIntLiteral ( t . stringValue ( ) , toPos ( t ) , 16 ) ) ;
push ( Literal . getIntLiteral ( t . stringValue ( ) , t . startPos , t . endPos , 16 ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_HEXLONG ) {
push ( Literal . getLongLiteral ( t . stringValue ( ) , toPos ( t ) , 16 ) ) ;
push ( Literal . getLongLiteral ( t . stringValue ( ) , t . startPos , t . endPos , 16 ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_REAL ) {
push ( Literal . getRealLiteral ( t . stringValue ( ) , toPos ( t ) , false ) ) ;
push ( Literal . getRealLiteral ( t . stringValue ( ) , t . startPos , t . endPos , false ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_REAL_FLOAT ) {
push ( Literal . getRealLiteral ( t . stringValue ( ) , toPos ( t ) , true ) ) ;
push ( Literal . getRealLiteral ( t . stringValue ( ) , t . startPos , t . endPos , true ) ) ;
}
else if ( peekIdentifierToken ( "true" ) ) {
push ( new BooleanLiteral ( t . stringValue ( ) , toPos ( t ) , true ) ) ;
push ( new BooleanLiteral ( t . stringValue ( ) , t . startPos , t . endPos , true ) ) ;
}
else if ( peekIdentifierToken ( "false" ) ) {
push ( new BooleanLiteral ( t . stringValue ( ) , toPos ( t ) , false ) ) ;
push ( new BooleanLiteral ( t . stringValue ( ) , t . startPos , t . endPos , false ) ) ;
}
else if ( t . kind = = TokenKind . LITERAL_STRING ) {
push ( new StringLiteral ( t . stringValue ( ) , toPos ( t ) , t . stringValue ( ) ) ) ;
push ( new StringLiteral ( t . stringValue ( ) , t . startPos , t . endPos , t . stringValue ( ) ) ) ;
}
else {
return false ;
@ -1040,17 +1037,8 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
@@ -1040,17 +1037,8 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
}
}
private InternalParseException internalException ( int pos , SpelMessage message , Object . . . inserts ) {
return new InternalParseException ( new SpelParseException ( this . expressionString , pos , message , inserts ) ) ;
}
private int toPos ( Token t ) {
// Compress the start and end of a token into a single int
return ( t . startPos < < 16 ) + t . endPos ;
}
private int toPos ( int start , int end ) {
return ( start < < 16 ) + end ;
private InternalParseException internalException ( int startPos , SpelMessage message , Object . . . inserts ) {
return new InternalParseException ( new SpelParseException ( this . expressionString , startPos , message , inserts ) ) ;
}
}