Author: remy.maucherat(a)jboss.com
Date: 2009-11-20 21:42:29 -0500 (Fri, 20 Nov 2009)
New Revision: 1282
Modified:
trunk/java/org/apache/el/parser/AstBracketSuffix.java
trunk/java/org/apache/el/parser/AstDotSuffix.java
trunk/java/org/apache/el/parser/AstValue.java
trunk/java/org/apache/el/parser/ELParser.jjt
Log:
- Add the grammar update for parameters.
- Will add the generated parser when I get a test for this.
Modified: trunk/java/org/apache/el/parser/AstBracketSuffix.java
===================================================================
--- trunk/java/org/apache/el/parser/AstBracketSuffix.java 2009-11-20 23:18:44 UTC (rev
1281)
+++ trunk/java/org/apache/el/parser/AstBracketSuffix.java 2009-11-21 02:42:29 UTC (rev
1282)
@@ -36,4 +36,15 @@
throws ELException {
return this.children[0].getValue(ctx);
}
+
+ public Object getParameters(EvaluationContext ctx)
+ throws ELException {
+ if (jjtGetNumChildren() < 2)
+ return new Object[0];
+ Object[] params = new Object[jjtGetNumChildren() - 1];
+ for (int i = 1; i < jjtGetNumChildren(); i++) {
+ params[i - 1] = jjtGetChild(i).getValue(ctx);
+ }
+ return params;
+ }
}
Modified: trunk/java/org/apache/el/parser/AstDotSuffix.java
===================================================================
--- trunk/java/org/apache/el/parser/AstDotSuffix.java 2009-11-20 23:18:44 UTC (rev 1281)
+++ trunk/java/org/apache/el/parser/AstDotSuffix.java 2009-11-21 02:42:29 UTC (rev 1282)
@@ -36,4 +36,13 @@
throws ELException {
return this.image;
}
+
+ public Object getParameters(EvaluationContext ctx)
+ throws ELException {
+ Object[] params = new Object[jjtGetNumChildren()];
+ for (int i = 0; i < jjtGetNumChildren(); i++) {
+ params[i] = jjtGetChild(i).getValue(ctx);
+ }
+ return params;
+ }
}
Modified: trunk/java/org/apache/el/parser/AstValue.java
===================================================================
--- trunk/java/org/apache/el/parser/AstValue.java 2009-11-20 23:18:44 UTC (rev 1281)
+++ trunk/java/org/apache/el/parser/AstValue.java 2009-11-21 02:42:29 UTC (rev 1282)
@@ -113,6 +113,7 @@
}
public Object getValue(EvaluationContext ctx) throws ELException {
+ // TODO: add dot suffix params
Object base = this.children[0].getValue(ctx);
int propCount = this.jjtGetNumChildren();
int i = 1;
@@ -172,6 +173,7 @@
public Object invoke(EvaluationContext ctx, Class[] paramTypes,
Object[] paramValues) throws ELException {
+ // TODO: add dot suffix params
Target t = getTarget(ctx);
Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
Object result = null;
Modified: trunk/java/org/apache/el/parser/ELParser.jjt
===================================================================
--- trunk/java/org/apache/el/parser/ELParser.jjt 2009-11-20 23:18:44 UTC (rev 1281)
+++ trunk/java/org/apache/el/parser/ELParser.jjt 2009-11-21 02:42:29 UTC (rev 1282)
@@ -236,7 +236,7 @@
*/
void DotSuffix() #DotSuffix : { Token t = null; }
{
- <DOT> t=<IDENTIFIER> { jjtThis.setImage(t.image); }
+ <DOT> t=<IDENTIFIER> { jjtThis.setImage(t.image); } (<LPAREN>
Parameters() <RPAREN>)?
}
/*
@@ -245,10 +245,19 @@
*/
void BracketSuffix() #BracketSuffix : {}
{
- <LBRACK> Expression() <RBRACK>
+ <LBRACK> Expression() <RBRACK> (<LPAREN> Parameters()
<RPAREN>)?
}
/*
+ * Parameters
+ * Method parameters
+ */
+void Parameters() : {}
+{
+ Expression() (<COMMA> Expression())*
+}
+
+/*
* NonLiteral
* For Grouped Operations, Identifiers, and Functions
*/
Show replies by date