1212import org .apache .commons .logging .LogFactory ;
1313
1414import java .util .Map ;
15- import java .util .regex .Matcher ;
16- import java .util .regex .Pattern ;
1715
1816public class JexlExpressionHandler extends AbstractExpressionHandler {
1917
2018 private static final int MAX_ENTRIES = 5000 ;
21- private static Pattern plusplus = Pattern .compile ("([a-zA-Z0-9-_]*[a-zA-Z0-9])\\ +\\ +\\ s*;{0,1}\\ s*$" );
22- private static Pattern isplusplus = Pattern .compile ("\\ +\\ +\\ s*;{0,1}\\ s*$" );
23- private static Pattern minusminus = Pattern .compile ("([a-zA-Z0-9-_]*[a-zA-Z0-9])--\\ s*;{0,1}\\ s*$" );
24- private static Pattern isminusminus = Pattern .compile ("--\\ s*;{0,1}\\ s*$" );
2519 private JexlEngine jexl ;
2620 private final JexlExpressionHandlerOptions options = new JexlExpressionHandlerOptions ();
2721 private final Uberspect pugUberspect = new Uberspect (LogFactory .getLog (JexlExpressionHandler .class ),
@@ -75,12 +69,6 @@ public Object evaluateExpression(String expression, PugModel model) throws Expre
7569 try {
7670 saveLocalVariableName (expression , model );
7771 expression = removeVar (expression );
78- if (isplusplus .matcher (expression ).find ()) {
79- expression = convertPlusPlusExpression (expression );
80- }
81- if (isminusminus .matcher (expression ).find ()) {
82- expression = convertMinusMinusExpression (expression );
83- }
8472 JexlScript e = jexl .createScript (expression );
8573 MapContext jexlContext = new MapContext (model );
8674 return e .execute (jexlContext );
@@ -89,24 +77,6 @@ public Object evaluateExpression(String expression, PugModel model) throws Expre
8977 }
9078 }
9179
92- private String convertMinusMinusExpression (String expression ) {
93- Matcher matcher = minusminus .matcher (expression );
94- if (matcher .find (0 ) && matcher .groupCount () == 1 ) {
95- String a = matcher .group (1 );
96- expression = a + " = " + a + " - 1" ;
97- }
98- return expression ;
99- }
100-
101- private String convertPlusPlusExpression (String expression ) {
102- Matcher matcher = plusplus .matcher (expression );
103- if (matcher .find (0 ) && matcher .groupCount () == 1 ) {
104- String a = matcher .group (1 );
105- expression = a + " = " + a + " + 1" ;
106- }
107- return expression ;
108- }
109-
11080 private String removeVar (String expression ) {
11181 expression = expression .replace ("var " , ";" );
11282 expression = expression .replace ("let " , ";" );
0 commit comments