You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by je...@apache.org on 2018/05/02 21:56:30 UTC
[sling-whiteboard] branch master updated: restructured to utilize
impl
This is an automated email from the ASF dual-hosted git repository.
jeb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 15cb9e9 restructured to utilize impl
15cb9e9 is described below
commit 15cb9e9775db4b8c852279b78d3140177145a3bd
Author: Jason E Bailey <je...@apache.org>
AuthorDate: Wed May 2 17:55:56 2018 -0400
restructured to utilize impl
---
.../sling/resource/stream/ResourceFilter.java | 30 +-
.../sling/resource/stream/ResourceStream.java | 2 +-
.../apache/sling/resource/stream/api/Context.java | 44 +
.../FilterFunction.java} | 12 +-
.../resource/stream/{parser => }/api/Visitor.java | 4 +-
.../stream/api/impl/ComparisonVisitor.java | 110 ++
.../resource/stream/api/impl/DefaultContext.java | 97 ++
.../{parser => api}/impl/InstantProvider.java | 46 +-
.../{parser/visitor => api/impl}/LogicVisitor.java | 25 +-
.../stream/{parser => impl}/FilterParser.java | 27 +-
.../{parser => impl}/FilterParserConstants.java | 96 +-
.../{parser => impl}/FilterParserTokenManager.java | 1229 +++++++++++---------
.../stream/{parser => impl}/ParseException.java | 374 +++---
.../stream/{parser => impl}/SimpleCharStream.java | 942 +++++++--------
.../resource/stream/{parser => impl}/Token.java | 262 ++---
.../stream/{parser => impl}/TokenMgrError.java | 294 ++---
.../stream/{parser => impl}/node/Node.java | 4 +-
.../predicates/ComparisonPredicateFactory.java | 4 +-
.../predicates/ComparisonPredicates.java | 2 +-
.../stream/{parser => impl}/predicates/Null.java | 2 +-
.../apache/sling/resource/stream/parser/README.txt | 2 -
.../stream/parser/visitor/ComparisonVisitor.java | 108 --
streams/src/main/javacc/resourceFilter.jj | 23 +-
.../resource/stream/ResourceFilterDateTest.java | 18 +-
.../resource/stream/ResourceFilterLogicTest.java | 2 +-
.../sling/resource/stream/ResourceFilterTest.java | 9 +-
26 files changed, 2030 insertions(+), 1738 deletions(-)
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/ResourceFilter.java b/streams/src/main/java/org/apache/sling/resource/stream/ResourceFilter.java
index 14f552c..937c269 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/ResourceFilter.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/ResourceFilter.java
@@ -17,18 +17,23 @@ import java.io.ByteArrayInputStream;
import java.util.function.Predicate;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.FilterParser;
-import org.apache.sling.resource.stream.parser.ParseException;
-import org.apache.sling.resource.stream.parser.node.Node;
-import org.apache.sling.resource.stream.parser.visitor.LogicVisitor;
+import org.apache.sling.resource.stream.api.Context;
+import org.apache.sling.resource.stream.api.impl.ComparisonVisitor;
+import org.apache.sling.resource.stream.api.impl.DefaultContext;
+import org.apache.sling.resource.stream.api.impl.LogicVisitor;
+import org.apache.sling.resource.stream.impl.FilterParser;
+import org.apache.sling.resource.stream.impl.ParseException;
+import org.apache.sling.resource.stream.impl.node.Node;
public class ResourceFilter implements Predicate<Resource> {
private Predicate<Resource> parsedPredicate;
+ private Context context;
+
public ResourceFilter(String filter) throws ParseException {
- Node rootNode =new FilterParser(new ByteArrayInputStream(filter.getBytes())).parse();
- this.parsedPredicate = rootNode.accept(new LogicVisitor());
+ Node rootNode = new FilterParser(new ByteArrayInputStream(filter.getBytes())).parse();
+ this.parsedPredicate = rootNode.accept(getContext().getLogicVisitor());
}
@Override
@@ -36,4 +41,17 @@ public class ResourceFilter implements Predicate<Resource> {
return parsedPredicate.test(resource);
}
+ public Context getContext() {
+ if (context == null) {
+ context = new DefaultContext();
+ new LogicVisitor(context);
+ new ComparisonVisitor(context);
+ }
+ return context;
+ }
+
+ public void setContext(Context context) {
+ this.context = context;
+ }
+
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/ResourceStream.java b/streams/src/main/java/org/apache/sling/resource/stream/ResourceStream.java
index c9710f9..dd554cc 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/ResourceStream.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/ResourceStream.java
@@ -27,7 +27,7 @@ import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.ParseException;
+import org.apache.sling.resource.stream.impl.ParseException;
/**
* Utility to create a Stream<Resource> of Resource objects from a managed
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/Context.java b/streams/src/main/java/org/apache/sling/resource/stream/api/Context.java
new file mode 100644
index 0000000..984dc91
--- /dev/null
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/Context.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed 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.sling.resource.stream.api;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import org.apache.sling.api.resource.Resource;
+
+public interface Context {
+
+ Context addFunction(String name, BiFunction<List<Function<Resource, Object>>, Resource, Object> function);
+
+ Context removeFunction(String name);
+
+ Context addArgument(String name, Object object);
+
+ Visitor<Predicate<Resource>> getLogicVisitor();
+
+ Visitor<Function<Resource, Object>> getComparisonVisitor();
+
+ void setLogicVisitor(Visitor<Predicate<Resource>> logicVisitor);
+
+ void setComparionVisitor(Visitor<Function<Resource, Object>> comparisonVisitor);
+
+ Optional<BiFunction<List<Function<Resource, Object>>, Resource, Object>> getFunction(String text);
+
+ Optional<Object> getArgument(String text);
+
+}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/api/ResourceFilterFunction.java b/streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java
similarity index 70%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/api/ResourceFilterFunction.java
rename to streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java
index d614cbc..5be5863 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/api/ResourceFilterFunction.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java
@@ -11,9 +11,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.api;
+package org.apache.sling.resource.stream.api;
import java.util.List;
+import java.util.function.BiFunction;
import java.util.function.Function;
import org.apache.sling.api.resource.Resource;
@@ -24,19 +25,18 @@ import org.apache.sling.api.resource.Resource;
* Comparison
*
*/
-public interface ResourceFilterFunction {
+public interface FilterFunction extends BiFunction<List<Function<Resource, Object>>, Resource, Object> {
/**
- * This method returns a {@code Function} which accepts the resource being
- * tested and returns an Object to be used as part of a comparison.
+ * This method returns a {@code Object} to be used as part of a comparison.
*
* @param arguments
* A list of {@code Function}'s which provides the arguments defined
* in the script, to obtain the arguments, each argument must be
* called
- * @return A {@code Function} which will provide a String, Instant, or Number to
+ * @return A {@code Object} which should be a String, Instant, or Number to
* be used as part of a comparison or Function
*/
- Function<Resource, Object> provision(List<Function<Resource, Object>> arguments);
+ Object apply(List<Function<Resource, Object>> arguments, Resource resource);
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/api/Visitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
similarity index 85%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/api/Visitor.java
rename to streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
index 4a9c5d3..c7e439f 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/api/Visitor.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
@@ -11,9 +11,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.api;
+package org.apache.sling.resource.stream.api;
-import org.apache.sling.resource.stream.parser.node.Node;
+import org.apache.sling.resource.stream.impl.node.Node;
/**
* An interface for visiting AST nodes of the RSQL.
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ComparisonVisitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ComparisonVisitor.java
new file mode 100644
index 0000000..3ef85ff
--- /dev/null
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ComparisonVisitor.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed 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.sling.resource.stream.api.impl;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.resource.stream.api.Context;
+import org.apache.sling.resource.stream.api.Visitor;
+import org.apache.sling.resource.stream.impl.FilterParserConstants;
+import org.apache.sling.resource.stream.impl.node.Node;
+import org.apache.sling.resource.stream.impl.predicates.Null;
+
+public class ComparisonVisitor implements Visitor<Function<Resource, Object>> {
+
+ private Context context;
+
+ public ComparisonVisitor(Context context) {
+ this.context = context;
+ context.setComparionVisitor(this);
+ }
+
+ @Override
+ public Function<Resource, Object> visit(Node node) {
+ switch (node.kind) {
+ case FilterParserConstants.FUNCTION_NAME:
+ // will only get here in the case of the 'FUNCTION' switch case
+ switch (node.text) {
+ case "name":
+ return Resource::getName;
+ case "path":
+ return Resource::getPath;
+ default:
+ Optional<BiFunction<List<Function<Resource, Object>>, Resource, Object>> temp = context.getFunction(node.text);
+ if (temp.isPresent()) {
+ final List<Function<Resource, Object>> arguments = node.visitChildren(this);
+ return resource -> temp.get().apply(arguments, resource);
+ }
+ }
+ break;
+ case FilterParserConstants.NULL:
+ return resource -> new Null();
+ case FilterParserConstants.NUMBER:
+ Number numericValue = null; {
+ String numberText = node.text;
+ try {
+ numericValue = Integer.valueOf(numberText);
+ } catch (NumberFormatException nfe1) {
+ try {
+ numericValue = new BigDecimal(numberText);
+ } catch (NumberFormatException nfe2) {
+ // swallow
+ }
+ }
+ }
+ final Number numericReply = numericValue;
+ return resource -> numericReply;
+ case FilterParserConstants.OFFSETDATETIME:
+ return resource -> OffsetDateTime.parse(node.text).toInstant();
+ case FilterParserConstants.DATETIME:
+ return resource -> LocalDateTime.parse(node.text).atOffset(ZoneOffset.UTC).toInstant();
+ case FilterParserConstants.DATE:
+ return resource -> LocalDate.parse(node.text).atStartOfDay(ZoneOffset.UTC).toInstant();
+ case FilterParserConstants.PROPERTY:
+ return resource -> {
+ Object value = valueMapOf(resource).get(node.text);
+ if (value instanceof Boolean) {
+ return value.toString();
+ }
+ if (value instanceof Calendar) {
+ return ((Calendar) value).toInstant();
+ }
+ return value;
+ };
+ default:
+ return resource -> node.text;
+ }
+ return null;
+ }
+
+ private ValueMap valueMapOf(Resource resource) {
+ if (resource == null || ResourceUtil.isNonExistingResource(resource)) {
+ return ValueMap.EMPTY;
+ }
+ return resource.adaptTo(ValueMap.class);
+ }
+
+}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/impl/DefaultContext.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/DefaultContext.java
new file mode 100644
index 0000000..74dd85b
--- /dev/null
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/DefaultContext.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed 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.sling.resource.stream.api.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.resource.stream.api.Context;
+import org.apache.sling.resource.stream.api.Visitor;
+
+public class DefaultContext implements Context {
+
+ private Map<String, BiFunction<List<Function<Resource, Object>>, Resource, Object>> functions = new HashMap<>();
+
+ private Map<String, Object> arguments = new HashMap<>();
+
+ private Visitor<Predicate<Resource>> logicVisitor;
+
+ private Visitor<Function<Resource, Object>> comparisonVisitor;
+
+ {
+ functions.put("date", new InstantProvider());
+ }
+
+ public DefaultContext() {
+ }
+
+ @Override
+ public Context addFunction(String name, BiFunction<List<Function<Resource, Object>>, Resource, Object> function) {
+ functions.put(name, function);
+ return this;
+ }
+
+ @Override
+ public Context removeFunction(String name) {
+ functions.remove(name);
+ return this;
+ }
+
+ @Override
+ public Context addArgument(String name, Object object) {
+ arguments.put(name, object);
+ return this;
+ }
+
+ @Override
+ public Visitor<Predicate<Resource>> getLogicVisitor() {
+ return logicVisitor;
+ }
+
+ @Override
+ public Visitor<Function<Resource, Object>> getComparisonVisitor() {
+ return comparisonVisitor;
+ }
+
+ @Override
+ public void setLogicVisitor(Visitor<Predicate<Resource>> logicVisitor) {
+ this.logicVisitor = logicVisitor;
+
+ }
+
+ @Override
+ public void setComparionVisitor(Visitor<Function<Resource, Object>> comparisonVisitor) {
+ this.comparisonVisitor = comparisonVisitor;
+
+ }
+
+ @Override
+ public Optional<BiFunction<List<Function<Resource, Object>>, Resource, Object> > getFunction(String text) {
+ return Optional.ofNullable(functions.get(text));
+ }
+
+ @Override
+ public Optional<Object> getArgument(String text) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/impl/InstantProvider.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
similarity index 53%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/impl/InstantProvider.java
rename to streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
index 4d97a43..61c4a9c 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/impl/InstantProvider.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.impl;
+package org.apache.sling.resource.stream.api.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -22,12 +22,13 @@ import java.util.List;
import java.util.function.Function;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.api.ResourceFilterFunction;
+import org.apache.sling.resource.stream.api.FilterFunction;
/**
- * Implementation of {@link ResourceFilterFunction} for the 'date' function.
+ * Implementation of {@link FilterFunction} for the 'date' function.
*
* The following combination of arguments are supported
+ *
* <pre>
* arguments results
* ======================================================
@@ -38,29 +39,26 @@ import org.apache.sling.resource.stream.parser.api.ResourceFilterFunction;
* </pre>
*
*/
-public class InstantProvider implements ResourceFilterFunction {
+public class InstantProvider implements FilterFunction {
@Override
- public Function<Resource, Object> provision(List<Function<Resource, Object>> arguments) {
-
- return resource -> {
- if (arguments.isEmpty()) {
- return Instant.now();
- }
- String dateString = arguments.get(0).apply(resource).toString();
- String formatString = null;
- if (arguments.size() > 1) {
- formatString = arguments.get(1).apply(resource).toString();
- SimpleDateFormat dateFormat = new SimpleDateFormat(formatString);
- try {
- return Instant.ofEpochMilli(dateFormat.parse(dateString).getTime());
- } catch (ParseException e) {
- return null;
- }
- } else {
- return DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(dateString, OffsetDateTime::from).toInstant();
+ public Object apply(List<Function<Resource, Object>> arguments, Resource resource) {
+ if (arguments.isEmpty()) {
+ return Instant.now();
+ }
+ String dateString = arguments.get(0).apply(resource).toString();
+ String formatString = null;
+ if (arguments.size() > 1) {
+ formatString = arguments.get(1).apply(resource).toString();
+ SimpleDateFormat dateFormat = new SimpleDateFormat(formatString);
+ try {
+ return Instant.ofEpochMilli(dateFormat.parse(dateString).getTime());
+ } catch (ParseException e) {
+ return null;
}
- };
- }
+ } else {
+ return DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(dateString, OffsetDateTime::from).toInstant();
+ }
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/LogicVisitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
similarity index 77%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/LogicVisitor.java
rename to streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
index d8f4829..fc42a4f 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/LogicVisitor.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
@@ -11,16 +11,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.visitor;
+package org.apache.sling.resource.stream.api.impl;
import java.util.function.Function;
import java.util.function.Predicate;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.FilterParserConstants;
-import org.apache.sling.resource.stream.parser.api.Visitor;
-import org.apache.sling.resource.stream.parser.node.Node;
-import org.apache.sling.resource.stream.parser.predicates.ComparisonPredicateFactory;
+import org.apache.sling.resource.stream.api.Context;
+import org.apache.sling.resource.stream.api.Visitor;
+import org.apache.sling.resource.stream.impl.FilterParserConstants;
+import org.apache.sling.resource.stream.impl.node.Node;
+import org.apache.sling.resource.stream.impl.predicates.ComparisonPredicateFactory;
/**
* Visitor implementation that handles the high level handling of logic between
@@ -32,7 +33,12 @@ import org.apache.sling.resource.stream.parser.predicates.ComparisonPredicateFac
*/
public class LogicVisitor implements Visitor<Predicate<Resource>> {
- private ComparisonVisitor valueVisitor = new ComparisonVisitor();
+ private Context context;
+
+ public LogicVisitor(Context context) {
+ this.context = context;
+ context.setLogicVisitor(this);
+ }
@Override
public Predicate<Resource> visit(Node node) {
@@ -76,13 +82,10 @@ public class LogicVisitor implements Visitor<Predicate<Resource>> {
}
private Predicate<Resource> createComparisonPredicate(Node comparisonNode) {
- Function<Resource, Object> leftValue = comparisonNode.leftNode.accept(valueVisitor);
- Function<Resource, Object> rightValue = comparisonNode.rightNode.accept(valueVisitor);
+ Function<Resource, Object> leftValue = comparisonNode.leftNode.accept(context.getComparisonVisitor());
+ Function<Resource, Object> rightValue = comparisonNode.rightNode.accept(context.getComparisonVisitor());
return ComparisonPredicateFactory.toPredicate(comparisonNode.kind, leftValue, rightValue);
}
- public ComparisonVisitor getValueVisitor() {
- return valueVisitor;
- }
}
\ No newline at end of file
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParser.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
similarity index 94%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParser.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
index 5acb26d..597ac1d 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParser.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
@@ -1,8 +1,9 @@
/* Generated By:JavaCC: Do not edit this line. FilterParser.java */
-package org.apache.sling.resource.stream.parser;
+package org.apache.sling.resource.stream.impl;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.sling.resource.stream.parser.node.*;
+import org.apache.sling.resource.stream.impl.node.*;
public final class FilterParser implements FilterParserConstants {
@@ -66,6 +67,8 @@ public final class FilterParser implements FilterParserConstants {
case LPAREN:
node = group();
break;
+ case OFFSETDATETIME:
+ case DATETIME:
case DATE:
case NUMBER:
case STRING:
@@ -161,6 +164,8 @@ public final class FilterParser implements FilterParserConstants {
Object value = new ArrayList();
jj_consume_token(LPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OFFSETDATETIME:
+ case DATETIME:
case DATE:
case NUMBER:
case STRING:
@@ -205,6 +210,8 @@ public final class FilterParser implements FilterParserConstants {
final public Node argument() throws ParseException {
Node selector = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OFFSETDATETIME:
+ case DATETIME:
case DATE:
case NUMBER:
case STRING:
@@ -234,6 +241,8 @@ public final class FilterParser implements FilterParserConstants {
functionName = token.image;
jj_consume_token(LPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OFFSETDATETIME:
+ case DATETIME:
case DATE:
case NUMBER:
case STRING:
@@ -269,6 +278,12 @@ public final class FilterParser implements FilterParserConstants {
case DATE:
jj_consume_token(DATE);
break;
+ case DATETIME:
+ jj_consume_token(DATETIME);
+ break;
+ case OFFSETDATETIME:
+ jj_consume_token(OFFSETDATETIME);
+ break;
default:
jj_la1[8] = jj_gen;
jj_consume_token(-1);
@@ -301,10 +316,10 @@ public final class FilterParser implements FilterParserConstants {
jj_la1_init_1();
}
private static void jj_la1_init_0() {
- jj_la1_0 = new int[] {0x40000,0x20000,0x984300,0xff000000,0x884300,0x400000,0x884300,0x884300,0x884300,};
+ jj_la1_0 = new int[] {0x400000,0x200000,0x9843c00,0xf0000000,0x8843c00,0x4000000,0x8843c00,0x8843c00,0x8843c00,};
}
private static void jj_la1_init_1() {
- jj_la1_1 = new int[] {0x0,0x0,0xc0,0x3f,0xc0,0x0,0xc0,0xc0,0x0,};
+ jj_la1_1 = new int[] {0x0,0x0,0xc00,0x3ff,0xc00,0x0,0xc00,0xc00,0x0,};
}
/** Constructor with InputStream. */
@@ -421,7 +436,7 @@ public final class FilterParser implements FilterParserConstants {
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
- boolean[] la1tokens = new boolean[41];
+ boolean[] la1tokens = new boolean[45];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
@@ -438,7 +453,7 @@ public final class FilterParser implements FilterParserConstants {
}
}
}
- for (int i = 0; i < 41; i++) {
+ for (int i = 0; i < 45; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserConstants.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
similarity index 65%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserConstants.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
index eb4724e..6147449 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserConstants.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. FilterParserConstants.java */
-package org.apache.sling.resource.stream.parser;
+package org.apache.sling.resource.stream.impl;
/**
@@ -11,81 +11,89 @@ public interface FilterParserConstants {
/** End of File. */
int EOF = 0;
/** RegularExpression Id. */
- int DOT = 3;
+ int PLUS = 3;
/** RegularExpression Id. */
- int PLUS = 4;
+ int MINUS = 4;
/** RegularExpression Id. */
- int MINUS = 5;
+ int DIGIT = 5;
/** RegularExpression Id. */
- int DIGIT = 6;
+ int EXP = 6;
/** RegularExpression Id. */
- int EXP = 7;
+ int OFFSET = 7;
/** RegularExpression Id. */
- int DATE = 8;
+ int YYYYMMDD = 8;
/** RegularExpression Id. */
- int NUMBER = 9;
+ int TIME = 9;
/** RegularExpression Id. */
- int INTEGER = 10;
+ int OFFSETDATETIME = 10;
/** RegularExpression Id. */
- int FRACTIONAL_DIGITS = 11;
+ int DATETIME = 11;
/** RegularExpression Id. */
- int EXPONENT = 12;
+ int DATE = 12;
/** RegularExpression Id. */
- int DIGITS = 13;
+ int NUMBER = 13;
/** RegularExpression Id. */
- int STRING = 14;
+ int INTEGER = 14;
/** RegularExpression Id. */
- int SQUOTE = 15;
+ int FRACTIONAL_DIGITS = 15;
/** RegularExpression Id. */
- int DQUOTE = 16;
+ int EXPONENT = 16;
/** RegularExpression Id. */
- int AND = 17;
+ int DIGITS = 17;
/** RegularExpression Id. */
- int OR = 18;
+ int STRING = 18;
/** RegularExpression Id. */
- int NULL = 19;
+ int SQUOTE = 19;
/** RegularExpression Id. */
- int LPAREN = 20;
+ int DQUOTE = 20;
/** RegularExpression Id. */
- int RPAREN = 21;
+ int AND = 21;
/** RegularExpression Id. */
- int COMMA = 22;
+ int OR = 22;
/** RegularExpression Id. */
- int BOOLEAN = 23;
+ int NULL = 23;
/** RegularExpression Id. */
- int EQUAL = 24;
+ int LPAREN = 24;
/** RegularExpression Id. */
- int NOT_EQUAL = 25;
+ int RPAREN = 25;
/** RegularExpression Id. */
- int GREATER_THAN = 26;
+ int COMMA = 26;
/** RegularExpression Id. */
- int GREATER_THAN_OR_EQUAL = 27;
+ int BOOLEAN = 27;
/** RegularExpression Id. */
- int LESS_THAN = 28;
+ int EQUAL = 28;
/** RegularExpression Id. */
- int LESS_THAN_OR_EQUAL = 29;
+ int NOT_EQUAL = 29;
/** RegularExpression Id. */
- int LIKE = 30;
+ int GREATER_THAN = 30;
/** RegularExpression Id. */
- int LIKE_NOT = 31;
+ int GREATER_THAN_OR_EQUAL = 31;
/** RegularExpression Id. */
- int CONTAINS = 32;
+ int LESS_THAN = 32;
/** RegularExpression Id. */
- int CONTAINS_NOT = 33;
+ int LESS_THAN_OR_EQUAL = 33;
/** RegularExpression Id. */
- int CONTAINS_ANY = 34;
+ int LIKE = 34;
/** RegularExpression Id. */
- int CONTAINS_NOT_ANY = 35;
+ int LIKE_NOT = 35;
/** RegularExpression Id. */
- int IN = 36;
+ int CONTAINS = 36;
/** RegularExpression Id. */
- int NOT_IN = 37;
+ int CONTAINS_NOT = 37;
/** RegularExpression Id. */
- int FUNCTION_NAME = 38;
+ int CONTAINS_ANY = 38;
/** RegularExpression Id. */
- int PROPERTY = 39;
+ int CONTAINS_NOT_ANY = 39;
/** RegularExpression Id. */
- int UNKNOWN = 40;
+ int IN = 40;
+ /** RegularExpression Id. */
+ int NOT_IN = 41;
+ /** RegularExpression Id. */
+ int FUNCTION_NAME = 42;
+ /** RegularExpression Id. */
+ int PROPERTY = 43;
+ /** RegularExpression Id. */
+ int UNKNOWN = 44;
/** Lexical state. */
int DEFAULT = 0;
@@ -95,11 +103,15 @@ public interface FilterParserConstants {
"<EOF>",
"\" \"",
"\"\\t\"",
- "\".\"",
"\"+\"",
"\"-\"",
"<DIGIT>",
"<EXP>",
+ "<OFFSET>",
+ "<YYYYMMDD>",
+ "<TIME>",
+ "<OFFSETDATETIME>",
+ "<DATETIME>",
"<DATE>",
"<NUMBER>",
"<INTEGER>",
@@ -111,7 +123,7 @@ public interface FilterParserConstants {
"<DQUOTE>",
"<AND>",
"<OR>",
- "\" null\"",
+ "\"null\"",
"\"(\"",
"\")\"",
"\",\"",
@@ -122,7 +134,7 @@ public interface FilterParserConstants {
"\">=\"",
"<LESS_THAN>",
"\"<=\"",
- "\"like\"",
+ "<LIKE>",
"<LIKE_NOT>",
"\"contains\"",
"\"contains not\"",
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserTokenManager.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
similarity index 64%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserTokenManager.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
index ddfd594..e607f97 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/FilterParserTokenManager.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
@@ -1,8 +1,8 @@
/* Generated By:JavaCC: Do not edit this line. FilterParserTokenManager.java */
-package org.apache.sling.resource.stream.parser;
+package org.apache.sling.resource.stream.impl;
import java.util.ArrayList;
import java.util.List;
-import org.apache.sling.resource.stream.parser.node.*;
+import org.apache.sling.resource.stream.impl.node.*;
/** Token Manager. */
public class FilterParserTokenManager implements FilterParserConstants
@@ -17,163 +17,146 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0)
switch (pos)
{
case 0:
- if ((active0 & 0x4L) != 0L)
- return 58;
- if ((active0 & 0x1000000000L) != 0L)
+ if ((active0 & 0x200000000L) != 0L)
{
- jjmatchedKind = 38;
- return 119;
+ jjmatchedKind = 32;
+ return -1;
}
- if ((active0 & 0xf00000000L) != 0L)
+ if ((active0 & 0x10000000000L) != 0L)
{
- jjmatchedKind = 38;
- return 58;
+ jjmatchedKind = 42;
+ return 168;
}
- if ((active0 & 0x40000000L) != 0L)
+ if ((active0 & 0x20000800000L) != 0L)
{
- jjmatchedKind = 38;
- return 133;
+ jjmatchedKind = 42;
+ return 58;
}
- if ((active0 & 0x8000000L) != 0L)
+ if ((active0 & 0xf000000000L) != 0L)
{
- jjmatchedKind = 26;
- return -1;
+ jjmatchedKind = 42;
+ return 60;
}
- if ((active0 & 0x20000000L) != 0L)
+ if ((active0 & 0x4L) != 0L)
+ return 60;
+ if ((active0 & 0x80000000L) != 0L)
{
- jjmatchedKind = 28;
+ jjmatchedKind = 30;
return -1;
}
- if ((active0 & 0x2000000000L) != 0L)
- {
- jjmatchedKind = 38;
- return 56;
- }
return -1;
case 1:
- if ((active0 & 0x1000000000L) != 0L)
- return 58;
- if ((active0 & 0x40000000L) != 0L)
- {
- jjmatchedKind = 38;
- jjmatchedPos = 1;
- return 139;
- }
- if ((active0 & 0x8000000L) != 0L)
+ if ((active0 & 0x200000000L) != 0L)
{
if (jjmatchedPos == 0)
{
- jjmatchedKind = 26;
+ jjmatchedKind = 32;
jjmatchedPos = 0;
}
return -1;
}
- if ((active0 & 0x2000000000L) != 0L)
- {
- jjmatchedKind = 38;
- jjmatchedPos = 1;
- return 55;
- }
- if ((active0 & 0xf00000000L) != 0L)
+ if ((active0 & 0x20000000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 1;
- return 58;
+ return 57;
}
- if ((active0 & 0x20000000L) != 0L)
+ if ((active0 & 0x10000000000L) != 0L)
+ return 60;
+ if ((active0 & 0x80000000L) != 0L)
{
if (jjmatchedPos == 0)
{
- jjmatchedKind = 28;
+ jjmatchedKind = 30;
jjmatchedPos = 0;
}
return -1;
}
- return -1;
- case 2:
- if ((active0 & 0x40000000L) != 0L)
+ if ((active0 & 0xf000800000L) != 0L)
{
- jjmatchedKind = 38;
- jjmatchedPos = 2;
- return 138;
+ jjmatchedKind = 42;
+ jjmatchedPos = 1;
+ return 60;
}
- if ((active0 & 0x2000000000L) != 0L)
+ return -1;
+ case 2:
+ if ((active0 & 0xf000800000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 2;
- return 54;
+ return 60;
}
- if ((active0 & 0xf00000000L) != 0L)
+ if ((active0 & 0x20000000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 2;
- return 58;
+ return 56;
}
return -1;
case 3:
- if ((active0 & 0x40000000L) != 0L)
- return 137;
- if ((active0 & 0x2000000000L) != 0L)
+ if ((active0 & 0xf000000000L) != 0L)
+ {
+ jjmatchedKind = 42;
+ jjmatchedPos = 3;
+ return 60;
+ }
+ if ((active0 & 0x800000L) != 0L)
+ return 60;
+ if ((active0 & 0x20000000000L) != 0L)
{
if (jjmatchedPos < 2)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 2;
}
- return 53;
- }
- if ((active0 & 0xf00000000L) != 0L)
- {
- jjmatchedKind = 38;
- jjmatchedPos = 3;
- return 58;
+ return 55;
}
return -1;
case 4:
- if ((active0 & 0x2000000000L) != 0L)
+ if ((active0 & 0x20000000000L) != 0L)
{
if (jjmatchedPos < 2)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 2;
}
return -1;
}
- if ((active0 & 0xf00000000L) != 0L)
+ if ((active0 & 0xf000000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 4;
- return 58;
+ return 60;
}
return -1;
case 5:
- if ((active0 & 0x2000000000L) != 0L)
+ if ((active0 & 0xf000000000L) != 0L)
+ {
+ jjmatchedKind = 42;
+ jjmatchedPos = 5;
+ return 60;
+ }
+ if ((active0 & 0x20000000000L) != 0L)
{
if (jjmatchedPos < 2)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 2;
}
return -1;
}
- if ((active0 & 0xf00000000L) != 0L)
- {
- jjmatchedKind = 38;
- jjmatchedPos = 5;
- return 58;
- }
return -1;
case 6:
- if ((active0 & 0xf00000000L) != 0L)
+ if ((active0 & 0xf000000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 42;
jjmatchedPos = 6;
- return 58;
+ return 60;
}
return -1;
case 7:
- if ((active0 & 0xf00000000L) != 0L)
- return 58;
+ if ((active0 & 0xf000000000L) != 0L)
+ return 60;
return -1;
default :
return -1;
@@ -194,28 +177,23 @@ private int jjMoveStringLiteralDfa0_0()
switch(curChar)
{
case 9:
- return jjStartNfaWithStates_0(0, 2, 58);
- case 32:
- jjmatchedKind = 1;
- return jjMoveStringLiteralDfa1_0(0x80000L);
+ return jjStartNfaWithStates_0(0, 2, 60);
case 40:
- return jjStopAtPos(0, 20);
+ return jjStopAtPos(0, 24);
case 41:
- return jjStopAtPos(0, 21);
+ return jjStopAtPos(0, 25);
case 44:
- return jjStopAtPos(0, 22);
+ return jjStopAtPos(0, 26);
case 60:
- return jjMoveStringLiteralDfa1_0(0x20000000L);
+ return jjMoveStringLiteralDfa1_0(0x200000000L);
case 62:
- return jjMoveStringLiteralDfa1_0(0x8000000L);
+ return jjMoveStringLiteralDfa1_0(0x80000000L);
case 99:
- return jjMoveStringLiteralDfa1_0(0xf00000000L);
+ return jjMoveStringLiteralDfa1_0(0xf000000000L);
case 105:
- return jjMoveStringLiteralDfa1_0(0x1000000000L);
- case 108:
- return jjMoveStringLiteralDfa1_0(0x40000000L);
+ return jjMoveStringLiteralDfa1_0(0x10000000000L);
case 110:
- return jjMoveStringLiteralDfa1_0(0x2000000000L);
+ return jjMoveStringLiteralDfa1_0(0x20000800000L);
default :
return jjMoveNfa_0(0, 0);
}
@@ -230,19 +208,19 @@ private int jjMoveStringLiteralDfa1_0(long active0)
switch(curChar)
{
case 61:
- if ((active0 & 0x8000000L) != 0L)
- return jjStopAtPos(1, 27);
- else if ((active0 & 0x20000000L) != 0L)
- return jjStopAtPos(1, 29);
+ if ((active0 & 0x80000000L) != 0L)
+ return jjStopAtPos(1, 31);
+ else if ((active0 & 0x200000000L) != 0L)
+ return jjStopAtPos(1, 33);
break;
- case 105:
- return jjMoveStringLiteralDfa2_0(active0, 0x40000000L);
case 110:
- if ((active0 & 0x1000000000L) != 0L)
- return jjStartNfaWithStates_0(1, 36, 58);
- return jjMoveStringLiteralDfa2_0(active0, 0x80000L);
+ if ((active0 & 0x10000000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 40, 60);
+ break;
case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x2f00000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x2f000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
default :
break;
}
@@ -259,14 +237,12 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0)
}
switch(curChar)
{
- case 107:
- return jjMoveStringLiteralDfa3_0(active0, 0x40000000L);
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000L);
case 110:
- return jjMoveStringLiteralDfa3_0(active0, 0xf00000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0xf000000000L);
case 116:
- return jjMoveStringLiteralDfa3_0(active0, 0x2000000000L);
- case 117:
- return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L);
default :
break;
}
@@ -284,15 +260,13 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0)
switch(curChar)
{
case 32:
- return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L);
- case 101:
- if ((active0 & 0x40000000L) != 0L)
- return jjStartNfaWithStates_0(3, 30, 137);
- break;
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L);
case 108:
- return jjMoveStringLiteralDfa4_0(active0, 0x80000L);
+ if ((active0 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(3, 23, 60);
+ break;
case 116:
- return jjMoveStringLiteralDfa4_0(active0, 0xf00000000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0xf000000000L);
default :
break;
}
@@ -310,13 +284,9 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0)
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa5_0(active0, 0xf00000000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0xf000000000L);
case 105:
- return jjMoveStringLiteralDfa5_0(active0, 0x2000000000L);
- case 108:
- if ((active0 & 0x80000L) != 0L)
- return jjStopAtPos(4, 19);
- break;
+ return jjMoveStringLiteralDfa5_0(active0, 0x20000000000L);
default :
break;
}
@@ -334,10 +304,10 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0)
switch(curChar)
{
case 105:
- return jjMoveStringLiteralDfa6_0(active0, 0xf00000000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0xf000000000L);
case 110:
- if ((active0 & 0x2000000000L) != 0L)
- return jjStopAtPos(5, 37);
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(5, 41);
break;
default :
break;
@@ -356,7 +326,7 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0)
switch(curChar)
{
case 110:
- return jjMoveStringLiteralDfa7_0(active0, 0xf00000000L);
+ return jjMoveStringLiteralDfa7_0(active0, 0xf000000000L);
default :
break;
}
@@ -374,12 +344,12 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0)
switch(curChar)
{
case 115:
- if ((active0 & 0x100000000L) != 0L)
+ if ((active0 & 0x1000000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 36;
jjmatchedPos = 7;
}
- return jjMoveStringLiteralDfa8_0(active0, 0xe00000000L);
+ return jjMoveStringLiteralDfa8_0(active0, 0xe000000000L);
default :
break;
}
@@ -397,7 +367,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0)
switch(curChar)
{
case 32:
- return jjMoveStringLiteralDfa9_0(active0, 0xe00000000L);
+ return jjMoveStringLiteralDfa9_0(active0, 0xe000000000L);
default :
break;
}
@@ -415,9 +385,9 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0)
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa10_0(active0, 0x400000000L);
+ return jjMoveStringLiteralDfa10_0(active0, 0x4000000000L);
case 110:
- return jjMoveStringLiteralDfa10_0(active0, 0xa00000000L);
+ return jjMoveStringLiteralDfa10_0(active0, 0xa000000000L);
default :
break;
}
@@ -435,9 +405,9 @@ private int jjMoveStringLiteralDfa10_0(long old0, long active0)
switch(curChar)
{
case 110:
- return jjMoveStringLiteralDfa11_0(active0, 0x400000000L);
+ return jjMoveStringLiteralDfa11_0(active0, 0x4000000000L);
case 111:
- return jjMoveStringLiteralDfa11_0(active0, 0xa00000000L);
+ return jjMoveStringLiteralDfa11_0(active0, 0xa000000000L);
default :
break;
}
@@ -455,15 +425,15 @@ private int jjMoveStringLiteralDfa11_0(long old0, long active0)
switch(curChar)
{
case 116:
- if ((active0 & 0x200000000L) != 0L)
+ if ((active0 & 0x2000000000L) != 0L)
{
- jjmatchedKind = 33;
+ jjmatchedKind = 37;
jjmatchedPos = 11;
}
- return jjMoveStringLiteralDfa12_0(active0, 0x800000000L);
+ return jjMoveStringLiteralDfa12_0(active0, 0x8000000000L);
case 121:
- if ((active0 & 0x400000000L) != 0L)
- return jjStopAtPos(11, 34);
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(11, 38);
break;
default :
break;
@@ -482,7 +452,7 @@ private int jjMoveStringLiteralDfa12_0(long old0, long active0)
switch(curChar)
{
case 32:
- return jjMoveStringLiteralDfa13_0(active0, 0x800000000L);
+ return jjMoveStringLiteralDfa13_0(active0, 0x8000000000L);
default :
break;
}
@@ -500,7 +470,7 @@ private int jjMoveStringLiteralDfa13_0(long old0, long active0)
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa14_0(active0, 0x800000000L);
+ return jjMoveStringLiteralDfa14_0(active0, 0x8000000000L);
default :
break;
}
@@ -518,7 +488,7 @@ private int jjMoveStringLiteralDfa14_0(long old0, long active0)
switch(curChar)
{
case 110:
- return jjMoveStringLiteralDfa15_0(active0, 0x800000000L);
+ return jjMoveStringLiteralDfa15_0(active0, 0x8000000000L);
default :
break;
}
@@ -536,8 +506,8 @@ private int jjMoveStringLiteralDfa15_0(long old0, long active0)
switch(curChar)
{
case 121:
- if ((active0 & 0x800000000L) != 0L)
- return jjStopAtPos(15, 35);
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(15, 39);
break;
default :
break;
@@ -561,7 +531,7 @@ static final long[] jjbitVec2 = {
private int jjMoveNfa_0(int startState, int curPos)
{
int startsAt = 0;
- jjnewStateCnt = 141;
+ jjnewStateCnt = 193;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
@@ -576,59 +546,45 @@ private int jjMoveNfa_0(int startState, int curPos)
{
switch(jjstateSet[--i])
{
- case 119:
- case 58:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 138:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 55:
+ case 57:
+ case 60:
if ((0x8c00847affffffffL & l) == 0L)
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 0:
if ((0x8c00847affffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
else if ((0x3ff000000000000L & l) != 0L)
{
- if (kind > 9)
- kind = 9;
- jjCheckNAddStates(0, 10);
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAddStates(0, 14);
}
else if (curChar == 45)
- jjCheckNAddStates(11, 16);
+ jjCheckNAddStates(15, 22);
else if (curChar == 60)
{
- if (kind > 28)
- kind = 28;
+ if (kind > 32)
+ kind = 32;
}
else if (curChar == 62)
{
- if (kind > 26)
- kind = 26;
+ if (kind > 30)
+ kind = 30;
}
else if (curChar == 61)
jjstateSet[jjnewStateCnt++] = 32;
else if (curChar == 34)
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
else if (curChar == 39)
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
else if (curChar == 46)
jjCheckNAdd(1);
if (curChar == 33)
@@ -636,52 +592,35 @@ private int jjMoveNfa_0(int startState, int curPos)
else if (curChar == 38)
jjstateSet[jjnewStateCnt++] = 15;
break;
- case 133:
+ case 168:
if ((0x8c00847affffffffL & l) == 0L)
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 56:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 137:
if ((0x8c00847affffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
else if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 136;
+ jjstateSet[jjnewStateCnt++] = 55;
break;
- case 139:
+ case 58:
if ((0x8c00847affffffffL & l) == 0L)
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 54:
- if ((0x8c00847affffffffL & l) != 0L)
- {
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- }
- else if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 53;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 1:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 11)
- kind = 11;
+ if (kind > 15)
+ kind = 15;
jjCheckNAdd(1);
break;
case 3:
@@ -691,95 +630,91 @@ private int jjMoveNfa_0(int startState, int curPos)
case 4:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 12)
- kind = 12;
+ if (kind > 16)
+ kind = 16;
jjCheckNAdd(4);
break;
case 5:
if (curChar == 39)
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 7:
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 8:
if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 9:
- if (curChar == 39 && kind > 14)
- kind = 14;
+ if (curChar == 39 && kind > 18)
+ kind = 18;
break;
case 10:
if (curChar == 34)
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
case 12:
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
case 13:
if ((0xfffffffbffffffffL & l) != 0L)
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
case 14:
- if (curChar == 34 && kind > 14)
- kind = 14;
+ if (curChar == 34 && kind > 18)
+ kind = 18;
break;
case 15:
- if (curChar == 38 && kind > 17)
- kind = 17;
+ if (curChar == 38 && kind > 21)
+ kind = 21;
break;
case 16:
if (curChar == 38)
jjstateSet[jjnewStateCnt++] = 15;
break;
case 32:
- if (curChar == 61 && kind > 24)
- kind = 24;
+ if (curChar == 61 && kind > 28)
+ kind = 28;
break;
case 33:
if (curChar == 61)
jjstateSet[jjnewStateCnt++] = 32;
break;
case 34:
- if (curChar == 61 && kind > 25)
- kind = 25;
+ if (curChar == 61 && kind > 29)
+ kind = 29;
break;
case 35:
if (curChar == 33)
jjstateSet[jjnewStateCnt++] = 34;
break;
case 36:
- if (curChar == 62 && kind > 26)
- kind = 26;
+ if (curChar == 62 && kind > 30)
+ kind = 30;
break;
case 41:
if (curChar == 32)
jjstateSet[jjnewStateCnt++] = 40;
break;
case 49:
- if (curChar == 60 && kind > 28)
- kind = 28;
+ if (curChar == 60 && kind > 32)
+ kind = 32;
break;
- case 61:
- case 62:
- jjCheckNAddStates(23, 25);
+ case 50:
+ if (curChar == 61 && kind > 34)
+ kind = 34;
break;
+ case 63:
case 64:
- if (curChar == 45)
- jjCheckNAddStates(11, 16);
- break;
- case 65:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(66, 100);
+ jjCheckNAddStates(29, 31);
break;
case 66:
if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 67;
+ jjCheckNAddStates(15, 22);
break;
case 67:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(68, 99);
+ jjCheckNAddTwoStates(68, 102);
break;
case 68:
if (curChar == 45)
@@ -787,228 +722,418 @@ private int jjMoveNfa_0(int startState, int curPos)
break;
case 69:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(70, 98);
+ jjCheckNAddTwoStates(70, 101);
break;
case 70:
if (curChar == 45)
- jjCheckNAdd(71);
+ jjstateSet[jjnewStateCnt++] = 71;
break;
case 71:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(71, 72);
+ jjCheckNAddTwoStates(72, 100);
break;
case 72:
if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 73;
+ jjCheckNAdd(73);
break;
case 73:
- if ((0x7000000000000L & l) != 0L)
- jjCheckNAddTwoStates(74, 75);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(73, 74);
break;
case 74:
if (curChar == 45)
- jjCheckNAdd(75);
+ jjstateSet[jjnewStateCnt++] = 75;
break;
case 75:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(75, 76);
+ if ((0x3000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(76, 77);
break;
case 76:
if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 77;
+ jjCheckNAdd(77);
break;
case 77:
- if ((0xf000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 78;
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(77, 78);
break;
case 78:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 8)
- kind = 8;
- jjstateSet[jjnewStateCnt++] = 79;
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 79;
break;
- case 80:
- if ((0x7000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 81;
+ case 79:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 80;
break;
- case 81:
+ case 80:
if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 82;
+ jjstateSet[jjnewStateCnt++] = 81;
break;
case 82:
- if (curChar == 58)
+ if ((0x7000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 83;
break;
case 83:
- if ((0x3f000000000000L & l) != 0L)
+ if ((0x3ff000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 84;
break;
case 84:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 8)
- kind = 8;
- jjstateSet[jjnewStateCnt++] = 85;
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 85;
break;
case 85:
- if (curChar == 58)
+ if ((0x3f000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 86;
break;
case 86:
- if ((0x3f000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 87;
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(87, 94);
break;
case 87:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 8)
- kind = 8;
- jjCheckNAddTwoStates(88, 92);
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 88;
break;
case 88:
- if (curChar == 46)
+ if ((0x3f000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 89;
break;
case 89:
if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 90;
+ jjCheckNAddTwoStates(90, 94);
break;
case 90:
- if ((0x3ff000000000000L & l) != 0L)
+ if (curChar == 46)
jjstateSet[jjnewStateCnt++] = 91;
break;
case 91:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 8)
- kind = 8;
- jjCheckNAdd(92);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 92;
break;
case 92:
- if ((0x280000000000L & l) != 0L)
+ if ((0x3ff000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 93;
break;
case 93:
- if ((0x7000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 94;
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(94);
break;
case 94:
- if ((0x3ff000000000000L & l) != 0L)
+ if ((0x280000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 95;
break;
case 95:
- if (curChar == 58)
+ if ((0x7000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 96;
break;
case 96:
- if ((0x3f000000000000L & l) != 0L)
+ if ((0x3ff000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 97;
break;
case 97:
- if ((0x3ff000000000000L & l) != 0L && kind > 8)
- kind = 8;
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 98;
break;
case 98:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(26, 29);
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 99;
break;
case 99:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(30, 33);
+ if ((0x3ff000000000000L & l) != 0L && kind > 10)
+ kind = 10;
break;
case 100:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(34, 37);
+ jjCheckNAddStates(32, 35);
break;
case 101:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 9)
- kind = 9;
- jjCheckNAdd(101);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(36, 39);
break;
case 102:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(102, 103);
+ jjCheckNAddStates(40, 43);
break;
case 103:
- if (curChar == 46)
- jjCheckNAdd(104);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(104, 132);
break;
case 104:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 9)
- kind = 9;
- jjCheckNAdd(104);
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 105;
break;
case 105:
if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(105, 106);
+ jjCheckNAddTwoStates(106, 131);
+ break;
+ case 106:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 107;
break;
case 107:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(108);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(108, 130);
break;
case 108:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 9)
- kind = 9;
- jjCheckNAdd(108);
+ if (curChar == 45)
+ jjCheckNAdd(109);
break;
case 109:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(109, 110);
break;
case 110:
- if (curChar == 46)
- jjCheckNAdd(111);
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 111;
break;
case 111:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(111, 112);
+ if ((0x3000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 113);
+ break;
+ case 112:
+ if (curChar == 45)
+ jjCheckNAdd(113);
break;
case 113:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(114);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(113, 114);
break;
case 114:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 115;
+ break;
+ case 115:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 116;
+ break;
+ case 116:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 117;
+ break;
+ case 118:
+ if ((0x7000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 119;
+ break;
+ case 119:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 120;
+ break;
+ case 120:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 121;
+ break;
+ case 121:
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 122;
+ break;
+ case 122:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 9)
- kind = 9;
- jjCheckNAdd(114);
+ if (kind > 11)
+ kind = 11;
+ jjstateSet[jjnewStateCnt++] = 123;
break;
- case 115:
+ case 123:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 124;
+ break;
+ case 124:
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 125;
+ break;
+ case 125:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(115);
+ if (kind > 11)
+ kind = 11;
+ jjstateSet[jjnewStateCnt++] = 126;
break;
- case 116:
+ case 126:
+ if (curChar == 46)
+ jjstateSet[jjnewStateCnt++] = 127;
+ break;
+ case 127:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 128;
+ break;
+ case 128:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 129;
+ break;
+ case 129:
+ if ((0x3ff000000000000L & l) != 0L && kind > 11)
+ kind = 11;
+ break;
+ case 130:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(44, 47);
+ break;
+ case 131:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(48, 51);
+ break;
+ case 132:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(52, 55);
+ break;
+ case 133:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(134, 149);
+ break;
+ case 134:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 135;
+ break;
+ case 135:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(136, 148);
+ break;
+ case 136:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 137;
+ break;
+ case 137:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(138, 147);
+ break;
+ case 138:
+ if (curChar == 45)
+ jjCheckNAdd(139);
+ break;
+ case 139:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(139, 140);
+ break;
+ case 140:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 141;
+ break;
+ case 141:
+ if ((0x3000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(142, 143);
+ break;
+ case 142:
+ if (curChar == 45)
+ jjCheckNAdd(143);
+ break;
+ case 143:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(143, 144);
+ break;
+ case 144:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 145;
+ break;
+ case 145:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 146;
+ break;
+ case 146:
+ if ((0x3ff000000000000L & l) != 0L && kind > 12)
+ kind = 12;
+ break;
+ case 147:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(56, 59);
+ break;
+ case 148:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(60, 63);
+ break;
+ case 149:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(64, 67);
+ break;
+ case 150:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 9)
- kind = 9;
- jjCheckNAddStates(0, 10);
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAdd(150);
break;
- case 117:
+ case 151:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(151, 152);
+ break;
+ case 152:
+ if (curChar == 46)
+ jjCheckNAdd(153);
+ break;
+ case 153:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 13)
kind = 13;
- jjCheckNAdd(117);
+ jjCheckNAdd(153);
break;
- case 123:
+ case 154:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 156:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(157);
+ break;
+ case 157:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAdd(157);
+ break;
+ case 158:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(158, 159);
+ break;
+ case 159:
+ if (curChar == 46)
+ jjCheckNAdd(160);
+ break;
+ case 160:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(160, 161);
+ break;
+ case 162:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(163);
+ break;
+ case 163:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAdd(163);
+ break;
+ case 164:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 14)
+ kind = 14;
+ jjCheckNAdd(164);
+ break;
+ case 165:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAddStates(0, 14);
+ break;
+ case 166:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 17)
+ kind = 17;
+ jjCheckNAdd(166);
+ break;
+ case 172:
if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 122;
+ jjstateSet[jjnewStateCnt++] = 171;
break;
- case 130:
+ case 179:
if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 129;
+ jjstateSet[jjnewStateCnt++] = 178;
+ break;
+ case 189:
+ if (curChar == 32)
+ jjstateSet[jjnewStateCnt++] = 188;
break;
default : break;
}
@@ -1021,58 +1146,35 @@ private int jjMoveNfa_0(int startState, int curPos)
{
switch(jjstateSet[--i])
{
- case 119:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- }
- if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 123;
- if (curChar == 115)
- {
- if (kind > 24)
- kind = 24;
- }
- break;
- case 138:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- }
- if (curChar == 101)
- jjstateSet[jjnewStateCnt++] = 137;
- break;
- case 55:
+ case 57:
if ((0xffffffffd7ffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 54;
+ jjstateSet[jjnewStateCnt++] = 56;
break;
case 0:
if ((0xffffffffd7ffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
else if (curChar == 91)
- jjCheckNAddStates(23, 25);
+ jjCheckNAddStates(29, 31);
if ((0x2000000020L & l) != 0L)
- jjAddStates(38, 39);
+ jjAddStates(68, 69);
else if (curChar == 108)
- jjAddStates(40, 41);
+ jjAddStates(70, 72);
else if (curChar == 105)
- jjAddStates(42, 43);
+ jjAddStates(73, 74);
else if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 56;
+ jjstateSet[jjnewStateCnt++] = 58;
+ else if (curChar == 126)
+ jjstateSet[jjnewStateCnt++] = 50;
else if (curChar == 103)
jjstateSet[jjnewStateCnt++] = 47;
else if (curChar == 102)
@@ -1086,82 +1188,68 @@ private int jjMoveNfa_0(int startState, int curPos)
else if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 18;
break;
- case 133:
+ case 168:
if ((0xffffffffd7ffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
- if (curChar == 105)
- jjstateSet[jjnewStateCnt++] = 139;
- else if (curChar == 101)
- jjstateSet[jjnewStateCnt++] = 132;
- break;
- case 56:
- if ((0xffffffffd7ffffffL & l) != 0L)
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 172;
+ if (curChar == 115)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 28)
+ kind = 28;
}
- if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 55;
break;
- case 137:
- case 58:
+ case 56:
+ case 60:
if ((0xffffffffd7ffffffL & l) == 0L)
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
- case 139:
+ case 58:
if ((0xffffffffd7ffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
}
- if (curChar == 107)
- jjstateSet[jjnewStateCnt++] = 138;
- break;
- case 54:
- if ((0xffffffffd7ffffffL & l) == 0L)
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 57;
break;
case 2:
if ((0x2000000020L & l) != 0L)
- jjAddStates(38, 39);
+ jjAddStates(68, 69);
break;
case 6:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 7;
break;
case 7:
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 8:
if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 11:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 12;
break;
case 12:
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
case 13:
if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
case 17:
- if (curChar == 100 && kind > 17)
- kind = 17;
+ if (curChar == 100 && kind > 21)
+ kind = 21;
break;
case 18:
if (curChar == 110)
@@ -1172,24 +1260,24 @@ private int jjMoveNfa_0(int startState, int curPos)
jjstateSet[jjnewStateCnt++] = 18;
break;
case 20:
- if (curChar == 124 && kind > 18)
- kind = 18;
+ if (curChar == 124 && kind > 22)
+ kind = 22;
break;
case 21:
if (curChar == 124)
jjstateSet[jjnewStateCnt++] = 20;
break;
case 22:
- if (curChar == 114 && kind > 18)
- kind = 18;
+ if (curChar == 114 && kind > 22)
+ kind = 22;
break;
case 23:
if (curChar == 111)
jjstateSet[jjnewStateCnt++] = 22;
break;
case 24:
- if (curChar == 101 && kind > 23)
- kind = 23;
+ if (curChar == 101 && kind > 27)
+ kind = 27;
break;
case 25:
if (curChar == 117)
@@ -1220,8 +1308,8 @@ private int jjMoveNfa_0(int startState, int curPos)
jjstateSet[jjnewStateCnt++] = 30;
break;
case 37:
- if (curChar == 110 && kind > 26)
- kind = 26;
+ if (curChar == 110 && kind > 30)
+ kind = 30;
break;
case 38:
if (curChar == 97)
@@ -1263,120 +1351,152 @@ private int jjMoveNfa_0(int startState, int curPos)
if (curChar == 103)
jjstateSet[jjnewStateCnt++] = 47;
break;
- case 50:
- if (curChar == 101 && kind > 31)
- kind = 31;
- break;
case 51:
- if (curChar == 107)
+ if (curChar == 126)
jjstateSet[jjnewStateCnt++] = 50;
break;
case 52:
- if (curChar == 105)
- jjstateSet[jjnewStateCnt++] = 51;
+ if (curChar == 101 && kind > 35)
+ kind = 35;
break;
case 53:
- if (curChar == 108)
+ if (curChar == 107)
jjstateSet[jjnewStateCnt++] = 52;
break;
- case 57:
- if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 56;
+ case 54:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 53;
+ break;
+ case 55:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 54;
break;
case 59:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 58;
+ break;
+ case 61:
if (curChar == 91)
- jjCheckNAddStates(23, 25);
+ jjCheckNAddStates(29, 31);
break;
- case 60:
+ case 62:
if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 61;
+ jjstateSet[jjnewStateCnt++] = 63;
break;
- case 61:
- jjCheckNAddStates(23, 25);
+ case 63:
+ jjCheckNAddStates(29, 31);
break;
- case 62:
+ case 64:
if ((0xffffffffcfffffffL & l) != 0L)
- jjCheckNAddStates(23, 25);
+ jjCheckNAddStates(29, 31);
break;
- case 63:
- if (curChar == 93 && kind > 39)
- kind = 39;
+ case 65:
+ if (curChar == 93 && kind > 43)
+ kind = 43;
break;
- case 79:
- if ((0x10000000100000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 80;
+ case 81:
+ if (curChar == 84)
+ jjstateSet[jjnewStateCnt++] = 82;
break;
- case 106:
+ case 117:
+ if (curChar == 84)
+ jjstateSet[jjnewStateCnt++] = 118;
+ break;
+ case 155:
if ((0x2000000020L & l) != 0L)
- jjAddStates(44, 45);
+ jjAddStates(75, 76);
break;
- case 112:
+ case 161:
if ((0x2000000020L & l) != 0L)
- jjAddStates(46, 47);
+ jjAddStates(77, 78);
break;
- case 118:
+ case 167:
if (curChar == 105)
- jjAddStates(42, 43);
+ jjAddStates(73, 74);
break;
- case 120:
- if (curChar == 116 && kind > 25)
- kind = 25;
+ case 169:
+ if (curChar == 116 && kind > 29)
+ kind = 29;
break;
- case 121:
+ case 170:
if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 120;
+ jjstateSet[jjnewStateCnt++] = 169;
break;
- case 122:
+ case 171:
if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 121;
+ jjstateSet[jjnewStateCnt++] = 170;
break;
- case 124:
+ case 173:
if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 123;
+ jjstateSet[jjnewStateCnt++] = 172;
break;
- case 125:
+ case 174:
if (curChar == 108)
- jjAddStates(40, 41);
+ jjAddStates(70, 72);
break;
- case 126:
- if (curChar == 110 && kind > 28)
- kind = 28;
+ case 175:
+ if (curChar == 110 && kind > 32)
+ kind = 32;
break;
- case 127:
+ case 176:
if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 126;
+ jjstateSet[jjnewStateCnt++] = 175;
break;
- case 128:
+ case 177:
if (curChar == 104)
- jjstateSet[jjnewStateCnt++] = 127;
+ jjstateSet[jjnewStateCnt++] = 176;
break;
- case 129:
+ case 178:
if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 128;
+ jjstateSet[jjnewStateCnt++] = 177;
break;
- case 131:
+ case 180:
if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 130;
+ jjstateSet[jjnewStateCnt++] = 179;
break;
- case 132:
+ case 181:
if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 131;
+ jjstateSet[jjnewStateCnt++] = 180;
break;
- case 134:
- if (curChar == 116 && kind > 31)
- kind = 31;
+ case 182:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 181;
break;
- case 135:
+ case 183:
+ if (curChar == 101 && kind > 34)
+ kind = 34;
+ break;
+ case 184:
+ if (curChar == 107)
+ jjstateSet[jjnewStateCnt++] = 183;
+ break;
+ case 185:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 184;
+ break;
+ case 186:
+ if (curChar == 116 && kind > 35)
+ kind = 35;
+ break;
+ case 187:
if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 134;
+ jjstateSet[jjnewStateCnt++] = 186;
break;
- case 136:
+ case 188:
if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 135;
+ jjstateSet[jjnewStateCnt++] = 187;
break;
- case 140:
+ case 190:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 189;
+ break;
+ case 191:
+ if (curChar == 107)
+ jjstateSet[jjnewStateCnt++] = 190;
+ break;
+ case 192:
if (curChar == 105)
- jjstateSet[jjnewStateCnt++] = 139;
+ jjstateSet[jjnewStateCnt++] = 191;
break;
default : break;
}
@@ -1393,84 +1513,56 @@ private int jjMoveNfa_0(int startState, int curPos)
{
switch(jjstateSet[--i])
{
- case 119:
- case 58:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 138:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 55:
+ case 57:
+ case 60:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 0:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
- case 133:
+ case 168:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 56:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
- case 137:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 139:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
- break;
- case 54:
+ case 58:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(58);
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
break;
case 7:
case 8:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(20, 22);
+ jjCheckNAddStates(26, 28);
break;
case 12:
case 13:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(17, 19);
+ jjCheckNAddStates(23, 25);
break;
- case 61:
- case 62:
+ case 63:
+ case 64:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(23, 25);
+ jjCheckNAddStates(29, 31);
break;
default : break;
}
@@ -1483,16 +1575,18 @@ private int jjMoveNfa_0(int startState, int curPos)
kind = 0x7fffffff;
}
++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 141 - (jjnewStateCnt = startsAt)))
+ if ((i = jjnewStateCnt) == (startsAt = 193 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static final int[] jjnextStates = {
- 66, 101, 102, 103, 105, 106, 109, 110, 115, 117, 100, 65, 101, 102, 105, 109,
- 115, 11, 13, 14, 6, 8, 9, 60, 62, 63, 70, 71, 72, 98, 68, 70,
- 98, 99, 66, 68, 99, 100, 3, 4, 133, 140, 119, 124, 107, 108, 113, 114,
+ 68, 104, 134, 150, 151, 152, 154, 155, 158, 159, 164, 166, 149, 132, 102, 67,
+ 103, 133, 150, 151, 154, 158, 164, 11, 13, 14, 6, 8, 9, 62, 64, 65,
+ 72, 73, 74, 100, 70, 72, 100, 101, 68, 70, 101, 102, 108, 109, 110, 130,
+ 106, 108, 130, 131, 104, 106, 131, 132, 138, 139, 140, 147, 136, 138, 147, 148,
+ 134, 136, 148, 149, 3, 4, 182, 185, 192, 168, 173, 156, 157, 162, 163,
};
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
@@ -1510,8 +1604,8 @@ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, lo
/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, "\40\156\165\154\154", "\50", "\51", "\54", null,
-null, null, null, "\76\75", null, "\74\75", "\154\151\153\145", null,
+null, null, null, null, null, null, null, null, null, null, "\156\165\154\154",
+"\50", "\51", "\54", null, null, null, null, "\76\75", null, "\74\75", null, null,
"\143\157\156\164\141\151\156\163", "\143\157\156\164\141\151\156\163\40\156\157\164",
"\143\157\156\164\141\151\156\163\40\141\156\171", "\143\157\156\164\141\151\156\163\40\156\157\164\40\141\156\171", "\151\156",
"\156\157\164\40\151\156", null, null, null, };
@@ -1521,14 +1615,14 @@ public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
- 0x1fffffe7f01L,
+ 0x1fffffe7fc01L,
};
static final long[] jjtoSkip = {
0x6L,
};
protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[141];
-private final int[] jjstateSet = new int[282];
+private final int[] jjrounds = new int[193];
+private final int[] jjstateSet = new int[386];
private final StringBuilder jjimage = new StringBuilder();
private StringBuilder image = jjimage;
private int jjimageLen;
@@ -1559,7 +1653,7 @@ private void ReInitRounds()
{
int i;
jjround = 0x80000001;
- for (i = 141; i-- > 0;)
+ for (i = 193; i-- > 0;)
jjrounds[i] = 0x80000000;
}
@@ -1633,12 +1727,17 @@ public Token getNextToken()
image.setLength(0);
jjimageLen = 0;
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100000000L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedPos == 0 && jjmatchedKind > 40)
+ if (jjmatchedPos == 0 && jjmatchedKind > 44)
{
- jjmatchedKind = 40;
+ jjmatchedKind = 44;
}
if (jjmatchedKind != 0x7fffffff)
{
@@ -1682,11 +1781,11 @@ void TokenLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
- case 14 :
+ case 18 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
matchedToken.image = image.substring(1, lengthOfMatch - 1);
break;
- case 39 :
+ case 43 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
matchedToken.image = image.substring(1, lengthOfMatch - 1);
break;
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/ParseException.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
similarity index 95%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/ParseException.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
index 4ea6e2e..1ad420d 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/ParseException.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
@@ -1,187 +1,187 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
-/* JavaCCOptions:KEEP_LINE_COL=null */
-package org.apache.sling.resource.stream.parser;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set.
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- }
-
- /** Constructor with message. */
- public ParseException(String message) {
- super(message);
- }
-
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * It uses "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser) the correct error message
- * gets displayed.
- */
- private static String initialise(Token currentToken,
- int[][] expectedTokenSequences,
- String[] tokenImage) {
- String eol = System.getProperty("line.separator", "\n");
- StringBuffer expected = new StringBuffer();
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected.append("...");
- }
- expected.append(eol).append(" ");
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += " " + tokenImage[tok.kind];
- retval += " \"";
- retval += add_escapes(tok.image);
- retval += " \"";
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
- retval += "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected.toString();
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- static String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
-/* JavaCC - OriginalChecksum=84f506fca4df66f6d0df1c90850f2234 (do not edit this line) */
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
+/* JavaCCOptions:KEEP_LINE_COL=null */
+package org.apache.sling.resource.stream.impl;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set.
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ }
+
+ /** Constructor with message. */
+ public ParseException(String message) {
+ super(message);
+ }
+
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * It uses "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser) the correct error message
+ * gets displayed.
+ */
+ private static String initialise(Token currentToken,
+ int[][] expectedTokenSequences,
+ String[] tokenImage) {
+ String eol = System.getProperty("line.separator", "\n");
+ StringBuffer expected = new StringBuffer();
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected.append("...");
+ }
+ expected.append(eol).append(" ");
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += " " + tokenImage[tok.kind];
+ retval += " \"";
+ retval += add_escapes(tok.image);
+ retval += " \"";
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+ retval += "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected.toString();
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ static String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
+/* JavaCC - OriginalChecksum=83a1ca447d862df57c34d5cbcbc80371 (do not edit this line) */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/SimpleCharStream.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
similarity index 95%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/SimpleCharStream.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
index 9d6ab9d..efca80d 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/SimpleCharStream.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
@@ -1,471 +1,471 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
-/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.sling.resource.stream.parser;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public class SimpleCharStream
-{
-/** Whether parser is static. */
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
-/** Position in buffer. */
- public int bufpos = -1;
- protected int bufline[];
- protected int bufcolumn[];
-
- protected int column = 0;
- protected int line = 1;
-
- protected boolean prevCharIsCR = false;
- protected boolean prevCharIsLF = false;
-
- protected java.io.Reader inputStream;
-
- protected char[] buffer;
- protected int maxNextCharInd = 0;
- protected int inBuf = 0;
- protected int tabSize = 8;
-
- protected void setTabSize(int i) { tabSize = i; }
- protected int getTabSize(int i) { return tabSize; }
-
-
- protected void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- protected void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
-/** Start. */
- public char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- protected void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (tabSize - (column % tabSize));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
-/** Read a character. */
- public char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- return buffer[bufpos];
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = buffer[bufpos];
-
- UpdateLineColumn(c);
- return c;
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public int getColumn() {
- return bufcolumn[bufpos];
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public int getLine() {
- return bufline[bufpos];
- }
-
- /** Get token end column number. */
- public int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- /** Get token end line number. */
- public int getEndLine() {
- return bufline[bufpos];
- }
-
- /** Get token beginning column number. */
- public int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- /** Get token beginning line number. */
- public int getBeginLine() {
- return bufline[tokenBegin];
- }
-
-/** Backup a number of characters. */
- public void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, 1, 1, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, startline, startcolumn, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- /** Get token literal value. */
- public String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- /** Get the suffix. */
- public char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- /** Reset buffer when finished. */
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
-/* JavaCC - OriginalChecksum=1cacff966e43d00cdb95b69a53874762 (do not edit this line) */
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package org.apache.sling.resource.stream.impl;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public class SimpleCharStream
+{
+/** Whether parser is static. */
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+/** Position in buffer. */
+ public int bufpos = -1;
+ protected int bufline[];
+ protected int bufcolumn[];
+
+ protected int column = 0;
+ protected int line = 1;
+
+ protected boolean prevCharIsCR = false;
+ protected boolean prevCharIsLF = false;
+
+ protected java.io.Reader inputStream;
+
+ protected char[] buffer;
+ protected int maxNextCharInd = 0;
+ protected int inBuf = 0;
+ protected int tabSize = 8;
+
+ protected void setTabSize(int i) { tabSize = i; }
+ protected int getTabSize(int i) { return tabSize; }
+
+
+ protected void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ protected void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+/** Start. */
+ public char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ protected void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (tabSize - (column % tabSize));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+/** Read a character. */
+ public char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+
+ if (++bufpos == bufsize)
+ bufpos = 0;
+
+ return buffer[bufpos];
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = buffer[bufpos];
+
+ UpdateLineColumn(c);
+ return c;
+ }
+
+ @Deprecated
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ @Deprecated
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public int getLine() {
+ return bufline[bufpos];
+ }
+
+ /** Get token end column number. */
+ public int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /** Get token end line number. */
+ public int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ /** Get token beginning column number. */
+ public int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ /** Get token beginning line number. */
+ public int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+/** Backup a number of characters. */
+ public void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+ {
+ this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn) throws java.io.UnsupportedEncodingException
+ {
+ this(dstream, encoding, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+ {
+ this(dstream, encoding, 1, 1, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(dstream, encoding, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(dstream, encoding, startline, startcolumn, 4096);
+ }
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ /** Get token literal value. */
+ public String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ /** Get the suffix. */
+ public char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ /** Reset buffer when finished. */
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
+/* JavaCC - OriginalChecksum=6135efa69418e21b667355763fbdf75c (do not edit this line) */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/Token.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
similarity index 94%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/Token.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
index 778a7d4..5554f10 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/Token.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
@@ -1,131 +1,131 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.sling.resource.stream.parser;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token implements java.io.Serializable {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /** The line number of the first character of this Token. */
- public int beginLine;
- /** The column number of the first character of this Token. */
- public int beginColumn;
- /** The line number of the last character of this Token. */
- public int endLine;
- /** The column number of the last character of this Token. */
- public int endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * An optional attribute value of the Token.
- * Tokens which are not used as syntactic sugar will often contain
- * meaningful values that will be used later on by the compiler or
- * interpreter. This attribute value is often different from the image.
- * Any subclass of Token that actually wants to return a non-null value can
- * override this method as appropriate.
- */
- public Object getValue() {
- return null;
- }
-
- /**
- * No-argument constructor
- */
- public Token() {}
-
- /**
- * Constructs a new token for the specified Image.
- */
- public Token(int kind)
- {
- this(kind, null);
- }
-
- /**
- * Constructs a new token for the specified Image and Kind.
- */
- public Token(int kind, String image)
- {
- this.kind = kind;
- this.image = image;
- }
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simply add something like :
- *
- * case MyParserConstants.ID : return new IDToken(ofKind, image);
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use sit in your lexical actions.
- */
- public static Token newToken(int ofKind, String image)
- {
- switch(ofKind)
- {
- default : return new Token(ofKind, image);
- }
- }
-
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, null);
- }
-
-}
-/* JavaCC - OriginalChecksum=ed3fbbf53658adc92e1e017840b5a209 (do not edit this line) */
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package org.apache.sling.resource.stream.impl;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token implements java.io.Serializable {
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /** The line number of the first character of this Token. */
+ public int beginLine;
+ /** The column number of the first character of this Token. */
+ public int beginColumn;
+ /** The line number of the last character of this Token. */
+ public int endLine;
+ /** The column number of the last character of this Token. */
+ public int endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * An optional attribute value of the Token.
+ * Tokens which are not used as syntactic sugar will often contain
+ * meaningful values that will be used later on by the compiler or
+ * interpreter. This attribute value is often different from the image.
+ * Any subclass of Token that actually wants to return a non-null value can
+ * override this method as appropriate.
+ */
+ public Object getValue() {
+ return null;
+ }
+
+ /**
+ * No-argument constructor
+ */
+ public Token() {}
+
+ /**
+ * Constructs a new token for the specified Image.
+ */
+ public Token(int kind)
+ {
+ this(kind, null);
+ }
+
+ /**
+ * Constructs a new token for the specified Image and Kind.
+ */
+ public Token(int kind, String image)
+ {
+ this.kind = kind;
+ this.image = image;
+ }
+
+ /**
+ * Returns the image.
+ */
+ public String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simply add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken(ofKind, image);
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use sit in your lexical actions.
+ */
+ public static Token newToken(int ofKind, String image)
+ {
+ switch(ofKind)
+ {
+ default : return new Token(ofKind, image);
+ }
+ }
+
+ public static Token newToken(int ofKind)
+ {
+ return newToken(ofKind, null);
+ }
+
+}
+/* JavaCC - OriginalChecksum=a81505762739ec99dc6610e2843bdc32 (do not edit this line) */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/TokenMgrError.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
similarity index 94%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/TokenMgrError.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
index 50eddd5..d989d49 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/TokenMgrError.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
@@ -1,147 +1,147 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-package org.apache.sling.resource.stream.parser;
-
-/** Token Manager Error. */
-public class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=4d60cfab556123e5280cd4c24fcb8fdf (do not edit this line) */
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
+package org.apache.sling.resource.stream.impl;
+
+/** Token Manager Error. */
+public class TokenMgrError extends Error
+{
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their escaped (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexical error
+ * curLexState : lexical state in which this error occurred
+ * errorLine : line number when the error occurred
+ * errorColumn : column number when the error occurred
+ * errorAfter : prefix that was seen before this error occurred
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** Constructor with message and reason. */
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ /** Full Constructor. */
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
+/* JavaCC - OriginalChecksum=cb6190a073e75e5f61dac8e989eb2b78 (do not edit this line) */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/node/Node.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
similarity index 91%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/node/Node.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
index 7d24e45..e15c6e4 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/node/Node.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
@@ -11,13 +11,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.node;
+package org.apache.sling.resource.stream.impl.node;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.sling.resource.stream.parser.api.Visitor;
+import org.apache.sling.resource.stream.api.Visitor;
/**
*
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicateFactory.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
similarity index 92%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicateFactory.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
index 482b392..c71b774 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicateFactory.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
@@ -11,13 +11,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.predicates;
+package org.apache.sling.resource.stream.impl.predicates;
import java.util.function.Function;
import java.util.function.Predicate;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.FilterParserConstants;
+import org.apache.sling.resource.stream.impl.FilterParserConstants;
public class ComparisonPredicateFactory {
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicates.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
similarity index 99%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicates.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
index a060a44..45ff89f 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/ComparisonPredicates.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.predicates;
+package org.apache.sling.resource.stream.impl.predicates;
import java.math.BigDecimal;
import java.time.Instant;
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/Null.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
similarity index 91%
rename from streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/Null.java
rename to streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
index c85bcc8..88a135d 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/predicates/Null.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.resource.stream.parser.predicates;
+package org.apache.sling.resource.stream.impl.predicates;
/**
*
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/README.txt b/streams/src/main/java/org/apache/sling/resource/stream/parser/README.txt
deleted file mode 100644
index b46dba8..0000000
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/README.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# DO NOT EDIT
-This folder contains files autogenerated by JavaCC do not edit files in this folder
\ No newline at end of file
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/ComparisonVisitor.java b/streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/ComparisonVisitor.java
deleted file mode 100644
index 25896bd..0000000
--- a/streams/src/main/java/org/apache/sling/resource/stream/parser/visitor/ComparisonVisitor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed 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.sling.resource.stream.parser.visitor;
-
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Function;
-
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceUtil;
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.resource.stream.parser.FilterParserConstants;
-import org.apache.sling.resource.stream.parser.api.ResourceFilterFunction;
-import org.apache.sling.resource.stream.parser.api.Visitor;
-import org.apache.sling.resource.stream.parser.impl.InstantProvider;
-import org.apache.sling.resource.stream.parser.node.Node;
-import org.apache.sling.resource.stream.parser.predicates.Null;
-
-public class ComparisonVisitor implements Visitor<Function<Resource, Object>> {
-
- private Map<String, ResourceFilterFunction> functions = new HashMap<>();
-
- private ResourceFilterFunction instant = new InstantProvider();
-
- @Override
- public Function<Resource, Object> visit(Node node) {
- switch (node.kind) {
- case FilterParserConstants.FUNCTION_NAME:
- break;
- case FilterParserConstants.NULL:
- return resource -> new Null();
- case FilterParserConstants.NUMBER:
- Number numericValue = null;
- {
- String numberText = node.text;
- try {
- numericValue = Integer.valueOf(numberText);
- } catch (NumberFormatException nfe1) {
- try {
- numericValue = new BigDecimal(numberText);
- } catch (NumberFormatException nfe2) {
- //swallow
- }
- }
- }
- final Number numericReply = numericValue;
- return resource -> numericReply;
- case FilterParserConstants.PROPERTY:
- return resource -> {
- Object value = valueMapOf(resource).get(node.text);
- if (value instanceof Boolean) {
- return value.toString();
- }
- if (value instanceof Calendar){
- return ((Calendar)value).toInstant();
- }
- return value;
- };
- default:
- return resource -> node.text;
- }
- // will only get here in the case of the 'FUNCTION' switch case
- switch (node.text) {
- case "name":
- return resource -> resource.getName();
- case "date":
- return instant.provision(node.visitChildren(this));
- case "path":
- return resource -> resource.getPath();
- default:
- ResourceFilterFunction temp = functions.get(node.text);
- if (temp != null){
- return temp.provision(node.visitChildren(this));
- }
-
- }
- return null;
- }
-
- public ResourceFilterFunction registerFunction(String functionName, ResourceFilterFunction function) {
- return this.functions.put(functionName, function);
- }
-
- public ResourceFilterFunction removeFunction(String functionName) {
- return this.functions.remove(functionName);
- }
-
- private ValueMap valueMapOf(Resource resource){
- if (resource == null || ResourceUtil.isNonExistingResource(resource)){
- return ValueMap.EMPTY;
- }
- return resource.adaptTo(ValueMap.class);
- }
-
-}
diff --git a/streams/src/main/javacc/resourceFilter.jj b/streams/src/main/javacc/resourceFilter.jj
index 66b4552..7b9fc3e 100644
--- a/streams/src/main/javacc/resourceFilter.jj
+++ b/streams/src/main/javacc/resourceFilter.jj
@@ -19,10 +19,11 @@ options
}
PARSER_BEGIN(FilterParser)
-package org.apache.sling.resource.stream.parser;
+package org.apache.sling.resource.stream.impl;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.sling.resource.stream.parser.node.*;
+import org.apache.sling.resource.stream.impl.node.*;
public final class FilterParser
{
@@ -38,15 +39,19 @@ SKIP :
TOKEN :
{
- < #DOT: "." >
-| < #PLUS: "+" >
+ < #PLUS: "+" >
| < #MINUS: "-" >
| < #DIGIT: [ "0"-"9" ] >
| < #EXP: ["e","E"] ( < PLUS > | < MINUS > )? >
-| < DATE: <INTEGER> <INTEGER> <INTEGER> <INTEGER> <MINUS> ["0"-"2"] <INTEGER> <MINUS> ["0"-"3"] <DIGIT> (["t","T"] ["0"-"2"] <DIGIT> ":" ["0"-"5"] <DIGIT> ( ":" ["0"-"5"] <DIGIT> ("." <DIGIT> <DIGIT> <DIGIT>)? (["+","-"]["0"-"2"] <DIGIT> ":" ["0"-"5"] <DIGIT> )? )? )? >
+| < #OFFSET: ["+","-"]["0"-"2"] <DIGIT> ":" ["0"-"5"] <DIGIT> >
+| < #YYYYMMDD: <INTEGER> <INTEGER> <INTEGER> <INTEGER> <MINUS> ["0"-"1"] <INTEGER> <MINUS> ["0"-"3"] <DIGIT> >
+| < #TIME: ["0"-"2"] <DIGIT> ":" ["0"-"5"] <DIGIT> ( ":" ["0"-"5"] <DIGIT> ("." <DIGIT> <DIGIT> <DIGIT>)? )? >
+| < OFFSETDATETIME: <YYYYMMDD> "T" <TIME> <OFFSET> >
+| < DATETIME: <YYYYMMDD> "T" <TIME> >
+| < DATE: <YYYYMMDD> >
| < NUMBER: <INTEGER> | <INTEGER> <FRACTIONAL_DIGITS> | <INTEGER> <EXPONENT> | <INTEGER> <FRACTIONAL_DIGITS> <EXPONENT> >
| < INTEGER: (<MINUS>)? ( <DIGITS> ) >
-| < FRACTIONAL_DIGITS: <DOT> <DIGITS> >
+| < FRACTIONAL_DIGITS: "." <DIGITS> >
| < EXPONENT: <EXP> <DIGITS> >
| < DIGITS: ( <DIGIT> )+ >
}
@@ -80,7 +85,7 @@ TOKEN :
"||"
| "or"
) >
-| < NULL : " null" >
+| < NULL : "null" >
| < LPAREN : "(" >
| < RPAREN : ")" >
| < COMMA : "," >
@@ -91,7 +96,7 @@ TOKEN :
| < GREATER_THAN_OR_EQUAL : ">=" >
| < LESS_THAN : "<" | "less than" >
| < LESS_THAN_OR_EQUAL : "<=" >
-| < LIKE : "like" >
+| < LIKE : "~=" | "like" >
| < LIKE_NOT : "like not" | "not like" >
| < CONTAINS : "contains" >
| < CONTAINS_NOT : "contains not" >
@@ -299,6 +304,8 @@ Node literal() :
| < NULL >
| < BOOLEAN >
| < DATE >
+ | < DATETIME >
+ | < OFFSETDATETIME >
)
{
return new Node(token.kind, token.image);
diff --git a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterDateTest.java b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterDateTest.java
index 99fc96e..22464eb 100644
--- a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterDateTest.java
+++ b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterDateTest.java
@@ -19,7 +19,7 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.ParseException;
+import org.apache.sling.resource.stream.impl.ParseException;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.junit.Before;
import org.junit.Rule;
@@ -47,7 +47,7 @@ public class ResourceFilterDateTest {
found = handle(START_PATH, query);
assertEquals(3, found.size());
- query = "[jcr:content/created] < '2013-08-08T16:32'";
+ query = "[jcr:content/created] < 2013-08-08T16:32";
found = handle(START_PATH, query);
assertEquals(3, found.size());
@@ -55,31 +55,31 @@ public class ResourceFilterDateTest {
found = handle(START_PATH, query);
assertEquals(3, found.size());
- query = "[jcr:content/created] less than '2013-08-07T14:32:59'";
+ query = "[jcr:content/created] less than 2013-08-07T14:32:59";
found = handle(START_PATH, query);
assertEquals(2, found.size());
- query = "[jcr:content/created] <= '2013-08-07T14:32:59'";
+ query = "[jcr:content/created] <= 2013-08-07T14:32:59";
found = handle(START_PATH, query);
assertEquals(3, found.size());
- query = "[jcr:content/created] <= '2013-08-07T14:32'";
+ query = "[jcr:content/created] <= 2013-08-07T14:32";
found = handle(START_PATH, query);
assertEquals(2, found.size());
- query = "[jcr:content/created] < '2013-08-07T14:32:59.010'";
+ query = "[jcr:content/created] < 2013-08-07T14:32:59.010";
found = handle(START_PATH, query);
assertEquals(3, found.size());
- query = "[jcr:content/created] > '2013-08-07T14:32'";
+ query = "[jcr:content/created] > 2013-08-07T14:32";
found = handle(START_PATH, query);
assertEquals(3, found.size());
- query = "[jcr:content/created] greater than '2013-08-07T14:32:59'";
+ query = "[jcr:content/created] greater than 2013-08-07T14:32:59";
found = handle(START_PATH, query);
assertEquals(2, found.size());
- query = "[jcr:content/created] >= '2013-08-07T14:32:59'";
+ query = "[jcr:content/created] >= 2013-08-07T14:32:59";
found = handle(START_PATH, query);
assertEquals(3, found.size());
diff --git a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterLogicTest.java b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterLogicTest.java
index 4608098..7f52409 100644
--- a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterLogicTest.java
+++ b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterLogicTest.java
@@ -19,7 +19,7 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.parser.ParseException;
+import org.apache.sling.resource.stream.impl.ParseException;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.junit.Before;
import org.junit.Rule;
diff --git a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterTest.java b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterTest.java
index 840cbcf..6922768 100644
--- a/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterTest.java
+++ b/streams/src/test/java/org/apache/sling/resource/stream/ResourceFilterTest.java
@@ -22,9 +22,7 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.ResourceFilter;
-import org.apache.sling.resource.stream.ResourceStream;
-import org.apache.sling.resource.stream.parser.ParseException;
+import org.apache.sling.resource.stream.impl.ParseException;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.junit.Before;
import org.junit.Rule;
@@ -154,7 +152,7 @@ public class ResourceFilterTest {
List<Resource> found = handle(START_PATH, query);
assertEquals(5, found.size());
}
-
+
@Test
public void testNotProperty() throws ParseException {
String query = "[layout] != 'foo' ";
@@ -255,7 +253,8 @@ public class ResourceFilterTest {
} catch (ParseException e) {
error = e;
}
- assert(error.getMessage().startsWith("Encountered \" <PROPERTY> \"jcr:content/monkey \"\" at line 1, column 15."));
+ assert (error.getMessage()
+ .startsWith("Encountered \" <PROPERTY> \"jcr:content/monkey \"\" at line 1, column 15."));
}
private List<Resource> handle(String path, String filter) throws ParseException {
--
To stop receiving notification emails like this one, please contact
jeb@apache.org.