From aff912c9560394304f3b793ab574df9fd24f9257 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 13 Jan 2010 19:19:25 +0000 Subject: [PATCH] Jasper Parser change so methods with parameters aren't mistaken for functions git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@898900 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/ELParser.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/java/org/apache/jasper/compiler/ELParser.java b/java/org/apache/jasper/compiler/ELParser.java index 1c4ae7c1f..ce17448d3 100644 --- a/java/org/apache/jasper/compiler/ELParser.java +++ b/java/org/apache/jasper/compiler/ELParser.java @@ -30,7 +30,8 @@ package org.apache.jasper.compiler; public class ELParser { - private Token curToken; // current token + private Token curToken; // current token + private Token prevToken; // previous token private ELNode.Nodes expr; @@ -119,27 +120,28 @@ public class ELParser { * arguments */ private boolean parseFunction() { - if (!(curToken instanceof Id) || isELReserved(curToken.toString())) { + if (!(curToken instanceof Id) || isELReserved(curToken.toString()) || + prevToken instanceof Char && prevToken.toChar() == '.') { return false; } String s1 = null; // Function prefix String s2 = curToken.toString(); // Function name int mark = getIndex(); if (hasNext()) { - Token t = nextToken(); - if (t.toChar() == ':') { + curToken = nextToken(); + if (curToken.toChar() == ':') { if (hasNext()) { Token t2 = nextToken(); if (t2 instanceof Id) { s1 = s2; s2 = t2.toString(); if (hasNext()) { - t = nextToken(); + curToken = nextToken(); } } } } - if (t.toChar() == '(') { + if (curToken.toChar() == '(') { ELexpr.add(new ELNode.Function(s1, s2)); return true; } @@ -224,6 +226,7 @@ public class ELParser { * @return The next token in the EL expression buffer. */ private Token nextToken() { + prevToken = curToken; skipSpaces(); if (hasNextChar()) { char ch = nextChar(); -- 2.11.0