1313import org .apache .commons .logging .LogFactory ;
1414
1515import java .util .Map ;
16- import java .util .regex .Matcher ;
17- import java .util .regex .Pattern ;
1816
1917public class JexlExpressionHandler extends AbstractExpressionHandler {
2018
2119 private static final int MAX_ENTRIES = 5000 ;
22- private static Pattern plusplus = Pattern .compile ("([a-zA-Z0-9-_]*[a-zA-Z0-9])\\ +\\ +\\ s*;{0,1}\\ s*$" );
23- private static Pattern isplusplus = Pattern .compile ("\\ +\\ +\\ s*;{0,1}\\ s*$" );
24- private static Pattern minusminus = Pattern .compile ("([a-zA-Z0-9-_]*[a-zA-Z0-9])--\\ s*;{0,1}\\ s*$" );
25- private static Pattern isminusminus = Pattern .compile ("--\\ s*;{0,1}\\ s*$" );
2620 private JexlEngine jexl ;
2721 private final JexlExpressionHandlerOptions options = new JexlExpressionHandlerOptions ();
2822 private final RecordWrapperUberspect pugUberspect = new RecordWrapperUberspect (LogFactory .getLog (JexlExpressionHandler .class ),
@@ -81,12 +75,6 @@ public Object evaluateExpression(String expression, PugModel model) throws Expre
8175 try {
8276 saveLocalVariableName (expression , model );
8377 expression = removeVar (expression );
84- if (isplusplus .matcher (expression ).find ()) {
85- expression = convertPlusPlusExpression (expression );
86- }
87- if (isminusminus .matcher (expression ).find ()) {
88- expression = convertMinusMinusExpression (expression );
89- }
9078 JexlScript e = jexl .createScript (expression );
9179 MapContext jexlContext = new MapContext (model );
9280 return e .execute (jexlContext );
@@ -95,24 +83,6 @@ public Object evaluateExpression(String expression, PugModel model) throws Expre
9583 }
9684 }
9785
98- private String convertMinusMinusExpression (String expression ) {
99- Matcher matcher = minusminus .matcher (expression );
100- if (matcher .find (0 ) && matcher .groupCount () == 1 ) {
101- String a = matcher .group (1 );
102- expression = a + " = " + a + " - 1" ;
103- }
104- return expression ;
105- }
106-
107- private String convertPlusPlusExpression (String expression ) {
108- Matcher matcher = plusplus .matcher (expression );
109- if (matcher .find (0 ) && matcher .groupCount () == 1 ) {
110- String a = matcher .group (1 );
111- expression = a + " = " + a + " + 1" ;
112- }
113- return expression ;
114- }
115-
11686 private String removeVar (String expression ) {
11787 expression = expression .replace ("var " , ";" );
11888 expression = expression .replace ("let " , ";" );
0 commit comments