Skip to content
Permalink
Browse files
Merge pull request #57 from csamak/master
More parser compatibility fixes for JavaCC/JJTree
  • Loading branch information
henrib committed Jun 4, 2021
2 parents 93f0a96 + 74dcd97 commit 3265f5d526daf7076214bee762550561d31a157e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
@@ -40,6 +40,7 @@
import org.apache.commons.jexl3.parser.ASTStringLiteral;
import org.apache.commons.jexl3.parser.JexlNode;
import org.apache.commons.jexl3.parser.Parser;
import org.apache.commons.jexl3.parser.StringProvider;


import org.apache.commons.logging.Log;
@@ -148,7 +149,7 @@ private UberspectHolder() {}
* The {@link Parser}; when parsing expressions, this engine uses the parser if it
* is not already in use otherwise it will create a new temporary one.
*/
protected final Parser parser = new Parser(";"); //$NON-NLS-1$
protected final Parser parser = new Parser(new StringProvider(";")); //$NON-NLS-1$
/**
* The expression max length to hit the cache.
*/
@@ -872,7 +873,7 @@ protected ASTJexlScript parse(final JexlInfo info, final JexlFeatures parsingf,
}
} else {
// ...otherwise parser was in use, create a new temporary one
final Parser lparser = new Parser(";");
final Parser lparser = new Parser(new StringProvider(";"));
script = lparser.parse(ninfo, features, src, scope);
}
if (source != null) {
@@ -19,7 +19,7 @@
options
{
MULTI=true;
//STATIC=false;
STATIC=false;
JAVA_TEMPLATE_TYPE="modern";
VISITOR=true;
NODE_SCOPE_HOOK=true;
@@ -454,16 +454,22 @@ Object pragmaValue() #void :
{
Token v;
LinkedList<String> lstr = new LinkedList<String>();
Object result;
}
{
LOOKAHEAD(1) v=<INTEGER_LITERAL> { return NumberParser.parseInteger(v.image); }
| LOOKAHEAD(1) v=<FLOAT_LITERAL> { return NumberParser.parseDouble(v.image); }
| LOOKAHEAD(1) v=<STRING_LITERAL> { return Parser.buildString(v.image, true); }
| LOOKAHEAD(1) pragmaKey(lstr) { return stringify(lstr); }
| LOOKAHEAD(1) <TRUE> { return true; }
| LOOKAHEAD(1) <FALSE> { return false; }
| LOOKAHEAD(1) <NULL> { return null; }
| LOOKAHEAD(1) <NAN_LITERAL> { return Double.NaN; }
(
LOOKAHEAD(1) v=<INTEGER_LITERAL> { result = NumberParser.parseInteger(v.image); }
| LOOKAHEAD(1) v=<FLOAT_LITERAL> { result = NumberParser.parseDouble(v.image); }
| LOOKAHEAD(1) v=<STRING_LITERAL> { result = Parser.buildString(v.image, true); }
| LOOKAHEAD(1) pragmaKey(lstr) { result = stringify(lstr); }
| LOOKAHEAD(1) <TRUE> { result = true; }
| LOOKAHEAD(1) <FALSE> { result = false; }
| LOOKAHEAD(1) <NULL> { result = null; }
| LOOKAHEAD(1) <NAN_LITERAL> { result = Double.NaN; }
)
{
return result;
}
}


0 comments on commit 3265f5d

Please sign in to comment.