org.springframework.expression.spel.ast.StringLiteral Java Examples

The following examples show how to use org.springframework.expression.spel.ast.StringLiteral. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InternalSpelExpressionParser.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean maybeEatLiteral() {
	Token t = peekToken();
	if (t == null) {
		return false;
	}
	if (t.kind == TokenKind.LITERAL_INT) {
		push(Literal.getIntLiteral(t.stringValue(), t.startPos, t.endPos, 10));
	}
	else if (t.kind == TokenKind.LITERAL_LONG) {
		push(Literal.getLongLiteral(t.stringValue(), t.startPos, t.endPos, 10));
	}
	else if (t.kind == TokenKind.LITERAL_HEXINT) {
		push(Literal.getIntLiteral(t.stringValue(), t.startPos, t.endPos, 16));
	}
	else if (t.kind == TokenKind.LITERAL_HEXLONG) {
		push(Literal.getLongLiteral(t.stringValue(), t.startPos, t.endPos, 16));
	}
	else if (t.kind == TokenKind.LITERAL_REAL) {
		push(Literal.getRealLiteral(t.stringValue(), t.startPos, t.endPos, false));
	}
	else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) {
		push(Literal.getRealLiteral(t.stringValue(), t.startPos, t.endPos, true));
	}
	else if (peekIdentifierToken("true")) {
		push(new BooleanLiteral(t.stringValue(), t.startPos, t.endPos, true));
	}
	else if (peekIdentifierToken("false")) {
		push(new BooleanLiteral(t.stringValue(), t.startPos, t.endPos, false));
	}
	else if (t.kind == TokenKind.LITERAL_STRING) {
		push(new StringLiteral(t.stringValue(), t.startPos, t.endPos, t.stringValue()));
	}
	else {
		return false;
	}
	nextToken();
	return true;
}
 
Example #2
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 5 votes vote down vote up
private boolean maybeEatLiteral() {
	Token t = peekToken();
	if (t == null) {
		return false;
	}
	if (t.kind == TokenKind.LITERAL_INT) {
		push(Literal.getIntLiteral(t.stringValue(), toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_LONG) {
		push(Literal.getLongLiteral(t.stringValue(), toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_HEXINT) {
		push(Literal.getIntLiteral(t.stringValue(), toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_HEXLONG) {
		push(Literal.getLongLiteral(t.stringValue(), toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_REAL) {
		push(Literal.getRealLiteral(t.stringValue(), toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) {
		push(Literal.getRealLiteral(t.stringValue(), toPos(t), true));
	}
	else if (peekIdentifierToken("true")) {
		push(new BooleanLiteral(t.stringValue(), toPos(t), true));
	}
	else if (peekIdentifierToken("false")) {
		push(new BooleanLiteral(t.stringValue(), toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_STRING) {
		push(new StringLiteral(t.stringValue(), toPos(t), t.stringValue()));
	}
	else {
		return false;
	}
	nextToken();
	return true;
}
 
Example #3
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean maybeEatLiteral() {
	Token t = peekToken();
	if (t == null) {
		return false;
	}
	if (t.kind == TokenKind.LITERAL_INT) {
		push(Literal.getIntLiteral(t.data, toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_LONG) {
		push(Literal.getLongLiteral(t.data, toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_HEXINT) {
		push(Literal.getIntLiteral(t.data, toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_HEXLONG) {
		push(Literal.getLongLiteral(t.data, toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_REAL) {
		push(Literal.getRealLiteral(t.data, toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) {
		push(Literal.getRealLiteral(t.data, toPos(t), true));
	}
	else if (peekIdentifierToken("true")) {
		push(new BooleanLiteral(t.data, toPos(t), true));
	}
	else if (peekIdentifierToken("false")) {
		push(new BooleanLiteral(t.data, toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_STRING) {
		push(new StringLiteral(t.data, toPos(t), t.data));
	}
	else {
		return false;
	}
	nextToken();
	return true;
}
 
Example #4
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean maybeEatLiteral() {
	Token t = peekToken();
	if (t == null) {
		return false;
	}
	if (t.kind == TokenKind.LITERAL_INT) {
		push(Literal.getIntLiteral(t.data, toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_LONG) {
		push(Literal.getLongLiteral(t.data, toPos(t), 10));
	}
	else if (t.kind == TokenKind.LITERAL_HEXINT) {
		push(Literal.getIntLiteral(t.data, toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_HEXLONG) {
		push(Literal.getLongLiteral(t.data, toPos(t), 16));
	}
	else if (t.kind == TokenKind.LITERAL_REAL) {
		push(Literal.getRealLiteral(t.data, toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_REAL_FLOAT) {
		push(Literal.getRealLiteral(t.data, toPos(t), true));
	}
	else if (peekIdentifierToken("true")) {
		push(new BooleanLiteral(t.data, toPos(t), true));
	}
	else if (peekIdentifierToken("false")) {
		push(new BooleanLiteral(t.data, toPos(t), false));
	}
	else if (t.kind == TokenKind.LITERAL_STRING) {
		push(new StringLiteral(t.data, toPos(t), t.data));
	}
	else {
		return false;
	}
	nextToken();
	return true;
}