Skip to content
Permalink
Browse files
JEXL-369: add fat-arrow to syntax
  • Loading branch information
henrib committed May 3, 2022
1 parent 0f33df9 commit 55aad5181d1dd5201ce0cb76cce0147d73215aef
Showing 2 changed files with 37 additions and 2 deletions.
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.jexl3.parser;

/**
* Declares a local variable.
*/
public class ASTLet extends ASTIdentifier {
public ASTLet(final int id) {
super(id);
}

public ASTLet(final Parser p, final int id) {
super(p, id);
}

@Override
public Object jjtAccept(final ParserVisitor visitor, final Object data) {
return visitor.visit(this, data);
}
}
@@ -382,7 +382,7 @@ private boolean declareSymbol(final int symbol) {
* @param variable the identifier used to declare
* @param token the variable name toekn
*/
protected void declareVariable(final ASTVar variable, final Token token) {
protected void declareVariable(final ASTVar variable, final Token token, boolean lexical) {
final String name = token.image;
if (!allowVariable(name)) {
throwFeatureException(JexlFeatures.LOCAL_VAR, token);
@@ -397,7 +397,7 @@ protected void declareVariable(final ASTVar variable, final Token token) {
}
// lexical feature error
if (!declareSymbol(symbol)) {
if (getFeatures().isLexical()) {
if (lexical || getFeatures().isLexical()) {
throw new JexlException(variable, name + ": variable is already declared");
}
variable.setRedefined(true);

0 comments on commit 55aad51

Please sign in to comment.