-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JEXL-404 : add syntax for safe array access ( ?[..] );
- update interpreter and debugger; - add test; - update syntax reference, release notes, changes;
- Loading branch information
Henri Biestro
committed
Aug 30, 2023
1 parent
c64ee0d
commit 589b088
Showing
8 changed files
with
143 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/org/apache/commons/jexl3/parser/ASTArrayAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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; | ||
|
||
/** | ||
* Array access supporting (optional) safe notation. | ||
*/ | ||
public class ASTArrayAccess extends JexlLexicalNode { | ||
private static final long serialVersionUID = 1L; | ||
/** Which children are accessed using a safe notation. | ||
* Note that this does not really work after the 64th child. | ||
* However, an expression like 'a?[b]?[c]?...?[b0]' with 64 terms is very unlikely | ||
* to occur in real life and a bad idea anyhow. | ||
*/ | ||
private long safe = 0; | ||
|
||
public ASTArrayAccess(final int id) { | ||
super(id); | ||
} | ||
|
||
public ASTArrayAccess(final Parser p, final int id) { | ||
super(p, id); | ||
} | ||
|
||
void setSafe(long s) { | ||
this.safe = s; | ||
} | ||
|
||
public boolean isSafeChild(int c) { | ||
return (safe & (1L << c)) != 0; | ||
} | ||
|
||
@Override | ||
public Object jjtAccept(final ParserVisitor visitor, final Object data) { | ||
return visitor.visit(this, data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters