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/18 19:27:33 UTC
[sling-whiteboard] branch master updated: implemented filter
factory - conversion to spaces
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 ac7d405 implemented filter factory - conversion to spaces
ac7d405 is described below
commit ac7d405c92385f74064d574d61f491bae09abc54
Author: JE Bailey <ja...@sas.com>
AuthorDate: Fri May 18 15:27:11 2018 -0400
implemented filter factory - conversion to spaces
---
streams/pom.xml | 35 +
.../sling/resource/stream/ResourceFilter.java | 54 +-
.../sling/resource/stream/ResourceStream.java | 382 +--
.../apache/sling/resource/stream/api/Context.java | 36 +-
.../resource/stream/api/CustomFilteFunction.java | 42 +
.../sling/resource/stream/api/FilterFunction.java | 42 -
.../{Visitor.java => ResourceFilterFactory.java} | 14 +-
.../apache/sling/resource/stream/api/Visitor.java | 10 +-
.../stream/api/impl/ComparisonVisitor.java | 137 +-
.../resource/stream/api/impl/DefaultContext.java | 130 +-
.../resource/stream/api/impl/InstantProvider.java | 47 +-
.../resource/stream/api/impl/LogicVisitor.java | 97 +-
.../stream/api/impl/ResourceFactoryImpl.java | 36 +
.../sling/resource/stream/impl/FilterParser.java | 958 +++---
.../stream/impl/FilterParserConstants.java | 236 +-
.../stream/impl/FilterParserTokenManager.java | 3499 ++++++++++----------
.../sling/resource/stream/impl/ParseException.java | 319 +-
.../resource/stream/impl/SimpleCharStream.java | 853 +++--
.../apache/sling/resource/stream/impl/Token.java | 229 +-
.../sling/resource/stream/impl/TokenMgrError.java | 250 +-
.../sling/resource/stream/impl/node/Node.java | 125 +-
.../predicates/ComparisonPredicateFactory.java | 68 +-
.../impl/predicates/ComparisonPredicates.java | 671 ++--
.../resource/stream/impl/predicates/Null.java | 74 +-
.../stream/predicates/ChildResourcePredicates.java | 68 +-
.../resource/stream/predicates/Conditions.java | 71 +-
.../stream/predicates/PropertyPredicates.java | 537 ++-
.../stream/predicates/ResourcePredicates.java | 36 +-
28 files changed, 4500 insertions(+), 4556 deletions(-)
diff --git a/streams/pom.xml b/streams/pom.xml
index 3a8eee1..d8923d3 100644
--- a/streams/pom.xml
+++ b/streams/pom.xml
@@ -58,6 +58,41 @@
</executions>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.codehaus.mojo
+ </groupId>
+ <artifactId>
+ javacc-maven-plugin
+ </artifactId>
+ <versionRange>
+ [2.6,)
+ </versionRange>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencies>
<dependency>
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 937c269..d5fbcec 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
@@ -27,31 +27,31 @@ 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(getContext().getLogicVisitor());
- }
-
- @Override
- public boolean test(Resource 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;
- }
-
+ 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(getContext().getLogicVisitor());
+ }
+
+ @Override
+ public boolean test(Resource 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 dd554cc..25180b9 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
@@ -36,197 +36,199 @@ import org.apache.sling.resource.stream.impl.ParseException;
*/
public class ResourceStream {
- // starting resource
- private Resource resource;
+ // starting resource
+ private Resource resource;
- private long limit = 0;
+ private long limit = 0;
+
+ private long startOfRange;
+
+ // determine if a given child of a resource should be traversed
+ private Predicate<Resource> branchSelector = resource -> true;
- private long startOfRange;
-
- // determine if a given child of a resource should be traversed
- private Predicate<Resource> branchSelector = resource -> true;
-
// determine if a given resource should be added to the stream
- private Predicate<Resource> resourceSelector = resource -> true;
-
- /**
- * Base resource for traversal
- *
- * @param resource
- * traversal starting point
- * @return new instance of ResourceQuery;
- */
- public static ResourceStream from(@Nonnull Resource resource) {
- return new ResourceStream(resource);
- }
-
- /*
- * Constructor to establish the starting resource
- *
- * @param resource
- */
- private ResourceStream(Resource resource) {
- this.resource = Objects.requireNonNull(resource);
- }
-
- /**
- * Sets the maximum number of items to be returned. Starting from
- * the first matching resource. This method is mutually exclusive to the range
- * method
- *
- * @param number
- * maximum number of items to be returned
- * @return ResourceStream
- */
- public ResourceStream limit(long number) {
- if (number < 0) {
- throw new IllegalArgumentException("value may not be negative");
- }
- this.startOfRange = 0;
- this.limit = number;
- return this;
- }
-
- /**
- * Sets the maximum number of items to be returned. Starting from
- * the nth identified resource as defined by the startOfRange. This method is
- * mutually exclusive to the limit method
- *
- * @param startOfRange index of the first resource to be returned
- * @param limit maximum number of resources to be returned
- * @return ResourceStream
- */
- public ResourceStream range(long startOfRange, long limit) {
- if (startOfRange < 0 || limit < 0) {
- throw new IllegalArgumentException("value may not be negative");
- }
- this.startOfRange = startOfRange;
- this.limit = limit;
- return this;
- }
-
- /**
- * Resets the starting path for the tree traversal.
- *
- * @param path
- * set the internal resource to path
- * @return ResourceStream
- */
- public ResourceStream startingFrom(String path) {
- this.resource = Objects.requireNonNull(resource.getResourceResolver().getResource(path));
- return this;
- }
-
- /**
- * Predicate used to select child resources for traversal
- *
- * @param branchSelector
- * resourceFilter script for traversal control
- * @return ResourceStream
- * @throws ParseException
- */
- public ResourceStream setBranchSelector(String branchSelector) throws ParseException {
- return setBranchSelector(new ResourceFilter(branchSelector));
- }
-
- /**
- * Predicate used to select child resources for traversal
- *
- * @param branchSelector
- * predicate for traversal control
- * @return ResourceStream
- */
- public ResourceStream setBranchSelector(Predicate<Resource> branchSelector) {
- this.branchSelector = Objects.requireNonNull(branchSelector);
- return this;
- }
-
- /**
- * ResourceFilter script to identify Resource objects to add to the Stream<Resource>
- *
- * @param resourceSelector
- * ResourceFilter script
- * @return ResourceStream
- * @throws ParseException
- */
- public ResourceStream setResourceSelector(String resourceSelector) throws ParseException {
- return setResourceSelector(new ResourceFilter(resourceSelector));
- }
-
- /**
- * Sets a resource selector which defines whether a given resource should be part
- * of the stream
- *
- * @param resourceSelector
- * identifies resource for Stream<Resource>
- * @return ResourceStream
- */
- public ResourceStream setResourceSelector(Predicate<Resource> resourceSelector) {
- this.resourceSelector = Objects.requireNonNull(resourceSelector);
- return this;
- }
-
- /**
- * Provides a stream of resources starting from the initiator resource and
- * traversing through it's descendants
- *
- * @return self closing {@code Stream<Resource>} of unknown size.
- */
- public Stream<Resource> stream() {
- return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<Resource>() {
-
- private final LinkedList<Resource> resourcesToCheck = new LinkedList<>();
-
- final AtomicInteger index = new AtomicInteger(0);
-
- {
- resourcesToCheck.addFirst(resource);
- }
-
- Resource current;
-
- @Override
- public boolean hasNext() {
- do {
- if (resourcesToCheck.isEmpty()) {
- return false;
- }
-
- current = resourcesToCheck.removeFirst();
-
- current.listChildren().forEachRemaining(child -> {
- if (branchSelector.test(child)) {
- resourcesToCheck.add(index.getAndIncrement(), child);
- }
- });
-
- index.set(0);
-
- if (startOfRange > 0) {
- --startOfRange;
- }
- if (limit > 0 && startOfRange == 0) {
- if (--limit == 0) {
- resourcesToCheck.clear();
- }
- }
- } while (startOfRange > 0 || !resourceSelector.test(current));
- return true;
- }
-
- @Override
- public Resource next() {
- return current;
- }
- }, Spliterator.ORDERED | Spliterator.IMMUTABLE), false);
- }
-
- /**
- * Perform the consumer on each Resource in the defined Stream
- *
- * @param consumer
- */
- public void forEach(Consumer<Resource> consumer) {
- stream().forEach(consumer);
- }
+ private Predicate<Resource> resourceSelector = resource -> true;
+
+ /**
+ * Base resource for traversal
+ *
+ * @param resource
+ * traversal starting point
+ * @return new instance of ResourceQuery;
+ */
+ public static ResourceStream from(@Nonnull Resource resource) {
+ return new ResourceStream(resource);
+ }
+
+ /*
+ * Constructor to establish the starting resource
+ *
+ * @param resource
+ */
+ private ResourceStream(Resource resource) {
+ this.resource = Objects.requireNonNull(resource);
+ }
+
+ /**
+ * Sets the maximum number of items to be returned. Starting from the first
+ * matching resource. This method is mutually exclusive to the range method
+ *
+ * @param number
+ * maximum number of items to be returned
+ * @return ResourceStream
+ */
+ public ResourceStream limit(long number) {
+ if (number < 0) {
+ throw new IllegalArgumentException("value may not be negative");
+ }
+ this.startOfRange = 0;
+ this.limit = number;
+ return this;
+ }
+
+ /**
+ * Sets the maximum number of items to be returned. Starting from the nth
+ * identified resource as defined by the startOfRange. This method is mutually
+ * exclusive to the limit method
+ *
+ * @param startOfRange
+ * index of the first resource to be returned
+ * @param limit
+ * maximum number of resources to be returned
+ * @return ResourceStream
+ */
+ public ResourceStream range(long startOfRange, long limit) {
+ if (startOfRange < 0 || limit < 0) {
+ throw new IllegalArgumentException("value may not be negative");
+ }
+ this.startOfRange = startOfRange;
+ this.limit = limit;
+ return this;
+ }
+
+ /**
+ * Resets the starting path for the tree traversal.
+ *
+ * @param path
+ * set the internal resource to path
+ * @return ResourceStream
+ */
+ public ResourceStream startingFrom(String path) {
+ this.resource = Objects.requireNonNull(resource.getResourceResolver().getResource(path));
+ return this;
+ }
+
+ /**
+ * Predicate used to select child resources for traversal
+ *
+ * @param branchSelector
+ * resourceFilter script for traversal control
+ * @return ResourceStream
+ * @throws ParseException
+ */
+ public ResourceStream setBranchSelector(String branchSelector) throws ParseException {
+ return setBranchSelector(new ResourceFilter(branchSelector));
+ }
+
+ /**
+ * Predicate used to select child resources for traversal
+ *
+ * @param branchSelector
+ * predicate for traversal control
+ * @return ResourceStream
+ */
+ public ResourceStream setBranchSelector(Predicate<Resource> branchSelector) {
+ this.branchSelector = Objects.requireNonNull(branchSelector);
+ return this;
+ }
+
+ /**
+ * ResourceFilter script to identify Resource objects to add to the
+ * Stream<Resource>
+ *
+ * @param resourceSelector
+ * ResourceFilter script
+ * @return ResourceStream
+ * @throws ParseException
+ */
+ public ResourceStream setResourceSelector(String resourceSelector) throws ParseException {
+ return setResourceSelector(new ResourceFilter(resourceSelector));
+ }
+
+ /**
+ * Sets a resource selector which defines whether a given resource should be
+ * part of the stream
+ *
+ * @param resourceSelector
+ * identifies resource for Stream<Resource>
+ * @return ResourceStream
+ */
+ public ResourceStream setResourceSelector(Predicate<Resource> resourceSelector) {
+ this.resourceSelector = Objects.requireNonNull(resourceSelector);
+ return this;
+ }
+
+ /**
+ * Provides a stream of resources starting from the initiator resource and
+ * traversing through it's descendants
+ *
+ * @return self closing {@code Stream<Resource>} of unknown size.
+ */
+ public Stream<Resource> stream() {
+ return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<Resource>() {
+
+ private final LinkedList<Resource> resourcesToCheck = new LinkedList<>();
+
+ final AtomicInteger index = new AtomicInteger(0);
+
+ {
+ resourcesToCheck.addFirst(resource);
+ }
+
+ Resource current;
+
+ @Override
+ public boolean hasNext() {
+ do {
+ if (resourcesToCheck.isEmpty()) {
+ return false;
+ }
+
+ current = resourcesToCheck.removeFirst();
+
+ current.listChildren().forEachRemaining(child -> {
+ if (branchSelector.test(child)) {
+ resourcesToCheck.add(index.getAndIncrement(), child);
+ }
+ });
+
+ index.set(0);
+
+ if (startOfRange > 0) {
+ --startOfRange;
+ }
+ if (limit > 0 && startOfRange == 0) {
+ if (--limit == 0) {
+ resourcesToCheck.clear();
+ }
+ }
+ } while (startOfRange > 0 || !resourceSelector.test(current));
+ return true;
+ }
+
+ @Override
+ public Resource next() {
+ return current;
+ }
+ }, Spliterator.ORDERED | Spliterator.IMMUTABLE), false);
+ }
+
+ /**
+ * Perform the consumer on each Resource in the defined Stream
+ *
+ * @param consumer
+ */
+ public void forEach(Consumer<Resource> consumer) {
+ stream().forEach(consumer);
+ }
}
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
index 984dc91..f97c111 100644
--- 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
@@ -22,23 +22,23 @@ 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);
+
+ Context addFunction(String name, BiFunction<List<Function<Resource, Object>>, Resource, Object> functionImpl);
+
+ 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/api/CustomFilteFunction.java b/streams/src/main/java/org/apache/sling/resource/stream/api/CustomFilteFunction.java
new file mode 100644
index 0000000..67b4459
--- /dev/null
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/CustomFilteFunction.java
@@ -0,0 +1,42 @@
+/*
+ * 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.function.BiFunction;
+import java.util.function.Function;
+
+import org.apache.sling.api.resource.Resource;
+
+/**
+ * A CustomFilterFunction implementation is used to translate a command in a
+ * script or an Object that is a result of a custom function into a value that
+ * is used for Comparison
+ *
+ */
+public interface CustomFilteFunction extends BiFunction<List<Function<Resource, Object>>, Resource, Object> {
+
+ /**
+ * 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 Object} which should be a String, Instant, or Number to be
+ * used as part of a comparison or Function
+ */
+ Object apply(List<Function<Resource, Object>> arguments, Resource resource);
+
+}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java b/streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java
deleted file mode 100644
index 5be5863..0000000
--- a/streams/src/main/java/org/apache/sling/resource/stream/api/FilterFunction.java
+++ /dev/null
@@ -1,42 +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.api;
-
-import java.util.List;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
-import org.apache.sling.api.resource.Resource;
-
-/**
- * A ResourceFilterFunction implementation is used to translate a String from a script or
- * an Object as a result of a custom function into a value that is used for
- * Comparison
- *
- */
-public interface FilterFunction extends BiFunction<List<Function<Resource, Object>>, Resource, Object> {
-
- /**
- * 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 Object} which should be a String, Instant, or Number to
- * be used as part of a comparison or Function
- */
- Object apply(List<Function<Resource, Object>> arguments, Resource resource);
-
-}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/ResourceFilterFactory.java
similarity index 64%
copy from streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
copy to streams/src/main/java/org/apache/sling/resource/stream/api/ResourceFilterFactory.java
index c7e439f..2fa2177 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/ResourceFilterFactory.java
@@ -13,16 +13,10 @@
*/
package org.apache.sling.resource.stream.api;
-import org.apache.sling.resource.stream.impl.node.Node;
+import org.apache.sling.resource.stream.ResourceFilter;
-/**
- * An interface for visiting AST nodes of the RSQL.
- *
- * @param <R> Return type of the visitor's method.
- * @param <A> Type of an optional parameter passed to the visitor's method.
- */
-public interface Visitor<R> {
+public interface ResourceFilterFactory {
+
+ ResourceFilter getResourceFilter();
- R visit(Node abstractNode);
-
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
index c7e439f..8e61536 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/Visitor.java
@@ -18,11 +18,13 @@ import org.apache.sling.resource.stream.impl.node.Node;
/**
* An interface for visiting AST nodes of the RSQL.
*
- * @param <R> Return type of the visitor's method.
- * @param <A> Type of an optional parameter passed to the visitor's method.
+ * @param <R>
+ * Return type of the visitor's method.
+ * @param <A>
+ * Type of an optional parameter passed to the visitor's method.
*/
public interface Visitor<R> {
- R visit(Node abstractNode);
-
+ R visit(Node abstractNode);
+
}
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
index 3ef85ff..b8d3fd4 100644
--- 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
@@ -35,76 +35,77 @@ import org.apache.sling.resource.stream.impl.predicates.Null;
public class ComparisonVisitor implements Visitor<Function<Resource, Object>> {
- private Context context;
+ private Context context;
- public ComparisonVisitor(Context context) {
- this.context = context;
- context.setComparionVisitor(this);
- }
+ 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;
- }
+ @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);
- }
+ 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
index 74dd85b..8904393 100644
--- 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
@@ -27,71 +27,71 @@ 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;
- }
+ 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> functionImpl) {
+ functions.put(name, functionImpl);
+ 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/api/impl/InstantProvider.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
index 61c4a9c..100916d 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/InstantProvider.java
@@ -21,11 +21,12 @@ import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.function.Function;
+import org.apache.felix.scr.annotations.Component;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.resource.stream.api.FilterFunction;
+import org.apache.sling.resource.stream.api.CustomFilteFunction;
/**
- * Implementation of {@link FilterFunction} for the 'date' function.
+ * Implementation of {@link CustomFilteFunction} for the 'date' function.
*
* The following combination of arguments are supported
*
@@ -39,26 +40,28 @@ import org.apache.sling.resource.stream.api.FilterFunction;
* </pre>
*
*/
-public class InstantProvider implements FilterFunction {
+@Component
- @Override
- 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();
- }
+public class InstantProvider implements CustomFilteFunction {
- }
+ @Override
+ 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/api/impl/LogicVisitor.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
index fc42a4f..24b21e3 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/LogicVisitor.java
@@ -33,59 +33,58 @@ import org.apache.sling.resource.stream.impl.predicates.ComparisonPredicateFacto
*/
public class LogicVisitor implements Visitor<Predicate<Resource>> {
- private Context context;
+ private Context context;
- public LogicVisitor(Context context) {
- this.context = context;
- context.setLogicVisitor(this);
- }
+ public LogicVisitor(Context context) {
+ this.context = context;
+ context.setLogicVisitor(this);
+ }
- @Override
- public Predicate<Resource> visit(Node node) {
- switch (node.kind) {
- case FilterParserConstants.AND:
- return createAndPredicate(node);
- case FilterParserConstants.OR:
- return createOrPredicate(node);
- default:
- return createComparisonPredicate(node);
- }
- }
+ @Override
+ public Predicate<Resource> visit(Node node) {
+ switch (node.kind) {
+ case FilterParserConstants.AND:
+ return createAndPredicate(node);
+ case FilterParserConstants.OR:
+ return createOrPredicate(node);
+ default:
+ return createComparisonPredicate(node);
+ }
+ }
- private Predicate<Resource> createAndPredicate(Node node) {
- return node.children.stream().map(child -> {
- return visit(child);
- }).reduce(null, (predicate, accumulator) -> {
- if (predicate == null) {
- return accumulator;
- }
- return accumulator.and(predicate);
- });
- }
+ private Predicate<Resource> createAndPredicate(Node node) {
+ return node.children.stream().map(child -> {
+ return visit(child);
+ }).reduce(null, (predicate, accumulator) -> {
+ if (predicate == null) {
+ return accumulator;
+ }
+ return accumulator.and(predicate);
+ });
+ }
- /**
- * Returns a predicate which consists of a series of Or statements
- *
- * @param node
- * @param param
- * @return
- */
- private Predicate<Resource> createOrPredicate(Node node) {
- return node.children.stream().map(child -> {
- return visit(child);
- }).reduce(null, (predicate, accumulator) -> {
- if (predicate == null) {
- return accumulator;
- }
- return accumulator.or(predicate);
- });
- }
-
- private Predicate<Resource> createComparisonPredicate(Node comparisonNode) {
- 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);
- }
+ /**
+ * Returns a predicate which consists of a series of Or statements
+ *
+ * @param node
+ * @param param
+ * @return
+ */
+ private Predicate<Resource> createOrPredicate(Node node) {
+ return node.children.stream().map(child -> {
+ return visit(child);
+ }).reduce(null, (predicate, accumulator) -> {
+ if (predicate == null) {
+ return accumulator;
+ }
+ return accumulator.or(predicate);
+ });
+ }
+ private Predicate<Resource> createComparisonPredicate(Node comparisonNode) {
+ 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);
+ }
}
\ No newline at end of file
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ResourceFactoryImpl.java b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ResourceFactoryImpl.java
new file mode 100644
index 0000000..d5416e0
--- /dev/null
+++ b/streams/src/main/java/org/apache/sling/resource/stream/api/impl/ResourceFactoryImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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.List;
+
+import org.apache.sling.resource.stream.ResourceFilter;
+import org.apache.sling.resource.stream.api.CustomFilteFunction;
+import org.apache.sling.resource.stream.api.ResourceFilterFactory;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(property = { "service.description=ResourceFilter Factory", "service.vendor=The Apache Software Foundation" })
+public class ResourceFactoryImpl implements ResourceFilterFactory {
+
+ @Reference
+ List<CustomFilteFunction> functions;
+
+ @Override
+ public ResourceFilter getResourceFilter() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
index 597ac1d..1ed9ed9 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParser.java
@@ -7,472 +7,532 @@ import org.apache.sling.resource.stream.impl.node.*;
public final class FilterParser implements FilterParserConstants {
- final public Node parse() throws ParseException {
- final Node node;
- node = or();
- jj_consume_token(0);
- {if (true) return node;}
- throw new Error("Missing return statement in function");
- }
-
- final public Node or() throws ParseException {
- final List < Node > nodes = new ArrayList < Node > (3);
- Node node;
- node = and();
- nodes.add(node);
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case OR:
- ;
- break;
- default:
- jj_la1[0] = jj_gen;
- break label_1;
- }
- jj_consume_token(OR);
- node = and();
- nodes.add(node);
+ final public Node parse() throws ParseException {
+ final Node node;
+ node = or();
+ jj_consume_token(0);
+ {
+ if (true)
+ return node;
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return nodes.size() != 1 ? new Node(FilterParserConstants.OR, nodes) : nodes.get(0);}
- throw new Error("Missing return statement in function");
- }
-
- final public Node and() throws ParseException {
- final List < Node > nodes = new ArrayList < Node > (3);
- Node node;
- node = constraint();
- nodes.add(node);
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND:
- ;
- break;
- default:
- jj_la1[1] = jj_gen;
- break label_2;
- }
- jj_consume_token(AND);
- node = constraint();
- nodes.add(node);
+
+ final public Node or() throws ParseException {
+ final List<Node> nodes = new ArrayList<Node>(3);
+ Node node;
+ node = and();
+ nodes.add(node);
+ label_1: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case OR:
+ ;
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ break label_1;
+ }
+ jj_consume_token(OR);
+ node = and();
+ nodes.add(node);
+ }
+ {
+ if (true)
+ return nodes.size() != 1 ? new Node(FilterParserConstants.OR, nodes) : nodes.get(0);
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return nodes.size() != 1 ? new Node(FilterParserConstants.AND, nodes) : nodes.get(0);}
- throw new Error("Missing return statement in function");
- }
-
- final public Node constraint() throws ParseException {
- final Node node;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LPAREN:
- node = group();
- break;
- case OFFSETDATETIME:
- case DATETIME:
- case DATE:
- case NUMBER:
- case STRING:
- case NULL:
- case BOOLEAN:
- case FUNCTION_NAME:
- case PROPERTY:
- node = comparison();
- break;
- default:
- jj_la1[2] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+
+ final public Node and() throws ParseException {
+ final List<Node> nodes = new ArrayList<Node>(3);
+ Node node;
+ node = constraint();
+ nodes.add(node);
+ label_2: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case AND:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_2;
+ }
+ jj_consume_token(AND);
+ node = constraint();
+ nodes.add(node);
+ }
+ {
+ if (true)
+ return nodes.size() != 1 ? new Node(FilterParserConstants.AND, nodes) : nodes.get(0);
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return node;}
- throw new Error("Missing return statement in function");
- }
-
- final public Node group() throws ParseException {
- final Node node;
- jj_consume_token(LPAREN);
- node = or();
- jj_consume_token(RPAREN);
- {if (true) return node;}
- throw new Error("Missing return statement in function");
- }
-
- final public Node comparison() throws ParseException {
- Node leftValue;
- Token op;
- Node rightValue;
- leftValue = argument();
- op = comparisonValue();
- rightValue = argument();
- {if (true) return new Node(op.kind, op.image, leftValue, rightValue);}
- throw new Error("Missing return statement in function");
- }
-
- final public Token comparisonValue() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQUAL:
- jj_consume_token(EQUAL);
- break;
- case NOT_EQUAL:
- jj_consume_token(NOT_EQUAL);
- break;
- case GREATER_THAN:
- jj_consume_token(GREATER_THAN);
- break;
- case GREATER_THAN_OR_EQUAL:
- jj_consume_token(GREATER_THAN_OR_EQUAL);
- break;
- case LESS_THAN:
- jj_consume_token(LESS_THAN);
- break;
- case LESS_THAN_OR_EQUAL:
- jj_consume_token(LESS_THAN_OR_EQUAL);
- break;
- case LIKE:
- jj_consume_token(LIKE);
- break;
- case LIKE_NOT:
- jj_consume_token(LIKE_NOT);
- break;
- case CONTAINS:
- jj_consume_token(CONTAINS);
- break;
- case CONTAINS_NOT:
- jj_consume_token(CONTAINS_NOT);
- break;
- case CONTAINS_ANY:
- jj_consume_token(CONTAINS_ANY);
- break;
- case CONTAINS_NOT_ANY:
- jj_consume_token(CONTAINS_NOT_ANY);
- break;
- case IN:
- jj_consume_token(IN);
- break;
- case NOT_IN:
- jj_consume_token(NOT_IN);
- break;
- default:
- jj_la1[3] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+
+ final public Node constraint() throws ParseException {
+ final Node node;
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ node = group();
+ break;
+ case OFFSETDATETIME:
+ case DATETIME:
+ case DATE:
+ case NUMBER:
+ case STRING:
+ case NULL:
+ case BOOLEAN:
+ case FUNCTION_NAME:
+ case PROPERTY:
+ node = comparison();
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {
+ if (true)
+ return node;
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return token;}
- throw new Error("Missing return statement in function");
- }
-
- final public List < Node > Arguments() throws ParseException {
- 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:
- case NULL:
- case BOOLEAN:
- case FUNCTION_NAME:
- case PROPERTY:
- value = commaSepArguments();
- break;
- default:
- jj_la1[4] = jj_gen;
- ;
+
+ final public Node group() throws ParseException {
+ final Node node;
+ jj_consume_token(LPAREN);
+ node = or();
+ jj_consume_token(RPAREN);
+ {
+ if (true)
+ return node;
+ }
+ throw new Error("Missing return statement in function");
}
- jj_consume_token(RPAREN);
- {if (true) return (List) value;}
- throw new Error("Missing return statement in function");
- }
-
- final public List < Node > commaSepArguments() throws ParseException {
- final List < Node > list = new ArrayList < Node > (3);
- Node arg;
- arg = argument();
- list.add(arg);
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_3;
- }
- jj_consume_token(COMMA);
- arg = argument();
- list.add(arg);
+
+ final public Node comparison() throws ParseException {
+ Node leftValue;
+ Token op;
+ Node rightValue;
+ leftValue = argument();
+ op = comparisonValue();
+ rightValue = argument();
+ {
+ if (true)
+ return new Node(op.kind, op.image, leftValue, rightValue);
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return list;}
- throw new Error("Missing return statement in function");
- }
-
- 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:
- case NULL:
- case BOOLEAN:
- selector = literal();
- break;
- case PROPERTY:
- selector = property();
- break;
- case FUNCTION_NAME:
- selector = function();
- break;
- default:
- jj_la1[6] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+
+ final public Token comparisonValue() throws ParseException {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EQUAL:
+ jj_consume_token(EQUAL);
+ break;
+ case NOT_EQUAL:
+ jj_consume_token(NOT_EQUAL);
+ break;
+ case GREATER_THAN:
+ jj_consume_token(GREATER_THAN);
+ break;
+ case GREATER_THAN_OR_EQUAL:
+ jj_consume_token(GREATER_THAN_OR_EQUAL);
+ break;
+ case LESS_THAN:
+ jj_consume_token(LESS_THAN);
+ break;
+ case LESS_THAN_OR_EQUAL:
+ jj_consume_token(LESS_THAN_OR_EQUAL);
+ break;
+ case LIKE:
+ jj_consume_token(LIKE);
+ break;
+ case LIKE_NOT:
+ jj_consume_token(LIKE_NOT);
+ break;
+ case CONTAINS:
+ jj_consume_token(CONTAINS);
+ break;
+ case CONTAINS_NOT:
+ jj_consume_token(CONTAINS_NOT);
+ break;
+ case CONTAINS_ANY:
+ jj_consume_token(CONTAINS_ANY);
+ break;
+ case CONTAINS_NOT_ANY:
+ jj_consume_token(CONTAINS_NOT_ANY);
+ break;
+ case IN:
+ jj_consume_token(IN);
+ break;
+ case NOT_IN:
+ jj_consume_token(NOT_IN);
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {
+ if (true)
+ return token;
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return selector;}
- throw new Error("Missing return statement in function");
- }
-
- final public Node function() throws ParseException {
- String functionName = null;
- List < Node > children = null;
- jj_consume_token(FUNCTION_NAME);
- 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:
- case NULL:
- case BOOLEAN:
- case FUNCTION_NAME:
- case PROPERTY:
- children = commaSepArguments();
- break;
- default:
- jj_la1[7] = jj_gen;
- ;
+
+ final public List<Node> Arguments() throws ParseException {
+ 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:
+ case NULL:
+ case BOOLEAN:
+ case FUNCTION_NAME:
+ case PROPERTY:
+ value = commaSepArguments();
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPAREN);
+ {
+ if (true)
+ return (List) value;
+ }
+ throw new Error("Missing return statement in function");
}
- jj_consume_token(RPAREN);
- {if (true) return new Node(FilterParserConstants.FUNCTION_NAME, functionName, children);}
- throw new Error("Missing return statement in function");
- }
-
- final public Node literal() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING:
- jj_consume_token(STRING);
- break;
- case NUMBER:
- jj_consume_token(NUMBER);
- break;
- case NULL:
- jj_consume_token(NULL);
- break;
- case BOOLEAN:
- jj_consume_token(BOOLEAN);
- break;
- 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);
- throw new ParseException();
+
+ final public List<Node> commaSepArguments() throws ParseException {
+ final List<Node> list = new ArrayList<Node>(3);
+ Node arg;
+ arg = argument();
+ list.add(arg);
+ label_3: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_3;
+ }
+ jj_consume_token(COMMA);
+ arg = argument();
+ list.add(arg);
+ }
+ {
+ if (true)
+ return list;
+ }
+ throw new Error("Missing return statement in function");
}
- {if (true) return new Node(token.kind, token.image);}
- throw new Error("Missing return statement in function");
- }
-
- final public Node property() throws ParseException {
- jj_consume_token(PROPERTY);
- {if (true) return new Node(token.kind, token.image);}
- throw new Error("Missing return statement in function");
- }
-
- /** Generated Token Manager. */
- public FilterParserTokenManager token_source;
- SimpleCharStream jj_input_stream;
- /** Current token. */
- public Token token;
- /** Next token. */
- public Token jj_nt;
- private int jj_ntk;
- private int jj_gen;
- final private int[] jj_la1 = new int[9];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
- static {
- jj_la1_init_0();
- jj_la1_init_1();
- }
- private static void jj_la1_init_0() {
- 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,0xc00,0x3ff,0xc00,0x0,0xc00,0xc00,0x0,};
- }
-
- /** Constructor with InputStream. */
- public FilterParser(java.io.InputStream stream) {
- this(stream, null);
- }
- /** Constructor with InputStream and supplied encoding */
- public FilterParser(java.io.InputStream stream, String encoding) {
- try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source = new FilterParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream) {
- ReInit(stream, null);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream, String encoding) {
- try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- /** Constructor. */
- public FilterParser(java.io.Reader stream) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new FilterParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- /** Constructor with generated Token Manager. */
- public FilterParser(FilterParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(FilterParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 9; i++) jj_la1[i] = -1;
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- return token;
+
+ 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:
+ case NULL:
+ case BOOLEAN:
+ selector = literal();
+ break;
+ case PROPERTY:
+ selector = property();
+ break;
+ case FUNCTION_NAME:
+ selector = function();
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {
+ if (true)
+ return selector;
+ }
+ throw new Error("Missing return statement in function");
}
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
-
-/** Get the next Token. */
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
-/** Get the specific Token. */
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
+
+ final public Node function() throws ParseException {
+ String functionName = null;
+ List<Node> children = null;
+ jj_consume_token(FUNCTION_NAME);
+ 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:
+ case NULL:
+ case BOOLEAN:
+ case FUNCTION_NAME:
+ case PROPERTY:
+ children = commaSepArguments();
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ ;
+ }
+ jj_consume_token(RPAREN);
+ {
+ if (true)
+ return new Node(FilterParserConstants.FUNCTION_NAME, functionName, children);
+ }
+ throw new Error("Missing return statement in function");
}
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
- private int[] jj_expentry;
- private int jj_kind = -1;
-
- /** Generate ParseException. */
- public ParseException generateParseException() {
- jj_expentries.clear();
- boolean[] la1tokens = new boolean[45];
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
+
+ final public Node literal() throws ParseException {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STRING:
+ jj_consume_token(STRING);
+ break;
+ case NUMBER:
+ jj_consume_token(NUMBER);
+ break;
+ case NULL:
+ jj_consume_token(NULL);
+ break;
+ case BOOLEAN:
+ jj_consume_token(BOOLEAN);
+ break;
+ 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);
+ throw new ParseException();
+ }
+ {
+ if (true)
+ return new Node(token.kind, token.image);
+ }
+ throw new Error("Missing return statement in function");
}
- for (int i = 0; i < 9; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- if ((jj_la1_1[i] & (1<<j)) != 0) {
- la1tokens[32+j] = true;
- }
+
+ final public Node property() throws ParseException {
+ jj_consume_token(PROPERTY);
+ {
+ if (true)
+ return new Node(token.kind, token.image);
}
- }
+ throw new Error("Missing return statement in function");
}
- for (int i = 0; i < 45; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.add(jj_expentry);
- }
+
+ /** Generated Token Manager. */
+ public FilterParserTokenManager token_source;
+ SimpleCharStream jj_input_stream;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
+ private int jj_ntk;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[9];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static {
+ jj_la1_init_0();
+ jj_la1_init_1();
}
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = jj_expentries.get(i);
+
+ private static void jj_la1_init_0() {
+ jj_la1_0 = new int[] { 0x400000, 0x200000, 0x9843c00, 0xf0000000, 0x8843c00, 0x4000000, 0x8843c00, 0x8843c00,
+ 0x8843c00, };
}
- return new ParseException(token, exptokseq, tokenImage);
- }
- /** Enable tracing. */
- final public void enable_tracing() {
- }
+ private static void jj_la1_init_1() {
+ jj_la1_1 = new int[] { 0x0, 0x0, 0xc00, 0x3ff, 0xc00, 0x0, 0xc00, 0xc00, 0x0, };
+ }
- /** Disable tracing. */
- final public void disable_tracing() {
- }
+ /** Constructor with InputStream. */
+ public FilterParser(java.io.InputStream stream) {
+ this(stream, null);
+ }
+
+ /** Constructor with InputStream and supplied encoding */
+ public FilterParser(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source = new FilterParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream.ReInit(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ /** Constructor. */
+ public FilterParser(java.io.Reader stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new FilterParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ /** Constructor with generated Token Manager. */
+ public FilterParser(FilterParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(FilterParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 9; i++)
+ jj_la1[i] = -1;
+ }
+
+ private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null)
+ token = token.next;
+ else
+ token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ /** Get the next Token. */
+ final public Token getNextToken() {
+ if (token.next != null)
+ token = token.next;
+ else
+ token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ /** Get the specific Token. */
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null)
+ t = t.next;
+ else
+ t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ private int jj_ntk() {
+ if ((jj_nt = token.next) == null)
+ return (jj_ntk = (token.next = token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+
+ /** Generate ParseException. */
+ public ParseException generateParseException() {
+ jj_expentries.clear();
+ boolean[] la1tokens = new boolean[45];
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 9; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1 << j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1 << j)) != 0) {
+ la1tokens[32 + j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 45; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.add(jj_expentry);
+ }
+ }
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = jj_expentries.get(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ /** Enable tracing. */
+ final public void enable_tracing() {
+ }
+
+ /** Disable tracing. */
+ final public void disable_tracing() {
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
index 6147449..d679d76 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserConstants.java
@@ -1,150 +1,108 @@
/* Generated By:JavaCC: Do not edit this line. FilterParserConstants.java */
package org.apache.sling.resource.stream.impl;
-
/**
- * Token literal values and constants.
- * Generated by org.javacc.parser.OtherFilesGen#start()
+ * Token literal values and constants. Generated by
+ * org.javacc.parser.OtherFilesGen#start()
*/
public interface FilterParserConstants {
- /** End of File. */
- int EOF = 0;
- /** RegularExpression Id. */
- int PLUS = 3;
- /** RegularExpression Id. */
- int MINUS = 4;
- /** RegularExpression Id. */
- int DIGIT = 5;
- /** RegularExpression Id. */
- int EXP = 6;
- /** RegularExpression Id. */
- int OFFSET = 7;
- /** RegularExpression Id. */
- int YYYYMMDD = 8;
- /** RegularExpression Id. */
- int TIME = 9;
- /** RegularExpression Id. */
- int OFFSETDATETIME = 10;
- /** RegularExpression Id. */
- int DATETIME = 11;
- /** RegularExpression Id. */
- int DATE = 12;
- /** RegularExpression Id. */
- int NUMBER = 13;
- /** RegularExpression Id. */
- int INTEGER = 14;
- /** RegularExpression Id. */
- int FRACTIONAL_DIGITS = 15;
- /** RegularExpression Id. */
- int EXPONENT = 16;
- /** RegularExpression Id. */
- int DIGITS = 17;
- /** RegularExpression Id. */
- int STRING = 18;
- /** RegularExpression Id. */
- int SQUOTE = 19;
- /** RegularExpression Id. */
- int DQUOTE = 20;
- /** RegularExpression Id. */
- int AND = 21;
- /** RegularExpression Id. */
- int OR = 22;
- /** RegularExpression Id. */
- int NULL = 23;
- /** RegularExpression Id. */
- int LPAREN = 24;
- /** RegularExpression Id. */
- int RPAREN = 25;
- /** RegularExpression Id. */
- int COMMA = 26;
- /** RegularExpression Id. */
- int BOOLEAN = 27;
- /** RegularExpression Id. */
- int EQUAL = 28;
- /** RegularExpression Id. */
- int NOT_EQUAL = 29;
- /** RegularExpression Id. */
- int GREATER_THAN = 30;
- /** RegularExpression Id. */
- int GREATER_THAN_OR_EQUAL = 31;
- /** RegularExpression Id. */
- int LESS_THAN = 32;
- /** RegularExpression Id. */
- int LESS_THAN_OR_EQUAL = 33;
- /** RegularExpression Id. */
- int LIKE = 34;
- /** RegularExpression Id. */
- int LIKE_NOT = 35;
- /** RegularExpression Id. */
- int CONTAINS = 36;
- /** RegularExpression Id. */
- int CONTAINS_NOT = 37;
- /** RegularExpression Id. */
- int CONTAINS_ANY = 38;
- /** RegularExpression Id. */
- int CONTAINS_NOT_ANY = 39;
- /** RegularExpression Id. */
- 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;
+ /** End of File. */
+ int EOF = 0;
+ /** RegularExpression Id. */
+ int PLUS = 3;
+ /** RegularExpression Id. */
+ int MINUS = 4;
+ /** RegularExpression Id. */
+ int DIGIT = 5;
+ /** RegularExpression Id. */
+ int EXP = 6;
+ /** RegularExpression Id. */
+ int OFFSET = 7;
+ /** RegularExpression Id. */
+ int YYYYMMDD = 8;
+ /** RegularExpression Id. */
+ int TIME = 9;
+ /** RegularExpression Id. */
+ int OFFSETDATETIME = 10;
+ /** RegularExpression Id. */
+ int DATETIME = 11;
+ /** RegularExpression Id. */
+ int DATE = 12;
+ /** RegularExpression Id. */
+ int NUMBER = 13;
+ /** RegularExpression Id. */
+ int INTEGER = 14;
+ /** RegularExpression Id. */
+ int FRACTIONAL_DIGITS = 15;
+ /** RegularExpression Id. */
+ int EXPONENT = 16;
+ /** RegularExpression Id. */
+ int DIGITS = 17;
+ /** RegularExpression Id. */
+ int STRING = 18;
+ /** RegularExpression Id. */
+ int SQUOTE = 19;
+ /** RegularExpression Id. */
+ int DQUOTE = 20;
+ /** RegularExpression Id. */
+ int AND = 21;
+ /** RegularExpression Id. */
+ int OR = 22;
+ /** RegularExpression Id. */
+ int NULL = 23;
+ /** RegularExpression Id. */
+ int LPAREN = 24;
+ /** RegularExpression Id. */
+ int RPAREN = 25;
+ /** RegularExpression Id. */
+ int COMMA = 26;
+ /** RegularExpression Id. */
+ int BOOLEAN = 27;
+ /** RegularExpression Id. */
+ int EQUAL = 28;
+ /** RegularExpression Id. */
+ int NOT_EQUAL = 29;
+ /** RegularExpression Id. */
+ int GREATER_THAN = 30;
+ /** RegularExpression Id. */
+ int GREATER_THAN_OR_EQUAL = 31;
+ /** RegularExpression Id. */
+ int LESS_THAN = 32;
+ /** RegularExpression Id. */
+ int LESS_THAN_OR_EQUAL = 33;
+ /** RegularExpression Id. */
+ int LIKE = 34;
+ /** RegularExpression Id. */
+ int LIKE_NOT = 35;
+ /** RegularExpression Id. */
+ int CONTAINS = 36;
+ /** RegularExpression Id. */
+ int CONTAINS_NOT = 37;
+ /** RegularExpression Id. */
+ int CONTAINS_ANY = 38;
+ /** RegularExpression Id. */
+ int CONTAINS_NOT_ANY = 39;
+ /** RegularExpression Id. */
+ 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;
+ /** Lexical state. */
+ int DEFAULT = 0;
- /** Literal token values. */
- String[] tokenImage = {
- "<EOF>",
- "\" \"",
- "\"\\t\"",
- "\"+\"",
- "\"-\"",
- "<DIGIT>",
- "<EXP>",
- "<OFFSET>",
- "<YYYYMMDD>",
- "<TIME>",
- "<OFFSETDATETIME>",
- "<DATETIME>",
- "<DATE>",
- "<NUMBER>",
- "<INTEGER>",
- "<FRACTIONAL_DIGITS>",
- "<EXPONENT>",
- "<DIGITS>",
- "<STRING>",
- "<SQUOTE>",
- "<DQUOTE>",
- "<AND>",
- "<OR>",
- "\"null\"",
- "\"(\"",
- "\")\"",
- "\",\"",
- "<BOOLEAN>",
- "<EQUAL>",
- "<NOT_EQUAL>",
- "<GREATER_THAN>",
- "\">=\"",
- "<LESS_THAN>",
- "\"<=\"",
- "<LIKE>",
- "<LIKE_NOT>",
- "\"contains\"",
- "\"contains not\"",
- "\"contains any\"",
- "\"contains not any\"",
- "\"in\"",
- "\"not in\"",
- "<FUNCTION_NAME>",
- "<PROPERTY>",
- "<UNKNOWN>",
- };
+ /** Literal token values. */
+ String[] tokenImage = { "<EOF>", "\" \"", "\"\\t\"", "\"+\"", "\"-\"", "<DIGIT>", "<EXP>", "<OFFSET>", "<YYYYMMDD>",
+ "<TIME>", "<OFFSETDATETIME>", "<DATETIME>", "<DATE>", "<NUMBER>", "<INTEGER>", "<FRACTIONAL_DIGITS>",
+ "<EXPONENT>", "<DIGITS>", "<STRING>", "<SQUOTE>", "<DQUOTE>", "<AND>", "<OR>", "\"null\"", "\"(\"", "\")\"",
+ "\",\"", "<BOOLEAN>", "<EQUAL>", "<NOT_EQUAL>", "<GREATER_THAN>", "\">=\"", "<LESS_THAN>", "\"<=\"",
+ "<LIKE>", "<LIKE_NOT>", "\"contains\"", "\"contains not\"", "\"contains any\"", "\"contains not any\"",
+ "\"in\"", "\"not in\"", "<FUNCTION_NAME>", "<PROPERTY>", "<UNKNOWN>", };
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
index e607f97..583e24c 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/FilterParserTokenManager.java
@@ -1,1823 +1,1754 @@
/* Generated By:JavaCC: Do not edit this line. FilterParserTokenManager.java */
package org.apache.sling.resource.stream.impl;
+
import java.util.ArrayList;
import java.util.List;
import org.apache.sling.resource.stream.impl.node.*;
/** Token Manager. */
-public class FilterParserTokenManager implements FilterParserConstants
-{
+public class FilterParserTokenManager implements FilterParserConstants {
+
+ /** Debug output. */
+ public java.io.PrintStream debugStream = System.out;
+
+ /** Set debug output. */
+ public void setDebugStream(java.io.PrintStream ds) {
+ debugStream = ds;
+ }
- /** Debug output. */
- public java.io.PrintStream debugStream = System.out;
- /** Set debug output. */
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0x200000000L) != 0L)
- {
- jjmatchedKind = 32;
+ private final int jjStopStringLiteralDfa_0(int pos, long active0) {
+ switch (pos) {
+ case 0:
+ if ((active0 & 0x200000000L) != 0L) {
+ jjmatchedKind = 32;
+ return -1;
+ }
+ if ((active0 & 0x10000000000L) != 0L) {
+ jjmatchedKind = 42;
+ return 168;
+ }
+ if ((active0 & 0x20000800000L) != 0L) {
+ jjmatchedKind = 42;
+ return 58;
+ }
+ if ((active0 & 0xf000000000L) != 0L) {
+ jjmatchedKind = 42;
+ return 60;
+ }
+ if ((active0 & 0x4L) != 0L)
+ return 60;
+ if ((active0 & 0x80000000L) != 0L) {
+ jjmatchedKind = 30;
+ return -1;
+ }
return -1;
- }
- if ((active0 & 0x10000000000L) != 0L)
- {
- jjmatchedKind = 42;
- return 168;
- }
- if ((active0 & 0x20000800000L) != 0L)
- {
- jjmatchedKind = 42;
- return 58;
- }
- if ((active0 & 0xf000000000L) != 0L)
- {
- jjmatchedKind = 42;
- return 60;
- }
- if ((active0 & 0x4L) != 0L)
- return 60;
- if ((active0 & 0x80000000L) != 0L)
- {
- jjmatchedKind = 30;
+ case 1:
+ if ((active0 & 0x200000000L) != 0L) {
+ if (jjmatchedPos == 0) {
+ jjmatchedKind = 32;
+ jjmatchedPos = 0;
+ }
+ return -1;
+ }
+ if ((active0 & 0x20000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 1;
+ return 57;
+ }
+ if ((active0 & 0x10000000000L) != 0L)
+ return 60;
+ if ((active0 & 0x80000000L) != 0L) {
+ if (jjmatchedPos == 0) {
+ jjmatchedKind = 30;
+ jjmatchedPos = 0;
+ }
+ return -1;
+ }
+ if ((active0 & 0xf000800000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 1;
+ return 60;
+ }
return -1;
- }
- return -1;
- case 1:
- if ((active0 & 0x200000000L) != 0L)
- {
- if (jjmatchedPos == 0)
- {
- jjmatchedKind = 32;
- jjmatchedPos = 0;
+ case 2:
+ if ((active0 & 0xf000800000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 2;
+ return 60;
+ }
+ if ((active0 & 0x20000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 2;
+ return 56;
}
return -1;
- }
- if ((active0 & 0x20000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 1;
- return 57;
- }
- if ((active0 & 0x10000000000L) != 0L)
- return 60;
- if ((active0 & 0x80000000L) != 0L)
- {
- if (jjmatchedPos == 0)
- {
- jjmatchedKind = 30;
- jjmatchedPos = 0;
+ case 3:
+ if ((active0 & 0xf000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 3;
+ return 60;
+ }
+ if ((active0 & 0x800000L) != 0L)
+ return 60;
+ if ((active0 & 0x20000000000L) != 0L) {
+ if (jjmatchedPos < 2) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 2;
+ }
+ return 55;
}
return -1;
- }
- if ((active0 & 0xf000800000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 1;
- return 60;
- }
- return -1;
- case 2:
- if ((active0 & 0xf000800000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 2;
- return 60;
- }
- if ((active0 & 0x20000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 2;
- return 56;
- }
- return -1;
- case 3:
- if ((active0 & 0xf000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 3;
- return 60;
- }
- if ((active0 & 0x800000L) != 0L)
- return 60;
- if ((active0 & 0x20000000000L) != 0L)
- {
- if (jjmatchedPos < 2)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 2;
+ case 4:
+ if ((active0 & 0x20000000000L) != 0L) {
+ if (jjmatchedPos < 2) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 2;
+ }
+ return -1;
}
- return 55;
- }
- return -1;
- case 4:
- if ((active0 & 0x20000000000L) != 0L)
- {
- if (jjmatchedPos < 2)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 2;
+ if ((active0 & 0xf000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 4;
+ return 60;
}
return -1;
- }
- if ((active0 & 0xf000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 4;
- return 60;
- }
- return -1;
- case 5:
- if ((active0 & 0xf000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 5;
- return 60;
- }
- if ((active0 & 0x20000000000L) != 0L)
- {
- if (jjmatchedPos < 2)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 2;
+ case 5:
+ if ((active0 & 0xf000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 5;
+ return 60;
+ }
+ if ((active0 & 0x20000000000L) != 0L) {
+ if (jjmatchedPos < 2) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 2;
+ }
+ return -1;
}
return -1;
- }
- return -1;
- case 6:
- if ((active0 & 0xf000000000L) != 0L)
- {
- jjmatchedKind = 42;
- jjmatchedPos = 6;
- return 60;
- }
- return -1;
- case 7:
- if ((active0 & 0xf000000000L) != 0L)
- return 60;
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 9:
- return jjStartNfaWithStates_0(0, 2, 60);
- case 40:
- return jjStopAtPos(0, 24);
- case 41:
- return jjStopAtPos(0, 25);
- case 44:
- return jjStopAtPos(0, 26);
- case 60:
- return jjMoveStringLiteralDfa1_0(0x200000000L);
- case 62:
- return jjMoveStringLiteralDfa1_0(0x80000000L);
- case 99:
- return jjMoveStringLiteralDfa1_0(0xf000000000L);
- case 105:
- return jjMoveStringLiteralDfa1_0(0x10000000000L);
- case 110:
- return jjMoveStringLiteralDfa1_0(0x20000800000L);
- default :
- return jjMoveNfa_0(0, 0);
- }
-}
-private int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(0, active0);
- return 1;
- }
- switch(curChar)
- {
- case 61:
- if ((active0 & 0x80000000L) != 0L)
- return jjStopAtPos(1, 31);
- else if ((active0 & 0x200000000L) != 0L)
- return jjStopAtPos(1, 33);
- break;
- case 110:
- if ((active0 & 0x10000000000L) != 0L)
- return jjStartNfaWithStates_0(1, 40, 60);
- break;
- case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x2f000000000L);
- case 117:
- return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
- default :
- break;
- }
- return jjStartNfa_0(0, active0);
-}
-private int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(0, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(1, active0);
- return 2;
- }
- switch(curChar)
- {
- case 108:
- return jjMoveStringLiteralDfa3_0(active0, 0x800000L);
- case 110:
- return jjMoveStringLiteralDfa3_0(active0, 0xf000000000L);
- case 116:
- return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L);
- default :
- break;
- }
- return jjStartNfa_0(1, active0);
-}
-private int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(1, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(2, active0);
- return 3;
- }
- switch(curChar)
- {
- case 32:
- return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L);
- case 108:
- if ((active0 & 0x800000L) != 0L)
- return jjStartNfaWithStates_0(3, 23, 60);
- break;
- case 116:
- return jjMoveStringLiteralDfa4_0(active0, 0xf000000000L);
- default :
- break;
- }
- return jjStartNfa_0(2, active0);
-}
-private int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(2, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(3, active0);
- return 4;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa5_0(active0, 0xf000000000L);
- case 105:
- return jjMoveStringLiteralDfa5_0(active0, 0x20000000000L);
- default :
- break;
- }
- return jjStartNfa_0(3, active0);
-}
-private int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(3, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(4, active0);
- return 5;
- }
- switch(curChar)
- {
- case 105:
- return jjMoveStringLiteralDfa6_0(active0, 0xf000000000L);
- case 110:
- if ((active0 & 0x20000000000L) != 0L)
- return jjStopAtPos(5, 41);
- break;
- default :
- break;
- }
- return jjStartNfa_0(4, active0);
-}
-private int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(4, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(5, active0);
- return 6;
- }
- switch(curChar)
- {
- case 110:
- return jjMoveStringLiteralDfa7_0(active0, 0xf000000000L);
- default :
- break;
- }
- return jjStartNfa_0(5, active0);
-}
-private int jjMoveStringLiteralDfa7_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(5, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(6, active0);
- return 7;
- }
- switch(curChar)
- {
- case 115:
- if ((active0 & 0x1000000000L) != 0L)
- {
- jjmatchedKind = 36;
- jjmatchedPos = 7;
- }
- return jjMoveStringLiteralDfa8_0(active0, 0xe000000000L);
- default :
- break;
- }
- return jjStartNfa_0(6, active0);
-}
-private int jjMoveStringLiteralDfa8_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(6, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(7, active0);
- return 8;
- }
- switch(curChar)
- {
- case 32:
- return jjMoveStringLiteralDfa9_0(active0, 0xe000000000L);
- default :
- break;
- }
- return jjStartNfa_0(7, active0);
-}
-private int jjMoveStringLiteralDfa9_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(7, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(8, active0);
- return 9;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa10_0(active0, 0x4000000000L);
- case 110:
- return jjMoveStringLiteralDfa10_0(active0, 0xa000000000L);
- default :
- break;
- }
- return jjStartNfa_0(8, active0);
-}
-private int jjMoveStringLiteralDfa10_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(8, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(9, active0);
- return 10;
- }
- switch(curChar)
- {
- case 110:
- return jjMoveStringLiteralDfa11_0(active0, 0x4000000000L);
- case 111:
- return jjMoveStringLiteralDfa11_0(active0, 0xa000000000L);
- default :
- break;
- }
- return jjStartNfa_0(9, active0);
-}
-private int jjMoveStringLiteralDfa11_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(9, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(10, active0);
- return 11;
- }
- switch(curChar)
- {
- case 116:
- if ((active0 & 0x2000000000L) != 0L)
- {
- jjmatchedKind = 37;
- jjmatchedPos = 11;
- }
- return jjMoveStringLiteralDfa12_0(active0, 0x8000000000L);
- case 121:
- if ((active0 & 0x4000000000L) != 0L)
- return jjStopAtPos(11, 38);
- break;
- default :
- break;
- }
- return jjStartNfa_0(10, active0);
-}
-private int jjMoveStringLiteralDfa12_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(10, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(11, active0);
- return 12;
- }
- switch(curChar)
- {
- case 32:
- return jjMoveStringLiteralDfa13_0(active0, 0x8000000000L);
- default :
- break;
- }
- return jjStartNfa_0(11, active0);
-}
-private int jjMoveStringLiteralDfa13_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(11, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(12, active0);
- return 13;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa14_0(active0, 0x8000000000L);
- default :
- break;
- }
- return jjStartNfa_0(12, active0);
-}
-private int jjMoveStringLiteralDfa14_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(12, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(13, active0);
- return 14;
- }
- switch(curChar)
- {
- case 110:
- return jjMoveStringLiteralDfa15_0(active0, 0x8000000000L);
- default :
- break;
- }
- return jjStartNfa_0(13, active0);
-}
-private int jjMoveStringLiteralDfa15_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(13, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(14, active0);
- return 15;
- }
- switch(curChar)
- {
- case 121:
- if ((active0 & 0x8000000000L) != 0L)
- return jjStopAtPos(15, 39);
- break;
- default :
- break;
- }
- return jjStartNfa_0(14, active0);
-}
-private int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-static final long[] jjbitVec0 = {
- 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec2 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private int jjMoveNfa_0(int startState, int curPos)
-{
- int startsAt = 0;
- jjnewStateCnt = 193;
- int i = 1;
- jjstateSet[0] = startState;
- int kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- do
- {
- switch(jjstateSet[--i])
- {
- case 57:
- case 60:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 0:
- if ((0x8c00847affffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- else if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 13)
- kind = 13;
- jjCheckNAddStates(0, 14);
- }
- else if (curChar == 45)
- jjCheckNAddStates(15, 22);
- else if (curChar == 60)
- {
- if (kind > 32)
- kind = 32;
- }
- else if (curChar == 62)
- {
- if (kind > 30)
- kind = 30;
- }
- else if (curChar == 61)
- jjstateSet[jjnewStateCnt++] = 32;
- else if (curChar == 34)
- jjCheckNAddStates(23, 25);
- else if (curChar == 39)
- jjCheckNAddStates(26, 28);
- else if (curChar == 46)
- jjCheckNAdd(1);
- if (curChar == 33)
- jjstateSet[jjnewStateCnt++] = 34;
- else if (curChar == 38)
- jjstateSet[jjnewStateCnt++] = 15;
- break;
- case 168:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 56:
- if ((0x8c00847affffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- else if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 55;
- break;
- case 58:
- if ((0x8c00847affffffffL & l) == 0L)
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 1:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 15)
- kind = 15;
- jjCheckNAdd(1);
- break;
- case 3:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(4);
- break;
- case 4:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 16)
- kind = 16;
- jjCheckNAdd(4);
- break;
- case 5:
- if (curChar == 39)
- jjCheckNAddStates(26, 28);
- break;
- case 7:
- jjCheckNAddStates(26, 28);
- break;
- case 8:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(26, 28);
- break;
- case 9:
- if (curChar == 39 && kind > 18)
- kind = 18;
- break;
- case 10:
- if (curChar == 34)
- jjCheckNAddStates(23, 25);
- break;
- case 12:
- jjCheckNAddStates(23, 25);
- break;
- case 13:
- if ((0xfffffffbffffffffL & l) != 0L)
- jjCheckNAddStates(23, 25);
- break;
- case 14:
- if (curChar == 34 && kind > 18)
- kind = 18;
- break;
- case 15:
- if (curChar == 38 && kind > 21)
- kind = 21;
- break;
- case 16:
- if (curChar == 38)
- jjstateSet[jjnewStateCnt++] = 15;
- break;
- case 32:
- if (curChar == 61 && kind > 28)
- kind = 28;
- break;
- case 33:
- if (curChar == 61)
- jjstateSet[jjnewStateCnt++] = 32;
- break;
- case 34:
- if (curChar == 61 && kind > 29)
- kind = 29;
- break;
- case 35:
- if (curChar == 33)
- jjstateSet[jjnewStateCnt++] = 34;
- break;
- case 36:
- if (curChar == 62 && kind > 30)
- kind = 30;
- break;
- case 41:
- if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 40;
- break;
- case 49:
- if (curChar == 60 && kind > 32)
- kind = 32;
- break;
- case 50:
- if (curChar == 61 && kind > 34)
- kind = 34;
- break;
- case 63:
- case 64:
- jjCheckNAddStates(29, 31);
- break;
- case 66:
- if (curChar == 45)
- jjCheckNAddStates(15, 22);
- break;
- case 67:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(68, 102);
- break;
- case 68:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 69;
- break;
- case 69:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(70, 101);
- break;
- case 70:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 71;
- break;
- case 71:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(72, 100);
- break;
- case 72:
- if (curChar == 45)
- jjCheckNAdd(73);
- break;
- case 73:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(73, 74);
- break;
- case 74:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 75;
- break;
- case 75:
- if ((0x3000000000000L & l) != 0L)
- jjCheckNAddTwoStates(76, 77);
- break;
- case 76:
- if (curChar == 45)
- jjCheckNAdd(77);
- break;
- case 77:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(77, 78);
- break;
- case 78:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 79;
- break;
- case 79:
- if ((0xf000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 80;
- break;
- case 80:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 81;
- break;
- case 82:
- if ((0x7000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 83;
- break;
- case 83:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 84;
- break;
- case 84:
- if (curChar == 58)
- jjstateSet[jjnewStateCnt++] = 85;
- break;
- case 85:
- if ((0x3f000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 86;
- break;
- case 86:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(87, 94);
- break;
- case 87:
- if (curChar == 58)
- jjstateSet[jjnewStateCnt++] = 88;
- break;
- case 88:
- if ((0x3f000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 89;
- break;
- case 89:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(90, 94);
- break;
- case 90:
- if (curChar == 46)
- jjstateSet[jjnewStateCnt++] = 91;
- break;
- case 91:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 92;
- break;
- case 92:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 93;
- break;
- case 93:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAdd(94);
- break;
- case 94:
- if ((0x280000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 95;
- break;
- case 95:
- if ((0x7000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 96;
- break;
- case 96:
- if ((0x3ff000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 97;
- break;
- case 97:
- if (curChar == 58)
- jjstateSet[jjnewStateCnt++] = 98;
- break;
- case 98:
- if ((0x3f000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 99;
- break;
- case 99:
- if ((0x3ff000000000000L & l) != 0L && kind > 10)
- kind = 10;
- break;
- case 100:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(32, 35);
- break;
- case 101:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(36, 39);
- break;
- case 102:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(40, 43);
- break;
- case 103:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(104, 132);
- break;
- case 104:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 105;
- break;
- case 105:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(106, 131);
- break;
- case 106:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 107;
- break;
- case 107:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(108, 130);
- break;
- case 108:
- if (curChar == 45)
- jjCheckNAdd(109);
- break;
- case 109:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(109, 110);
- break;
- case 110:
- if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 111;
- break;
- case 111:
- if ((0x3000000000000L & l) != 0L)
- jjCheckNAddTwoStates(112, 113);
- break;
- case 112:
- if (curChar == 45)
- jjCheckNAdd(113);
- break;
- case 113:
- 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 > 11)
- kind = 11;
- jjstateSet[jjnewStateCnt++] = 123;
- break;
- 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 > 11)
- kind = 11;
- jjstateSet[jjnewStateCnt++] = 126;
- break;
- 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 > 13)
- kind = 13;
- jjCheckNAdd(150);
- break;
- 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(153);
- break;
- 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++] = 171;
- break;
- case 179:
- if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 178;
- break;
- case 189:
- if (curChar == 32)
- jjstateSet[jjnewStateCnt++] = 188;
- break;
- default : break;
+ case 6:
+ if ((active0 & 0xf000000000L) != 0L) {
+ jjmatchedKind = 42;
+ jjmatchedPos = 6;
+ return 60;
+ }
+ return -1;
+ case 7:
+ if ((active0 & 0xf000000000L) != 0L)
+ return 60;
+ return -1;
+ default:
+ return -1;
+ }
+ }
+
+ private final int jjStartNfa_0(int pos, long active0) {
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+ }
+
+ private int jjStopAtPos(int pos, int kind) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+ }
+
+ private int jjMoveStringLiteralDfa0_0() {
+ switch (curChar) {
+ case 9:
+ return jjStartNfaWithStates_0(0, 2, 60);
+ case 40:
+ return jjStopAtPos(0, 24);
+ case 41:
+ return jjStopAtPos(0, 25);
+ case 44:
+ return jjStopAtPos(0, 26);
+ case 60:
+ return jjMoveStringLiteralDfa1_0(0x200000000L);
+ case 62:
+ return jjMoveStringLiteralDfa1_0(0x80000000L);
+ case 99:
+ return jjMoveStringLiteralDfa1_0(0xf000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x10000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x20000800000L);
+ default:
+ return jjMoveNfa_0(0, 0);
+ }
+ }
+
+ private int jjMoveStringLiteralDfa1_0(long active0) {
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch (curChar) {
+ case 61:
+ if ((active0 & 0x80000000L) != 0L)
+ return jjStopAtPos(1, 31);
+ else if ((active0 & 0x200000000L) != 0L)
+ return jjStopAtPos(1, 33);
+ break;
+ case 110:
+ if ((active0 & 0x10000000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 40, 60);
+ break;
+ case 111:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2f000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+ }
+
+ private int jjMoveStringLiteralDfa2_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch (curChar) {
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000L);
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0xf000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+ }
+
+ private int jjMoveStringLiteralDfa3_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch (curChar) {
+ case 32:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L);
+ case 108:
+ if ((active0 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(3, 23, 60);
+ break;
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0xf000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+ }
+
+ private int jjMoveStringLiteralDfa4_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active0, 0xf000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x20000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+ }
+
+ private int jjMoveStringLiteralDfa5_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch (curChar) {
+ case 105:
+ return jjMoveStringLiteralDfa6_0(active0, 0xf000000000L);
+ case 110:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(5, 41);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+ }
+
+ private int jjMoveStringLiteralDfa6_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch (curChar) {
+ case 110:
+ return jjMoveStringLiteralDfa7_0(active0, 0xf000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+ }
+
+ private int jjMoveStringLiteralDfa7_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch (curChar) {
+ case 115:
+ if ((active0 & 0x1000000000L) != 0L) {
+ jjmatchedKind = 36;
+ jjmatchedPos = 7;
}
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 57:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 56;
- break;
- case 0:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- else if (curChar == 91)
- jjCheckNAddStates(29, 31);
- if ((0x2000000020L & l) != 0L)
- jjAddStates(68, 69);
- else if (curChar == 108)
- jjAddStates(70, 72);
- else if (curChar == 105)
- jjAddStates(73, 74);
- else if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 58;
- else if (curChar == 126)
- jjstateSet[jjnewStateCnt++] = 50;
- else if (curChar == 103)
- jjstateSet[jjnewStateCnt++] = 47;
- else if (curChar == 102)
- jjstateSet[jjnewStateCnt++] = 30;
- else if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 26;
- else if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 22;
- else if (curChar == 124)
- jjstateSet[jjnewStateCnt++] = 20;
- else if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 18;
- break;
- case 168:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 172;
- if (curChar == 115)
- {
- if (kind > 28)
- kind = 28;
- }
- break;
- case 56:
- case 60:
- if ((0xffffffffd7ffffffL & l) == 0L)
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 58:
- if ((0xffffffffd7ffffffL & l) != 0L)
- {
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- }
- if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 57;
- break;
- case 2:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(68, 69);
- break;
- case 6:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 7;
- break;
- case 7:
- jjCheckNAddStates(26, 28);
- break;
- case 8:
- if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(26, 28);
- break;
- case 11:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 12;
- break;
- case 12:
- jjCheckNAddStates(23, 25);
- break;
- case 13:
- if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(23, 25);
- break;
- case 17:
- if (curChar == 100 && kind > 21)
- kind = 21;
- break;
- case 18:
- if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 17;
- break;
- case 19:
- if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 18;
- break;
- case 20:
- if (curChar == 124 && kind > 22)
- kind = 22;
- break;
- case 21:
- if (curChar == 124)
- jjstateSet[jjnewStateCnt++] = 20;
- break;
- case 22:
- if (curChar == 114 && kind > 22)
- kind = 22;
- break;
- case 23:
- if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 22;
- break;
- case 24:
- if (curChar == 101 && kind > 27)
- kind = 27;
- break;
- case 25:
- if (curChar == 117)
- jjCheckNAdd(24);
- break;
- case 26:
- if (curChar == 114)
- jjstateSet[jjnewStateCnt++] = 25;
- break;
- case 27:
- if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 26;
- break;
- case 28:
- if (curChar == 115)
- jjCheckNAdd(24);
- break;
- case 29:
- if (curChar == 108)
- jjstateSet[jjnewStateCnt++] = 28;
- break;
- case 30:
- if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 29;
- break;
- case 31:
- if (curChar == 102)
- jjstateSet[jjnewStateCnt++] = 30;
- break;
- case 37:
- if (curChar == 110 && kind > 30)
- kind = 30;
- break;
- case 38:
- if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 37;
- break;
- case 39:
- if (curChar == 104)
- jjstateSet[jjnewStateCnt++] = 38;
- break;
- case 40:
- if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 39;
- break;
- case 42:
- if (curChar == 114)
- jjstateSet[jjnewStateCnt++] = 41;
- break;
- case 43:
- if (curChar == 101)
- jjstateSet[jjnewStateCnt++] = 42;
- break;
- case 44:
- if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 43;
- break;
- case 45:
- if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 44;
- break;
- case 46:
- if (curChar == 101)
- jjstateSet[jjnewStateCnt++] = 45;
- break;
- case 47:
- if (curChar == 114)
- jjstateSet[jjnewStateCnt++] = 46;
- break;
- case 48:
- if (curChar == 103)
- jjstateSet[jjnewStateCnt++] = 47;
- break;
- case 51:
- if (curChar == 126)
- jjstateSet[jjnewStateCnt++] = 50;
- break;
- case 52:
- if (curChar == 101 && kind > 35)
- kind = 35;
- break;
- case 53:
- if (curChar == 107)
- jjstateSet[jjnewStateCnt++] = 52;
- break;
- 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(29, 31);
- break;
- case 62:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 63;
- break;
- case 63:
- jjCheckNAddStates(29, 31);
- break;
- case 64:
- if ((0xffffffffcfffffffL & l) != 0L)
- jjCheckNAddStates(29, 31);
- break;
- case 65:
- if (curChar == 93 && kind > 43)
- kind = 43;
- break;
- case 81:
- if (curChar == 84)
- jjstateSet[jjnewStateCnt++] = 82;
- break;
- case 117:
- if (curChar == 84)
- jjstateSet[jjnewStateCnt++] = 118;
- break;
- case 155:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(75, 76);
- break;
- case 161:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(77, 78);
- break;
- case 167:
- if (curChar == 105)
- jjAddStates(73, 74);
- break;
- case 169:
- if (curChar == 116 && kind > 29)
- kind = 29;
- break;
- case 170:
- if (curChar == 111)
- jjstateSet[jjnewStateCnt++] = 169;
- break;
- case 171:
- if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 170;
- break;
- case 173:
- if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 172;
- break;
- case 174:
- if (curChar == 108)
- jjAddStates(70, 72);
- break;
- case 175:
- if (curChar == 110 && kind > 32)
- kind = 32;
- break;
- case 176:
- if (curChar == 97)
- jjstateSet[jjnewStateCnt++] = 175;
- break;
- case 177:
- if (curChar == 104)
- jjstateSet[jjnewStateCnt++] = 176;
- break;
- case 178:
- if (curChar == 116)
- jjstateSet[jjnewStateCnt++] = 177;
- break;
- case 180:
- if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 179;
- break;
- case 181:
- if (curChar == 115)
- jjstateSet[jjnewStateCnt++] = 180;
- break;
- case 182:
- if (curChar == 101)
- jjstateSet[jjnewStateCnt++] = 181;
- break;
- 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++] = 186;
- break;
- case 188:
- if (curChar == 110)
- jjstateSet[jjnewStateCnt++] = 187;
- break;
- 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++] = 191;
- break;
- default : break;
+ return jjMoveStringLiteralDfa8_0(active0, 0xe000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+ }
+
+ private int jjMoveStringLiteralDfa8_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+ switch (curChar) {
+ case 32:
+ return jjMoveStringLiteralDfa9_0(active0, 0xe000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(7, active0);
+ }
+
+ private int jjMoveStringLiteralDfa9_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa10_0(active0, 0x4000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa10_0(active0, 0xa000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(8, active0);
+ }
+
+ private int jjMoveStringLiteralDfa10_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(8, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, active0);
+ return 10;
+ }
+ switch (curChar) {
+ case 110:
+ return jjMoveStringLiteralDfa11_0(active0, 0x4000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa11_0(active0, 0xa000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(9, active0);
+ }
+
+ private int jjMoveStringLiteralDfa11_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(9, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(10, active0);
+ return 11;
+ }
+ switch (curChar) {
+ case 116:
+ if ((active0 & 0x2000000000L) != 0L) {
+ jjmatchedKind = 37;
+ jjmatchedPos = 11;
}
- } while(i != startsAt);
- }
- else
- {
- int hiByte = (int)(curChar >> 8);
- int i1 = hiByte >> 6;
- long l1 = 1L << (hiByte & 077);
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- do
- {
- switch(jjstateSet[--i])
- {
- case 57:
- case 60:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 0:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 168:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 56:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 58:
- if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 42)
- kind = 42;
- jjCheckNAdd(60);
- break;
- case 7:
- case 8:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(26, 28);
- break;
- case 12:
- case 13:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(23, 25);
- break;
- case 63:
- case 64:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjCheckNAddStates(29, 31);
- break;
- default : break;
+ return jjMoveStringLiteralDfa12_0(active0, 0x8000000000L);
+ case 121:
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(11, 38);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(10, active0);
+ }
+
+ private int jjMoveStringLiteralDfa12_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(10, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(11, active0);
+ return 12;
+ }
+ switch (curChar) {
+ case 32:
+ return jjMoveStringLiteralDfa13_0(active0, 0x8000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(11, active0);
+ }
+
+ private int jjMoveStringLiteralDfa13_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(11, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(12, active0);
+ return 13;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa14_0(active0, 0x8000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(12, active0);
+ }
+
+ private int jjMoveStringLiteralDfa14_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(12, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(13, active0);
+ return 14;
+ }
+ switch (curChar) {
+ case 110:
+ return jjMoveStringLiteralDfa15_0(active0, 0x8000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(13, active0);
+ }
+
+ private int jjMoveStringLiteralDfa15_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(13, old0);
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(14, active0);
+ return 15;
+ }
+ switch (curChar) {
+ case 121:
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(15, 39);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(14, active0);
+ }
+
+ private int jjStartNfaWithStates_0(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_0(state, pos + 1);
+ }
+
+ static final long[] jjbitVec0 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL,
+ 0xffffffffffffffffL };
+ static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL };
+
+ private int jjMoveNfa_0(int startState, int curPos) {
+ int startsAt = 0;
+ jjnewStateCnt = 193;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int kind = 0x7fffffff;
+ for (;;) {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64) {
+ long l = 1L << curChar;
+ do {
+ switch (jjstateSet[--i]) {
+ case 57:
+ case 60:
+ if ((0x8c00847affffffffL & l) == 0L)
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 0:
+ if ((0x8c00847affffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ } else if ((0x3ff000000000000L & l) != 0L) {
+ if (kind > 13)
+ kind = 13;
+ jjCheckNAddStates(0, 14);
+ } else if (curChar == 45)
+ jjCheckNAddStates(15, 22);
+ else if (curChar == 60) {
+ if (kind > 32)
+ kind = 32;
+ } else if (curChar == 62) {
+ if (kind > 30)
+ kind = 30;
+ } else if (curChar == 61)
+ jjstateSet[jjnewStateCnt++] = 32;
+ else if (curChar == 34)
+ jjCheckNAddStates(23, 25);
+ else if (curChar == 39)
+ jjCheckNAddStates(26, 28);
+ else if (curChar == 46)
+ jjCheckNAdd(1);
+ if (curChar == 33)
+ jjstateSet[jjnewStateCnt++] = 34;
+ else if (curChar == 38)
+ jjstateSet[jjnewStateCnt++] = 15;
+ break;
+ case 168:
+ if ((0x8c00847affffffffL & l) == 0L)
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 56:
+ if ((0x8c00847affffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ } else if (curChar == 32)
+ jjstateSet[jjnewStateCnt++] = 55;
+ break;
+ case 58:
+ if ((0x8c00847affffffffL & l) == 0L)
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 1:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 15)
+ kind = 15;
+ jjCheckNAdd(1);
+ break;
+ case 3:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(4);
+ break;
+ case 4:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 16)
+ kind = 16;
+ jjCheckNAdd(4);
+ break;
+ case 5:
+ if (curChar == 39)
+ jjCheckNAddStates(26, 28);
+ break;
+ case 7:
+ jjCheckNAddStates(26, 28);
+ break;
+ case 8:
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddStates(26, 28);
+ break;
+ case 9:
+ if (curChar == 39 && kind > 18)
+ kind = 18;
+ break;
+ case 10:
+ if (curChar == 34)
+ jjCheckNAddStates(23, 25);
+ break;
+ case 12:
+ jjCheckNAddStates(23, 25);
+ break;
+ case 13:
+ if ((0xfffffffbffffffffL & l) != 0L)
+ jjCheckNAddStates(23, 25);
+ break;
+ case 14:
+ if (curChar == 34 && kind > 18)
+ kind = 18;
+ break;
+ case 15:
+ if (curChar == 38 && kind > 21)
+ kind = 21;
+ break;
+ case 16:
+ if (curChar == 38)
+ jjstateSet[jjnewStateCnt++] = 15;
+ break;
+ case 32:
+ if (curChar == 61 && kind > 28)
+ kind = 28;
+ break;
+ case 33:
+ if (curChar == 61)
+ jjstateSet[jjnewStateCnt++] = 32;
+ break;
+ case 34:
+ if (curChar == 61 && kind > 29)
+ kind = 29;
+ break;
+ case 35:
+ if (curChar == 33)
+ jjstateSet[jjnewStateCnt++] = 34;
+ break;
+ case 36:
+ if (curChar == 62 && kind > 30)
+ kind = 30;
+ break;
+ case 41:
+ if (curChar == 32)
+ jjstateSet[jjnewStateCnt++] = 40;
+ break;
+ case 49:
+ if (curChar == 60 && kind > 32)
+ kind = 32;
+ break;
+ case 50:
+ if (curChar == 61 && kind > 34)
+ kind = 34;
+ break;
+ case 63:
+ case 64:
+ jjCheckNAddStates(29, 31);
+ break;
+ case 66:
+ if (curChar == 45)
+ jjCheckNAddStates(15, 22);
+ break;
+ case 67:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(68, 102);
+ break;
+ case 68:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 69;
+ break;
+ case 69:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(70, 101);
+ break;
+ case 70:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 71;
+ break;
+ case 71:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(72, 100);
+ break;
+ case 72:
+ if (curChar == 45)
+ jjCheckNAdd(73);
+ break;
+ case 73:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(73, 74);
+ break;
+ case 74:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 75;
+ break;
+ case 75:
+ if ((0x3000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(76, 77);
+ break;
+ case 76:
+ if (curChar == 45)
+ jjCheckNAdd(77);
+ break;
+ case 77:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(77, 78);
+ break;
+ case 78:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 79;
+ break;
+ case 79:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 80;
+ break;
+ case 80:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 81;
+ break;
+ case 82:
+ if ((0x7000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 83;
+ break;
+ case 83:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 84;
+ break;
+ case 84:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 85;
+ break;
+ case 85:
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 86;
+ break;
+ case 86:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(87, 94);
+ break;
+ case 87:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 88;
+ break;
+ case 88:
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 89;
+ break;
+ case 89:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(90, 94);
+ break;
+ case 90:
+ if (curChar == 46)
+ jjstateSet[jjnewStateCnt++] = 91;
+ break;
+ case 91:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 92;
+ break;
+ case 92:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 93;
+ break;
+ case 93:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(94);
+ break;
+ case 94:
+ if ((0x280000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 95;
+ break;
+ case 95:
+ if ((0x7000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 96;
+ break;
+ case 96:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 97;
+ break;
+ case 97:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 98;
+ break;
+ case 98:
+ if ((0x3f000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 99;
+ break;
+ case 99:
+ if ((0x3ff000000000000L & l) != 0L && kind > 10)
+ kind = 10;
+ break;
+ case 100:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(32, 35);
+ break;
+ case 101:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(36, 39);
+ break;
+ case 102:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(40, 43);
+ break;
+ case 103:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(104, 132);
+ break;
+ case 104:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 105;
+ break;
+ case 105:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(106, 131);
+ break;
+ case 106:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 107;
+ break;
+ case 107:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(108, 130);
+ break;
+ case 108:
+ if (curChar == 45)
+ jjCheckNAdd(109);
+ break;
+ case 109:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(109, 110);
+ break;
+ case 110:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 111;
+ break;
+ case 111:
+ if ((0x3000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 113);
+ break;
+ case 112:
+ if (curChar == 45)
+ jjCheckNAdd(113);
+ break;
+ case 113:
+ 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 > 11)
+ kind = 11;
+ jjstateSet[jjnewStateCnt++] = 123;
+ break;
+ 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 > 11)
+ kind = 11;
+ jjstateSet[jjnewStateCnt++] = 126;
+ break;
+ 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 > 13)
+ kind = 13;
+ jjCheckNAdd(150);
+ break;
+ 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(153);
+ break;
+ 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++] = 171;
+ break;
+ case 179:
+ if (curChar == 32)
+ jjstateSet[jjnewStateCnt++] = 178;
+ break;
+ case 189:
+ if (curChar == 32)
+ jjstateSet[jjnewStateCnt++] = 188;
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ do {
+ switch (jjstateSet[--i]) {
+ case 57:
+ if ((0xffffffffd7ffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ }
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 56;
+ break;
+ case 0:
+ if ((0xffffffffd7ffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ } else if (curChar == 91)
+ jjCheckNAddStates(29, 31);
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(68, 69);
+ else if (curChar == 108)
+ jjAddStates(70, 72);
+ else if (curChar == 105)
+ jjAddStates(73, 74);
+ else if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 58;
+ else if (curChar == 126)
+ jjstateSet[jjnewStateCnt++] = 50;
+ else if (curChar == 103)
+ jjstateSet[jjnewStateCnt++] = 47;
+ else if (curChar == 102)
+ jjstateSet[jjnewStateCnt++] = 30;
+ else if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 26;
+ else if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 22;
+ else if (curChar == 124)
+ jjstateSet[jjnewStateCnt++] = 20;
+ else if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 18;
+ break;
+ case 168:
+ if ((0xffffffffd7ffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ }
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 172;
+ if (curChar == 115) {
+ if (kind > 28)
+ kind = 28;
+ }
+ break;
+ case 56:
+ case 60:
+ if ((0xffffffffd7ffffffL & l) == 0L)
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 58:
+ if ((0xffffffffd7ffffffL & l) != 0L) {
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ }
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 57;
+ break;
+ case 2:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(68, 69);
+ break;
+ case 6:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 7;
+ break;
+ case 7:
+ jjCheckNAddStates(26, 28);
+ break;
+ case 8:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(26, 28);
+ break;
+ case 11:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 12;
+ break;
+ case 12:
+ jjCheckNAddStates(23, 25);
+ break;
+ case 13:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(23, 25);
+ break;
+ case 17:
+ if (curChar == 100 && kind > 21)
+ kind = 21;
+ break;
+ case 18:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 17;
+ break;
+ case 19:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 18;
+ break;
+ case 20:
+ if (curChar == 124 && kind > 22)
+ kind = 22;
+ break;
+ case 21:
+ if (curChar == 124)
+ jjstateSet[jjnewStateCnt++] = 20;
+ break;
+ case 22:
+ if (curChar == 114 && kind > 22)
+ kind = 22;
+ break;
+ case 23:
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 22;
+ break;
+ case 24:
+ if (curChar == 101 && kind > 27)
+ kind = 27;
+ break;
+ case 25:
+ if (curChar == 117)
+ jjCheckNAdd(24);
+ break;
+ case 26:
+ if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 25;
+ break;
+ case 27:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 26;
+ break;
+ case 28:
+ if (curChar == 115)
+ jjCheckNAdd(24);
+ break;
+ case 29:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 28;
+ break;
+ case 30:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 29;
+ break;
+ case 31:
+ if (curChar == 102)
+ jjstateSet[jjnewStateCnt++] = 30;
+ break;
+ case 37:
+ if (curChar == 110 && kind > 30)
+ kind = 30;
+ break;
+ case 38:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 37;
+ break;
+ case 39:
+ if (curChar == 104)
+ jjstateSet[jjnewStateCnt++] = 38;
+ break;
+ case 40:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 39;
+ break;
+ case 42:
+ if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 41;
+ break;
+ case 43:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 42;
+ break;
+ case 44:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 43;
+ break;
+ case 45:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 44;
+ break;
+ case 46:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 45;
+ break;
+ case 47:
+ if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 46;
+ break;
+ case 48:
+ if (curChar == 103)
+ jjstateSet[jjnewStateCnt++] = 47;
+ break;
+ case 51:
+ if (curChar == 126)
+ jjstateSet[jjnewStateCnt++] = 50;
+ break;
+ case 52:
+ if (curChar == 101 && kind > 35)
+ kind = 35;
+ break;
+ case 53:
+ if (curChar == 107)
+ jjstateSet[jjnewStateCnt++] = 52;
+ break;
+ 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(29, 31);
+ break;
+ case 62:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 63;
+ break;
+ case 63:
+ jjCheckNAddStates(29, 31);
+ break;
+ case 64:
+ if ((0xffffffffcfffffffL & l) != 0L)
+ jjCheckNAddStates(29, 31);
+ break;
+ case 65:
+ if (curChar == 93 && kind > 43)
+ kind = 43;
+ break;
+ case 81:
+ if (curChar == 84)
+ jjstateSet[jjnewStateCnt++] = 82;
+ break;
+ case 117:
+ if (curChar == 84)
+ jjstateSet[jjnewStateCnt++] = 118;
+ break;
+ case 155:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(75, 76);
+ break;
+ case 161:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(77, 78);
+ break;
+ case 167:
+ if (curChar == 105)
+ jjAddStates(73, 74);
+ break;
+ case 169:
+ if (curChar == 116 && kind > 29)
+ kind = 29;
+ break;
+ case 170:
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 169;
+ break;
+ case 171:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 170;
+ break;
+ case 173:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 172;
+ break;
+ case 174:
+ if (curChar == 108)
+ jjAddStates(70, 72);
+ break;
+ case 175:
+ if (curChar == 110 && kind > 32)
+ kind = 32;
+ break;
+ case 176:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 175;
+ break;
+ case 177:
+ if (curChar == 104)
+ jjstateSet[jjnewStateCnt++] = 176;
+ break;
+ case 178:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 177;
+ break;
+ case 180:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 179;
+ break;
+ case 181:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 180;
+ break;
+ case 182:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 181;
+ break;
+ 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++] = 186;
+ break;
+ case 188:
+ if (curChar == 110)
+ jjstateSet[jjnewStateCnt++] = 187;
+ break;
+ 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++] = 191;
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else {
+ int hiByte = (int) (curChar >> 8);
+ int i1 = hiByte >> 6;
+ long l1 = 1L << (hiByte & 077);
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ do {
+ switch (jjstateSet[--i]) {
+ case 57:
+ case 60:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 0:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 168:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 56:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 58:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 42)
+ kind = 42;
+ jjCheckNAdd(60);
+ break;
+ case 7:
+ case 8:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjCheckNAddStates(26, 28);
+ break;
+ case 12:
+ case 13:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjCheckNAddStates(23, 25);
+ break;
+ case 63:
+ case 64:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjCheckNAddStates(29, 31);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
}
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- 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 = {
- 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)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec2[i2] & l2) != 0L);
- default :
- if ((jjbitVec0[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 193 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ } catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
-/** 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, 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, };
+ static final int[] jjnextStates = { 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, };
-/** Lexer state names. */
-public static final String[] lexStateNames = {
- "DEFAULT",
-};
-static final long[] jjtoToken = {
- 0x1fffffe7fc01L,
-};
-static final long[] jjtoSkip = {
- 0x6L,
-};
-protected SimpleCharStream input_stream;
-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;
-private int lengthOfMatch;
-protected char curChar;
-/** Constructor. */
-public FilterParserTokenManager(SimpleCharStream stream){
- if (SimpleCharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
+ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) {
+ switch (hiByte) {
+ case 0:
+ return ((jjbitVec2[i2] & l2) != 0L);
+ default:
+ if ((jjbitVec0[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+ }
-/** Constructor. */
-public FilterParserTokenManager(SimpleCharStream stream, int lexState){
- this(stream);
- SwitchTo(lexState);
-}
+ /** 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, 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, };
-/** Reinitialise parser. */
-public void ReInit(SimpleCharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 193; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
+ /** Lexer state names. */
+ public static final String[] lexStateNames = { "DEFAULT", };
+ static final long[] jjtoToken = { 0x1fffffe7fc01L, };
+ static final long[] jjtoSkip = { 0x6L, };
+ protected SimpleCharStream input_stream;
+ 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;
+ private int lengthOfMatch;
+ protected char curChar;
-/** Reinitialise parser. */
-public void ReInit(SimpleCharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
+ /** Constructor. */
+ public FilterParserTokenManager(SimpleCharStream stream) {
+ if (SimpleCharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+ }
-/** Switch to specified lex state. */
-public void SwitchTo(int lexState)
-{
- if (lexState >= 1 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
+ /** Constructor. */
+ public FilterParserTokenManager(SimpleCharStream stream, int lexState) {
+ this(stream);
+ SwitchTo(lexState);
+ }
-protected Token jjFillToken()
-{
- final Token t;
- final String curTokenImage;
- final int beginLine;
- final int endLine;
- final int beginColumn;
- final int endColumn;
- String im = jjstrLiteralImages[jjmatchedKind];
- curTokenImage = (im == null) ? input_stream.GetImage() : im;
- beginLine = input_stream.getBeginLine();
- beginColumn = input_stream.getBeginColumn();
- endLine = input_stream.getEndLine();
- endColumn = input_stream.getEndColumn();
- t = Token.newToken(jjmatchedKind, curTokenImage);
+ /** Reinitialise parser. */
+ public void ReInit(SimpleCharStream stream) {
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+ }
- t.beginLine = beginLine;
- t.endLine = endLine;
- t.beginColumn = beginColumn;
- t.endColumn = endColumn;
+ private void ReInitRounds() {
+ int i;
+ jjround = 0x80000001;
+ for (i = 193; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+ }
- return t;
-}
+ /** Reinitialise parser. */
+ public void ReInit(SimpleCharStream stream, int lexState) {
+ ReInit(stream);
+ SwitchTo(lexState);
+ }
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
+ /** Switch to specified lex state. */
+ public void SwitchTo(int lexState) {
+ if (lexState >= 1 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.",
+ TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+ }
-/** Get the next Token. */
-public Token getNextToken()
-{
- Token matchedToken;
- int curPos = 0;
+ protected Token jjFillToken() {
+ final Token t;
+ final String curTokenImage;
+ final int beginLine;
+ final int endLine;
+ final int beginColumn;
+ final int endColumn;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ curTokenImage = (im == null) ? input_stream.GetImage() : im;
+ beginLine = input_stream.getBeginLine();
+ beginColumn = input_stream.getBeginColumn();
+ endLine = input_stream.getEndLine();
+ endColumn = input_stream.getEndColumn();
+ t = Token.newToken(jjmatchedKind, curTokenImage);
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- return matchedToken;
- }
- image = jjimage;
- image.setLength(0);
- jjimageLen = 0;
+ t.beginLine = beginLine;
+ t.endLine = endLine;
+ t.beginColumn = beginColumn;
+ t.endColumn = endColumn;
- 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 > 44)
- {
- jjmatchedKind = 44;
- }
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- TokenLexicalActions(matchedToken);
- return matchedToken;
- }
- else
- {
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
+ return t;
+ }
-void TokenLexicalActions(Token matchedToken)
-{
- switch(jjmatchedKind)
- {
- case 18 :
- image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
- matchedToken.image = image.substring(1, lengthOfMatch - 1);
- break;
- case 43 :
- image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
- matchedToken.image = image.substring(1, lengthOfMatch - 1);
- break;
- default :
- break;
- }
-}
-private void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
+ int curLexState = 0;
+ int defaultLexState = 0;
+ int jjnewStateCnt;
+ int jjround;
+ int jjmatchedPos;
+ int jjmatchedKind;
-private void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
+ /** Get the next Token. */
+ public Token getNextToken() {
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop: for (;;) {
+ try {
+ curChar = input_stream.BeginToken();
+ } catch (java.io.IOException e) {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ image = jjimage;
+ 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 > 44) {
+ jjmatchedKind = 44;
+ }
+ if (jjmatchedKind != 0x7fffffff) {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
+ matchedToken = jjFillToken();
+ TokenLexicalActions(matchedToken);
+ return matchedToken;
+ } else {
+ continue EOFLoop;
+ }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try {
+ input_stream.readChar();
+ input_stream.backup(1);
+ } catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ } else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar,
+ TokenMgrError.LEXICAL_ERROR);
+ }
+ }
+
+ void TokenLexicalActions(Token matchedToken) {
+ switch (jjmatchedKind) {
+ case 18:
+ image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
+ matchedToken.image = image.substring(1, lengthOfMatch - 1);
+ break;
+ case 43:
+ image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
+ matchedToken.image = image.substring(1, lengthOfMatch - 1);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void jjCheckNAdd(int state) {
+ if (jjrounds[state] != jjround) {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+ }
+
+ private void jjAddStates(int start, int end) {
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+ }
+
+ private void jjCheckNAddTwoStates(int state1, int state2) {
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+ }
+
+ private void jjCheckNAddStates(int start, int end) {
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
index 1ad420d..7c9dc28 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/ParseException.java
@@ -3,185 +3,176 @@
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.
+ * 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.
+ * 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;
+ /**
+ * 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.
- */
+ /**
+ * 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;
+ }
- public ParseException() {
- super();
- }
+ /**
+ * 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.
+ */
- /** Constructor with message. */
- public ParseException(String message) {
- super(message);
- }
+ 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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 + " ";
+ /**
+ * 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;
}
- retval += expected.toString();
- return retval;
- }
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
+ /**
+ * 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;
+ /**
+ * 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();
- }
+ return retval.toString();
+ }
}
-/* JavaCC - OriginalChecksum=83a1ca447d862df57c34d5cbcbc80371 (do not edit this line) */
+/*
+ * JavaCC - OriginalChecksum=83a1ca447d862df57c34d5cbcbc80371 (do not edit this
+ * line)
+ */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
index efca80d..3de681a 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/SimpleCharStream.java
@@ -7,465 +7,410 @@ package org.apache.sling.resource.stream.impl;
* 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;
+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());
}
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
+
+ bufsize += 2048;
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 = 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;
- 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++;
+
+ 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
- bufline[j] = newLine;
- }
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1);
}
- line = bufline[j];
- column = bufcolumn[j];
- }
+ /** 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) */
+/*
+ * JavaCC - OriginalChecksum=6135efa69418e21b667355763fbdf75c (do not edit this
+ * line)
+ */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
index 5554f10..c378116 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/Token.java
@@ -8,124 +8,119 @@ package org.apache.sling.resource.stream.impl;
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);
+ /**
+ * 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;
}
- }
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, 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) */
+/*
+ * JavaCC - OriginalChecksum=a81505762739ec99dc6610e2843bdc32 (do not edit this
+ * line)
+ */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
index d989d49..bba6c26 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/TokenMgrError.java
@@ -3,145 +3,143 @@
package org.apache.sling.resource.stream.impl;
/** Token Manager Error. */
-public class TokenMgrError extends 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;
+ /**
+ * 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.
- */
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
- }
+ /**
+ * 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();
}
- 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) + "\"");
- }
+ /**
+ * 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();
- }
+ /**
+ * 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.
- */
+ /*
+ * Constructors of various flavors follow.
+ */
- /** No arg constructor. */
- public TokenMgrError() {
- }
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
+ /** 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);
- }
+ /** 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) */
+/*
+ * JavaCC - OriginalChecksum=cb6190a073e75e5f61dac8e989eb2b78 (do not edit this
+ * line)
+ */
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
index e15c6e4..d15c780 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/node/Node.java
@@ -24,71 +24,74 @@ import org.apache.sling.resource.stream.api.Visitor;
*/
public class Node {
- public String text;
- public Node leftNode;
- public Node rightNode;
- public List<Node> children = Collections.emptyList();
- public int kind;
-
- /**
- * creates a node which represents a literal
- *
- * @param value
- */
- public Node(int kind, String text) {
- this.kind = kind;
- this.text = text;
- }
-
- /**
- * creates a logical node
- *
- * @param value
- */
- public Node(int kind, List<Node> children) {
- this.kind = kind;
- this.children = children;
- }
-
- /**
- * Node with children
- *
- * @param value
- */
- public Node(int kind, String text, List<Node> children) {
- this.kind = kind;
- this.text = text;
- this.children = children;
- }
+ public String text;
+ public Node leftNode;
+ public Node rightNode;
+ public List<Node> children = Collections.emptyList();
+ public int kind;
+ /**
+ * creates a node which represents a literal
+ *
+ * @param value
+ */
+ public Node(int kind, String text) {
+ this.kind = kind;
+ this.text = text;
+ }
- /**
- * Node used for comparison
- *
- * @param kind nominally of type comparison
- * @param operator defines the type of comparison
- * @param leftValue basis of comparison
- * @param rightValue to be compared to
- */
- public Node(int kind, String operator, Node leftValue, Node rightValue) {
- this.kind = kind;
- this.text = operator;
- this.leftNode = leftValue;
- this.rightNode = rightValue;
- }
+ /**
+ * creates a logical node
+ *
+ * @param value
+ */
+ public Node(int kind, List<Node> children) {
+ this.kind = kind;
+ this.children = children;
+ }
- public <R> R accept(Visitor<R> visitor) {
- return visitor.visit(this);
- }
+ /**
+ * Node with children
+ *
+ * @param value
+ */
+ public Node(int kind, String text, List<Node> children) {
+ this.kind = kind;
+ this.text = text;
+ this.children = children;
+ }
- @Override
- public String toString() {
- return text + children.stream().map(item -> item.toString())
- .collect(Collectors.joining(text.toString(), "(", ")"));
- }
+ /**
+ * Node used for comparison
+ *
+ * @param kind
+ * nominally of type comparison
+ * @param operator
+ * defines the type of comparison
+ * @param leftValue
+ * basis of comparison
+ * @param rightValue
+ * to be compared to
+ */
+ public Node(int kind, String operator, Node leftValue, Node rightValue) {
+ this.kind = kind;
+ this.text = operator;
+ this.leftNode = leftValue;
+ this.rightNode = rightValue;
+ }
- public <R, A> List<R> visitChildren(Visitor<R> visitor) {
- return children.stream().map(child -> child.accept(visitor)).collect(Collectors.toList());
- }
+ public <R> R accept(Visitor<R> visitor) {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public String toString() {
+ return text
+ + children.stream().map(item -> item.toString()).collect(Collectors.joining(text.toString(), "(", ")"));
+ }
+
+ public <R, A> List<R> visitChildren(Visitor<R> visitor) {
+ return children.stream().map(child -> child.accept(visitor)).collect(Collectors.toList());
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
index c71b774..03f7fff 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicateFactory.java
@@ -21,39 +21,39 @@ import org.apache.sling.resource.stream.impl.FilterParserConstants;
public class ComparisonPredicateFactory {
- public static Predicate<Resource> toPredicate(int kind, Function<Resource, Object> leftValue,
- Function<Resource, Object> rightValue) {
- switch (kind) {
- case FilterParserConstants.EQUAL:
- return ComparisonPredicates.is(leftValue, rightValue);
- case FilterParserConstants.NOT_EQUAL:
- return ComparisonPredicates.isNot(leftValue, rightValue);
- case FilterParserConstants.GREATER_THAN:
- return ComparisonPredicates.gt(leftValue, rightValue);
- case FilterParserConstants.GREATER_THAN_OR_EQUAL:
- return ComparisonPredicates.gte(leftValue, rightValue);
- case FilterParserConstants.LESS_THAN:
- return ComparisonPredicates.lt(leftValue, rightValue);
- case FilterParserConstants.LESS_THAN_OR_EQUAL:
- return ComparisonPredicates.lte(leftValue, rightValue);
- case FilterParserConstants.LIKE:
- return ComparisonPredicates.like(leftValue, rightValue);
- case FilterParserConstants.LIKE_NOT:
- return ComparisonPredicates.like(leftValue, rightValue).negate();
- case FilterParserConstants.CONTAINS:
- return ComparisonPredicates.contains(leftValue, rightValue);
- case FilterParserConstants.CONTAINS_NOT:
- return ComparisonPredicates.contains(leftValue, rightValue).negate();
- case FilterParserConstants.CONTAINS_ANY:
- return ComparisonPredicates.containsAny(leftValue, rightValue);
- case FilterParserConstants.CONTAINS_NOT_ANY:
- return ComparisonPredicates.containsAny(leftValue, rightValue).negate();
- case FilterParserConstants.IN:
- return ComparisonPredicates.in(leftValue, rightValue);
- case FilterParserConstants.NOT_IN:
- return ComparisonPredicates.in(leftValue, rightValue).negate();
- }
- return null;
- }
+ public static Predicate<Resource> toPredicate(int kind, Function<Resource, Object> leftValue,
+ Function<Resource, Object> rightValue) {
+ switch (kind) {
+ case FilterParserConstants.EQUAL:
+ return ComparisonPredicates.is(leftValue, rightValue);
+ case FilterParserConstants.NOT_EQUAL:
+ return ComparisonPredicates.isNot(leftValue, rightValue);
+ case FilterParserConstants.GREATER_THAN:
+ return ComparisonPredicates.gt(leftValue, rightValue);
+ case FilterParserConstants.GREATER_THAN_OR_EQUAL:
+ return ComparisonPredicates.gte(leftValue, rightValue);
+ case FilterParserConstants.LESS_THAN:
+ return ComparisonPredicates.lt(leftValue, rightValue);
+ case FilterParserConstants.LESS_THAN_OR_EQUAL:
+ return ComparisonPredicates.lte(leftValue, rightValue);
+ case FilterParserConstants.LIKE:
+ return ComparisonPredicates.like(leftValue, rightValue);
+ case FilterParserConstants.LIKE_NOT:
+ return ComparisonPredicates.like(leftValue, rightValue).negate();
+ case FilterParserConstants.CONTAINS:
+ return ComparisonPredicates.contains(leftValue, rightValue);
+ case FilterParserConstants.CONTAINS_NOT:
+ return ComparisonPredicates.contains(leftValue, rightValue).negate();
+ case FilterParserConstants.CONTAINS_ANY:
+ return ComparisonPredicates.containsAny(leftValue, rightValue);
+ case FilterParserConstants.CONTAINS_NOT_ANY:
+ return ComparisonPredicates.containsAny(leftValue, rightValue).negate();
+ case FilterParserConstants.IN:
+ return ComparisonPredicates.in(leftValue, rightValue);
+ case FilterParserConstants.NOT_IN:
+ return ComparisonPredicates.in(leftValue, rightValue).negate();
+ }
+ return null;
+ }
}
\ No newline at end of file
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
index 45ff89f..b0700a3 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/ComparisonPredicates.java
@@ -33,356 +33,355 @@ import org.apache.sling.api.resource.Resource;
*/
public class ComparisonPredicates {
- /**
- * Values are converted to Strings.
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if right hand String is equal to left hand String
- */
- public static Predicate<Resource> is(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
- CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return (rhValue instanceof Null || lhValue instanceof Null);
- }
- return lhValue.equals(rhValue);
- };
+ /**
+ * Values are converted to Strings.
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if right hand String is equal to left hand String
+ */
+ public static Predicate<Resource> is(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
+ CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return (rhValue instanceof Null || lhValue instanceof Null);
+ }
+ return lhValue.equals(rhValue);
+ };
- }
-
- /**
- * Values are converted to Strings.
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if right hand String is equal to left hand String
- */
- public static Predicate<Resource> isNot(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
- CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- return !lhValue.equals(rhValue);
- };
+ }
- }
+ /**
+ * Values are converted to Strings.
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if right hand String is equal to left hand String
+ */
+ public static Predicate<Resource> isNot(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
+ CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ return !lhValue.equals(rhValue);
+ };
- /**
- * Values are converted to Strings. Right hand value is treated as a Regular
- * expression.
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if right hand value pattern matches the left hand value
- */
- public static Predicate<Resource> like(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "value may not be null");
- return resource -> {
- CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
- CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- return Pattern.matches(rhValue.toString(), lhValue);
- };
+ }
- }
+ /**
+ * Values are converted to Strings. Right hand value is treated as a Regular
+ * expression.
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if right hand value pattern matches the left hand value
+ */
+ public static Predicate<Resource> like(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "value may not be null");
+ return resource -> {
+ CharSequence lhValue = ComparisonPredicates.getString(lhs.apply(resource));
+ CharSequence rhValue = ComparisonPredicates.getString(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ return Pattern.matches(rhValue.toString(), lhValue);
+ };
- /**
- * Values are converted to a Number, and then additionally converted to a common
- * type as the basis of comparison
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand value is greater than right hand value
- */
- @SuppressWarnings("unchecked")
- public static Predicate<Resource> gt(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
- Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- lhValue = standardizeNumbers(lhValue, rhValue.getClass());
- rhValue = standardizeNumbers(rhValue, lhValue.getClass());
- if (lhValue instanceof Comparable) {
- return ((Comparable<Number>) lhValue).compareTo(rhValue) > 0;
- }
- return false;
- };
+ }
- }
+ /**
+ * Values are converted to a Number, and then additionally converted to a common
+ * type as the basis of comparison
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand value is greater than right hand value
+ */
+ @SuppressWarnings("unchecked")
+ public static Predicate<Resource> gt(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
+ Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ lhValue = standardizeNumbers(lhValue, rhValue.getClass());
+ rhValue = standardizeNumbers(rhValue, lhValue.getClass());
+ if (lhValue instanceof Comparable) {
+ return ((Comparable<Number>) lhValue).compareTo(rhValue) > 0;
+ }
+ return false;
+ };
- /**
- * Values are converted to a Number, and then additionally converted to a common
- * type as the basis of comparison
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand value is greater than or equal to right hand value
- */
- @SuppressWarnings("unchecked")
- public static Predicate<Resource> gte(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
- Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- lhValue = standardizeNumbers(lhValue, rhValue.getClass());
- rhValue = standardizeNumbers(rhValue, lhValue.getClass());
- if (lhValue instanceof Comparable) {
- return ((Comparable<Number>) lhValue).compareTo(rhValue) >= 0;
- }
- return false;
- };
- }
+ }
- /**
- * Values are converted to a Number, and then additionally converted to a common
- * type as the basis of comparison
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand value is less than right hand value
- */
- @SuppressWarnings("unchecked")
- public static Predicate<Resource> lt(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "type value may not be null");
- return resource -> {
- Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
- Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- lhValue = standardizeNumbers(lhValue, rhValue.getClass());
- rhValue = standardizeNumbers(rhValue, lhValue.getClass());
- if (lhValue instanceof Comparable) {
- return ((Comparable<Number>) lhValue).compareTo(rhValue) < 0;
- }
- return false;
- };
+ /**
+ * Values are converted to a Number, and then additionally converted to a common
+ * type as the basis of comparison
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand value is greater than or equal to right hand value
+ */
+ @SuppressWarnings("unchecked")
+ public static Predicate<Resource> gte(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
+ Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ lhValue = standardizeNumbers(lhValue, rhValue.getClass());
+ rhValue = standardizeNumbers(rhValue, lhValue.getClass());
+ if (lhValue instanceof Comparable) {
+ return ((Comparable<Number>) lhValue).compareTo(rhValue) >= 0;
+ }
+ return false;
+ };
+ }
- }
+ /**
+ * Values are converted to a Number, and then additionally converted to a common
+ * type as the basis of comparison
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand value is less than right hand value
+ */
+ @SuppressWarnings("unchecked")
+ public static Predicate<Resource> lt(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "type value may not be null");
+ return resource -> {
+ Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
+ Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ lhValue = standardizeNumbers(lhValue, rhValue.getClass());
+ rhValue = standardizeNumbers(rhValue, lhValue.getClass());
+ if (lhValue instanceof Comparable) {
+ return ((Comparable<Number>) lhValue).compareTo(rhValue) < 0;
+ }
+ return false;
+ };
- /**
- * Values are converted to a Number, and then additionally converted to a common
- * type as the basis of comparison
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand value is less than or equal to right hand value
- */
- @SuppressWarnings("unchecked")
- public static Predicate<Resource> lte(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
- Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
- if (lhValue == null || rhValue == null) {
- return false;
- }
- lhValue = standardizeNumbers(lhValue, rhValue.getClass());
- rhValue = standardizeNumbers(rhValue, lhValue.getClass());
- if (lhValue instanceof Comparable) {
- return ((Comparable<Number>) lhValue).compareTo(rhValue) <= 0;
- }
- return false;
- };
- }
+ }
- /**
- * Right and Left values are converted to String arrays
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand values are a subset of right hand values
- */
- public static Predicate<Resource> contains(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(rhs, "statement may not be null");
- return resource -> {
- String[] lhValues = adaptToArray(lhs.apply(resource));
- String[] rhValues = adaptToArray(rhs.apply(resource));
- if (lhValues == null || rhValues == null) {
- return false;
- }
- if (lhValues.length < rhValues.length) {
- return false;
- }
- for (String rhValue : rhValues) {
- innerLoop: {
- for (String lhValue : lhValues) {
- if (lhValue.equals(rhValue)) {
- break innerLoop;
- }
- }
- return false;
- }
- }
- // reaches here only if every rhValue was successfully found in
- // lhValues
- return true;
- };
- }
+ /**
+ * Values are converted to a Number, and then additionally converted to a common
+ * type as the basis of comparison
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand value is less than or equal to right hand value
+ */
+ @SuppressWarnings("unchecked")
+ public static Predicate<Resource> lte(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ Number lhValue = ComparisonPredicates.getNumber(lhs.apply(resource));
+ Number rhValue = ComparisonPredicates.getNumber(rhs.apply(resource));
+ if (lhValue == null || rhValue == null) {
+ return false;
+ }
+ lhValue = standardizeNumbers(lhValue, rhValue.getClass());
+ rhValue = standardizeNumbers(rhValue, lhValue.getClass());
+ if (lhValue instanceof Comparable) {
+ return ((Comparable<Number>) lhValue).compareTo(rhValue) <= 0;
+ }
+ return false;
+ };
+ }
- /**
- * Right and Left values are converted to String arrays
- *
- * @param lhs
- * Function which provides comparison value
- * @param rhs
- * Function which provides comparison value
- * @return true if the left hand values matches any of the right hand values
- */
- public static Predicate<Resource> containsAny(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- return resource -> {
- String[] lhValues = adaptToArray(lhs.apply(resource));
- String[] rhValues = adaptToArray(rhs.apply(resource));
- if (lhValues == null || rhValues == null) {
- return false;
- }
- for (String rhValue : rhValues) {
- for (String lhValue : lhValues) {
- if (lhValue.equals(rhValue)) {
- return true;
- }
- }
- }
- return false;
- };
- }
+ /**
+ * Right and Left values are converted to String arrays
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand values are a subset of right hand values
+ */
+ public static Predicate<Resource> contains(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(rhs, "statement may not be null");
+ return resource -> {
+ String[] lhValues = adaptToArray(lhs.apply(resource));
+ String[] rhValues = adaptToArray(rhs.apply(resource));
+ if (lhValues == null || rhValues == null) {
+ return false;
+ }
+ if (lhValues.length < rhValues.length) {
+ return false;
+ }
+ for (String rhValue : rhValues) {
+ innerLoop: {
+ for (String lhValue : lhValues) {
+ if (lhValue.equals(rhValue)) {
+ break innerLoop;
+ }
+ }
+ return false;
+ }
+ }
+ // reaches here only if every rhValue was successfully found in
+ // lhValues
+ return true;
+ };
+ }
- /**
- * Right and Left values are converted to String arrays
- *
- * @param lhs
- * Function which provides value for comparison
- * @param rhs
- * Function which provides value for comparison
- * @return true if left hand values are a subset of right hand values
- */
- public static Predicate<Resource> in(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
- Objects.requireNonNull(lhs, "left hand statement may not be null");
- Objects.requireNonNull(rhs, "right hand statement may not be null");
- return resource -> {
- String[] lhValues = adaptToArray(lhs.apply(resource));
- String[] rhValues = adaptToArray(rhs.apply(resource));
- if (lhValues == null || rhValues == null) {
- return false;
- }
- for (String lhValue : lhValues) {
- innerLoop: {
- for (String rhValue : rhValues) {
- if (rhValue.equals(lhValue)) {
- break innerLoop;
- }
- }
- return false;
- }
- }
- // reaches here only if every lhValue was successfully found in
- // rhValues
- return true;
- };
- }
+ /**
+ * Right and Left values are converted to String arrays
+ *
+ * @param lhs
+ * Function which provides comparison value
+ * @param rhs
+ * Function which provides comparison value
+ * @return true if the left hand values matches any of the right hand values
+ */
+ public static Predicate<Resource> containsAny(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ return resource -> {
+ String[] lhValues = adaptToArray(lhs.apply(resource));
+ String[] rhValues = adaptToArray(rhs.apply(resource));
+ if (lhValues == null || rhValues == null) {
+ return false;
+ }
+ for (String rhValue : rhValues) {
+ for (String lhValue : lhValues) {
+ if (lhValue.equals(rhValue)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+ }
- private static Number standardizeNumbers(Number value, Class<? extends Number> klass) {
- if (value.getClass() == klass || value instanceof BigDecimal) {
- return value;
- }
- if (value instanceof Double) {
- return BigDecimal.valueOf(value.doubleValue());
- }
- if (value instanceof Null) {
- return Double.NaN;
- }
- return BigDecimal.valueOf(value.longValue());
- }
+ /**
+ * Right and Left values are converted to String arrays
+ *
+ * @param lhs
+ * Function which provides value for comparison
+ * @param rhs
+ * Function which provides value for comparison
+ * @return true if left hand values are a subset of right hand values
+ */
+ public static Predicate<Resource> in(Function<Resource, Object> lhs, Function<Resource, Object> rhs) {
+ Objects.requireNonNull(lhs, "left hand statement may not be null");
+ Objects.requireNonNull(rhs, "right hand statement may not be null");
+ return resource -> {
+ String[] lhValues = adaptToArray(lhs.apply(resource));
+ String[] rhValues = adaptToArray(rhs.apply(resource));
+ if (lhValues == null || rhValues == null) {
+ return false;
+ }
+ for (String lhValue : lhValues) {
+ innerLoop: {
+ for (String rhValue : rhValues) {
+ if (rhValue.equals(lhValue)) {
+ break innerLoop;
+ }
+ }
+ return false;
+ }
+ }
+ // reaches here only if every lhValue was successfully found in
+ // rhValues
+ return true;
+ };
+ }
- private static String[] adaptToArray(Object arr) {
- if (arr instanceof String[] || arr == null) {
- return (String[]) arr;
- }
- ArrayList<CharSequence> response = new ArrayList<>();
- if (arr.getClass().isArray()) {
- for (Object thing : (Object[]) arr) {
- response.add(ComparisonPredicates.getString(thing));
- }
- } else {
- response.add(ComparisonPredicates.getString(arr));
- }
- return response.toArray(new String[] {});
- }
-
- private static CharSequence getString(final Object initialValue) {
- if (initialValue == null) {
- return null;
- }
- if (initialValue instanceof CharSequence) {
- return (CharSequence)initialValue;
- }
- else if (initialValue instanceof Instant) {
- return ((Instant)initialValue).atOffset(ZoneOffset.UTC).toString();
- } else {
- return initialValue.toString();
- }
-
- }
-
- private static Number getNumber(final Object initialValue) {
- if (initialValue == null) {
- return null;
- }
-
- if (initialValue instanceof Number) {
- return (Number)initialValue;
- }
-
- if (initialValue instanceof Instant) {
- return ((Instant)initialValue).toEpochMilli();
- } else {
- String value = initialValue.toString();
- try {
- return Integer.valueOf(value);
- } catch (NumberFormatException nfe) {
- try {
- return new BigDecimal(value);
- } catch (NumberFormatException nfe2) {
- try {
- return LocalDateTime.parse(value, DateTimeFormatter.ISO_DATE_TIME).toInstant(ZoneOffset.UTC)
- .toEpochMilli();
- } catch (DateTimeParseException dtpe) {
- // swallow
- return null;
- }
- }
- }
- }
- }
+ private static Number standardizeNumbers(Number value, Class<? extends Number> klass) {
+ if (value.getClass() == klass || value instanceof BigDecimal) {
+ return value;
+ }
+ if (value instanceof Double) {
+ return BigDecimal.valueOf(value.doubleValue());
+ }
+ if (value instanceof Null) {
+ return Double.NaN;
+ }
+ return BigDecimal.valueOf(value.longValue());
+ }
+
+ private static String[] adaptToArray(Object arr) {
+ if (arr instanceof String[] || arr == null) {
+ return (String[]) arr;
+ }
+ ArrayList<CharSequence> response = new ArrayList<>();
+ if (arr.getClass().isArray()) {
+ for (Object thing : (Object[]) arr) {
+ response.add(ComparisonPredicates.getString(thing));
+ }
+ } else {
+ response.add(ComparisonPredicates.getString(arr));
+ }
+ return response.toArray(new String[] {});
+ }
+
+ private static CharSequence getString(final Object initialValue) {
+ if (initialValue == null) {
+ return null;
+ }
+ if (initialValue instanceof CharSequence) {
+ return (CharSequence) initialValue;
+ } else if (initialValue instanceof Instant) {
+ return ((Instant) initialValue).atOffset(ZoneOffset.UTC).toString();
+ } else {
+ return initialValue.toString();
+ }
+
+ }
+
+ private static Number getNumber(final Object initialValue) {
+ if (initialValue == null) {
+ return null;
+ }
+
+ if (initialValue instanceof Number) {
+ return (Number) initialValue;
+ }
+
+ if (initialValue instanceof Instant) {
+ return ((Instant) initialValue).toEpochMilli();
+ } else {
+ String value = initialValue.toString();
+ try {
+ return Integer.valueOf(value);
+ } catch (NumberFormatException nfe) {
+ try {
+ return new BigDecimal(value);
+ } catch (NumberFormatException nfe2) {
+ try {
+ return LocalDateTime.parse(value, DateTimeFormatter.ISO_DATE_TIME).toInstant(ZoneOffset.UTC)
+ .toEpochMilli();
+ } catch (DateTimeParseException dtpe) {
+ // swallow
+ return null;
+ }
+ }
+ }
+ }
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
index 88a135d..573a824 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/impl/predicates/Null.java
@@ -20,50 +20,50 @@ package org.apache.sling.resource.stream.impl.predicates;
*/
public class Null extends Number implements CharSequence {
- /**
- * 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;
+ /**
+ * 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;
- @Override
- public boolean equals(Object obj) {
- return false;
- }
+ @Override
+ public boolean equals(Object obj) {
+ return false;
+ }
- @Override
- public int length() {
- return 0;
- }
+ @Override
+ public int length() {
+ return 0;
+ }
- @Override
- public char charAt(int index) {
- return 0;
- }
+ @Override
+ public char charAt(int index) {
+ return 0;
+ }
- @Override
- public CharSequence subSequence(int start, int end) {
- return null;
- }
+ @Override
+ public CharSequence subSequence(int start, int end) {
+ return null;
+ }
- @Override
- public int intValue() {
- return 0;
- }
+ @Override
+ public int intValue() {
+ return 0;
+ }
- @Override
- public long longValue() {
- return 0;
- }
+ @Override
+ public long longValue() {
+ return 0;
+ }
- @Override
- public float floatValue() {
- return 0;
- }
+ @Override
+ public float floatValue() {
+ return 0;
+ }
- @Override
- public double doubleValue() {
- return 0;
- }
+ @Override
+ public double doubleValue() {
+ return Double.NaN;
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/predicates/ChildResourcePredicates.java b/streams/src/main/java/org/apache/sling/resource/stream/predicates/ChildResourcePredicates.java
index 0fbcedc..808a762 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/predicates/ChildResourcePredicates.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/predicates/ChildResourcePredicates.java
@@ -40,42 +40,42 @@ import org.apache.sling.api.resource.Resource;
*/
public class ChildResourcePredicates {
- private final String name;
+ private final String name;
- private ChildResourcePredicates(String name) {
- this.name = Objects.requireNonNull(name, "name value may not be null");
- ;
- }
+ private ChildResourcePredicates(String name) {
+ this.name = Objects.requireNonNull(name, "name value may not be null");
+ ;
+ }
- /**
- * Instantiates a ChildResourcePredicate object to provide the application of
- * Predicates against the named child
- *
- * @param name
- * of the expected child resource
- * @return Object providing helper predicates for a child resource
- */
- static public ChildResourcePredicates child(String name) {
- return new ChildResourcePredicates(name);
- }
+ /**
+ * Instantiates a ChildResourcePredicate object to provide the application of
+ * Predicates against the named child
+ *
+ * @param name
+ * of the expected child resource
+ * @return Object providing helper predicates for a child resource
+ */
+ static public ChildResourcePredicates child(String name) {
+ return new ChildResourcePredicates(name);
+ }
- /**
- * Applies a predicate against the named child resource. The returned predicate
- * will always return 'false' for a child that doesn't exist
- *
- * @param predicate
- * to be used against the child resource
- * @return Predicate which will apply the given predicate to the child resource
- */
- public Predicate<Resource> has(Predicate<Resource> predicate) {
- Objects.requireNonNull(predicate, "predicate may not be null");
- return resource -> {
- Resource child = resource.getChild(name);
- if (child != null) {
- return predicate.test(child);
- }
- return false;
- };
- }
+ /**
+ * Applies a predicate against the named child resource. The returned predicate
+ * will always return 'false' for a child that doesn't exist
+ *
+ * @param predicate
+ * to be used against the child resource
+ * @return Predicate which will apply the given predicate to the child resource
+ */
+ public Predicate<Resource> has(Predicate<Resource> predicate) {
+ Objects.requireNonNull(predicate, "predicate may not be null");
+ return resource -> {
+ Resource child = resource.getChild(name);
+ if (child != null) {
+ return predicate.test(child);
+ }
+ return false;
+ };
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/predicates/Conditions.java b/streams/src/main/java/org/apache/sling/resource/stream/predicates/Conditions.java
index a6d07bf..a897d7f 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/predicates/Conditions.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/predicates/Conditions.java
@@ -24,44 +24,41 @@ import java.util.function.Predicate;
*/
public class Conditions {
- /**
- * Syntactic sugar to provide context for the builder
- *
- * @param predicate
- * to be wrapped
- * @return the predicate that was passed in
- */
- public static <T> Predicate<T> where(Predicate<T> predicate) {
- return predicate;
- }
+ /**
+ * Syntactic sugar to provide context for the builder
+ *
+ * @param predicate
+ * to be wrapped
+ * @return the predicate that was passed in
+ */
+ public static <T> Predicate<T> where(Predicate<T> predicate) {
+ return predicate;
+ }
- /**
- * Syntactic sugar to provide context for the builder
- *
- * @param predicate
- * to be wrapped
- * @return the predicate that was passed in
- */
- public static <T> Predicate<T> when(Predicate<T> predicate) {
- return predicate;
- }
+ /**
+ * Syntactic sugar to provide context for the builder
+ *
+ * @param predicate
+ * to be wrapped
+ * @return the predicate that was passed in
+ */
+ public static <T> Predicate<T> when(Predicate<T> predicate) {
+ return predicate;
+ }
- /**
- * 'or' equivalent. only evaluates the second predicate if the first one
- * fails
- *
- * @param firstPredicate
- * always evaluated
- * @param secondPredicate
- * evaluated if firstPredicate returns false
- * @return a new predicate which wraps the or method on the firstPredicate
- */
- public static <T> Predicate<T> either(
- final Predicate<T> firstPredicate,
- final Predicate<T> secondPredicate) {
- Objects.requireNonNull(firstPredicate, "predicate may not be null");
- Objects.requireNonNull(secondPredicate, "predicate may not be null");
- return firstPredicate.or(secondPredicate);
- }
+ /**
+ * 'or' equivalent. only evaluates the second predicate if the first one fails
+ *
+ * @param firstPredicate
+ * always evaluated
+ * @param secondPredicate
+ * evaluated if firstPredicate returns false
+ * @return a new predicate which wraps the or method on the firstPredicate
+ */
+ public static <T> Predicate<T> either(final Predicate<T> firstPredicate, final Predicate<T> secondPredicate) {
+ Objects.requireNonNull(firstPredicate, "predicate may not be null");
+ Objects.requireNonNull(secondPredicate, "predicate may not be null");
+ return firstPredicate.or(secondPredicate);
+ }
}
diff --git a/streams/src/main/java/org/apache/sling/resource/stream/predicates/PropertyPredicates.java b/streams/src/main/java/org/apache/sling/resource/stream/predicates/PropertyPredicates.java
index b6037a4..b652eb0 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/predicates/PropertyPredicates.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/predicates/PropertyPredicates.java
@@ -29,301 +29,296 @@ import org.apache.sling.api.resource.ValueMap;
* <br>
* is = equal to argument<br>
* isNot = not equal to argument<br>
- * isIn = property is a single value which matches one of the arguments passed in
- * for comparison<br>
+ * isIn = property is a single value which matches one of the arguments passed
+ * in for comparison<br>
* greaterThan = greater than the property<br>
* lessThan = less than the property<br>
- * exists = is the property of the child <br>
- * contains = property is an array which contains all of the arguments passed in<br>
+ * exists = is the property of the child <br>
+ * contains = property is an array which contains all of the arguments passed
+ * in<br>
*
*
*/
public class PropertyPredicates {
- // key value to be used against the provided resource object
- private final String key;
+ // key value to be used against the provided resource object
+ private final String key;
- private PropertyPredicates(String name) {
- this.key = Objects.requireNonNull(name, "value may not be null");;
- }
+ private PropertyPredicates(String name) {
+ this.key = Objects.requireNonNull(name, "value may not be null");
+ ;
+ }
- /**
- * Used to define which value in the underlying map will we be used.
- *
- * @param name key value of the property
- * @return PropertyPredicate instance
- */
- static public PropertyPredicates property(String name) {
- return new PropertyPredicates(name);
- }
-
- /**
- * Assumes that the referenced property value is a date and that this date
- * is earlier in the epoch than the one being tested
- *
- * @param when latest acceptable time
- * @return predicate which will perform the matching
- */
- public Predicate<Resource> isBefore(Date when) {
- Objects.requireNonNull(when, "value may not be null");
- return value -> {
- Date then = value.adaptTo(ValueMap.class).get(key, Date.class);
- if (then != null) {
- return then.before(when);
- }
- return false;
- };
- }
+ /**
+ * Used to define which value in the underlying map will we be used.
+ *
+ * @param name
+ * key value of the property
+ * @return PropertyPredicate instance
+ */
+ static public PropertyPredicates property(String name) {
+ return new PropertyPredicates(name);
+ }
- /**
- * Assumes that the referenced property value is a date and that this date
- * is later in the epoch than the one being tested
- *
- * @param when earliest acceptable value
- * @return predicate
- */
- public Predicate<Resource> isAfter(Date when) {
- Objects.requireNonNull(when, "value may not be null");
- return value -> {
- Date then = value.adaptTo(ValueMap.class).get(key, Date.class);
- if (then != null) {
- return then.after(when);
- }
- return false;
- };
- }
+ /**
+ * Assumes that the referenced property value is a date and that this date is
+ * earlier in the epoch than the one being tested
+ *
+ * @param when
+ * latest acceptable time
+ * @return predicate which will perform the matching
+ */
+ public Predicate<Resource> isBefore(Date when) {
+ Objects.requireNonNull(when, "value may not be null");
+ return value -> {
+ Date then = value.adaptTo(ValueMap.class).get(key, Date.class);
+ if (then != null) {
+ return then.before(when);
+ }
+ return false;
+ };
+ }
- /*
- * Generic equalities method that is accessed via public methods that have
- * specific types
- */
- public <T> Predicate<Resource> is(T type) {
- Objects.requireNonNull(type, "type value may not be null");
- return resource -> {
- @SuppressWarnings("unchecked")
- T propValue = (T) valueMapOf(resource).get(key,
- type.getClass());
- return type.equals(propValue);
- };
+ /**
+ * Assumes that the referenced property value is a date and that this date is
+ * later in the epoch than the one being tested
+ *
+ * @param when
+ * earliest acceptable value
+ * @return predicate
+ */
+ public Predicate<Resource> isAfter(Date when) {
+ Objects.requireNonNull(when, "value may not be null");
+ return value -> {
+ Date then = value.adaptTo(ValueMap.class).get(key, Date.class);
+ if (then != null) {
+ return then.after(when);
+ }
+ return false;
+ };
+ }
- }
-
- /*
- * Generic greater then method that is accessed via public methods that have
- * specific types
- */
- public <T extends Comparable<T>> Predicate<Resource> greaterThan(T type) {
- Objects.requireNonNull(type, "type value may not be null");
- return resource -> {
- @SuppressWarnings("unchecked")
- T propValue = (T) valueMapOf(resource).get(key,
- type.getClass());
- if (propValue instanceof Comparable<?>){
- return ((Comparable<T>)propValue).compareTo(type) > 0;
- }
- return type.equals(propValue);
- };
+ /*
+ * Generic equalities method that is accessed via public methods that have
+ * specific types
+ */
+ public <T> Predicate<Resource> is(T type) {
+ Objects.requireNonNull(type, "type value may not be null");
+ return resource -> {
+ @SuppressWarnings("unchecked")
+ T propValue = (T) valueMapOf(resource).get(key, type.getClass());
+ return type.equals(propValue);
+ };
- }
-
- /*
- * Generic greater then method that is accessed via public methods that have
- * specific types
- */
- public <T extends Comparable<T>> Predicate<Resource> greaterThanOrEqual(T type) {
- Objects.requireNonNull(type, "type value may not be null");
- return resource -> {
- @SuppressWarnings("unchecked")
- T propValue = (T) valueMapOf(resource).get(key,
- type.getClass());
- if (propValue instanceof Comparable<?>){
- return ((Comparable<T>)propValue).compareTo(type) >= 0;
- }
- return type.equals(propValue);
- };
+ }
- }
-
- /*
- * Generic greater then method that is accessed via public methods that have
- * specific types
- */
- public <T extends Comparable<T>> Predicate<Resource> lessThan(T type) {
- Objects.requireNonNull(type, "type value may not be null");
- return resource -> {
- @SuppressWarnings("unchecked")
- T propValue = (T) valueMapOf(resource).get(key,
- type.getClass());
- if (propValue instanceof Comparable<?>){
- return ((Comparable<T>)propValue).compareTo(type) < 0;
- }
- return type.equals(propValue);
- };
+ /*
+ * Generic greater then method that is accessed via public methods that have
+ * specific types
+ */
+ public <T extends Comparable<T>> Predicate<Resource> greaterThan(T type) {
+ Objects.requireNonNull(type, "type value may not be null");
+ return resource -> {
+ @SuppressWarnings("unchecked")
+ T propValue = (T) valueMapOf(resource).get(key, type.getClass());
+ if (propValue instanceof Comparable<?>) {
+ return ((Comparable<T>) propValue).compareTo(type) > 0;
+ }
+ return type.equals(propValue);
+ };
- }
-
- /*
- * Generic greater then method that is accessed via public methods that have
- * specific types
- */
- public <T extends Comparable<T>> Predicate<Resource> lessThanOrEqual(T type) {
- Objects.requireNonNull(type, "type value may not be null");
- return resource -> {
- @SuppressWarnings("unchecked")
- T propValue = (T) valueMapOf(resource).get(key,
- type.getClass());
- if (propValue instanceof Comparable<?>){
- return ((Comparable<T>)propValue).compareTo(type) >= 0;
- }
- return type.equals(propValue);
- };
+ }
- }
+ /*
+ * Generic greater then method that is accessed via public methods that have
+ * specific types
+ */
+ public <T extends Comparable<T>> Predicate<Resource> greaterThanOrEqual(T type) {
+ Objects.requireNonNull(type, "type value may not be null");
+ return resource -> {
+ @SuppressWarnings("unchecked")
+ T propValue = (T) valueMapOf(resource).get(key, type.getClass());
+ if (propValue instanceof Comparable<?>) {
+ return ((Comparable<T>) propValue).compareTo(type) >= 0;
+ }
+ return type.equals(propValue);
+ };
- public <T> Predicate<Resource> isNot(final T type) {
- return is(type).negate();
- }
+ }
- @SuppressWarnings("unchecked")
- public <T> Predicate<Resource> contains(final T[] values) {
- Objects.requireNonNull(values, "value may not be null");
- return resource -> {
- T[] propValues = (T[]) valueMapOf(resource).get(key,
- values.getClass());
- if (propValues == null) {
- if (values.length > 1) {
- // no point converting if the number of values to test
- // exceeds the possible values in the repository
- return false;
- }
- Class<?> componentType = values.getClass().getComponentType();
- T tempValue = (T) valueMapOf(resource).get(key,
- componentType);
- if (tempValue != null) {
- propValues = (T[]) Array.newInstance(componentType, 1);
- propValues[0] = tempValue;
- }
- }
- // property identified by resource is either not present or is
- // of a type that is not the type being requested
- if (propValues == null || propValues.length < values.length) {
- return false;
- }
- // validate that all items in values have matches in properties
- for (T item : values) {
- innerloop: {
- for (T propItem : propValues) {
- if (item.equals(propItem)) {
- break innerloop;
- }
- }
- return false;
- }
- }
- return true;
- };
+ /*
+ * Generic greater then method that is accessed via public methods that have
+ * specific types
+ */
+ public <T extends Comparable<T>> Predicate<Resource> lessThan(T type) {
+ Objects.requireNonNull(type, "type value may not be null");
+ return resource -> {
+ @SuppressWarnings("unchecked")
+ T propValue = (T) valueMapOf(resource).get(key, type.getClass());
+ if (propValue instanceof Comparable<?>) {
+ return ((Comparable<T>) propValue).compareTo(type) < 0;
+ }
+ return type.equals(propValue);
+ };
- }
-
- /**
- * Contains any take one or move values as it's input and returns true if any of
- * the property values matches any of the provides values.
- *
- * @param values
- * One or more objects to be compared with
- * @return
- */
- @SuppressWarnings("unchecked")
- public <T> Predicate<Resource> containsAny(final T... values) {
- Objects.requireNonNull(values, "value may not be null");
- return resource -> {
- T[] propValues = (T[]) valueMapOf(resource).get(key, values.getClass());
- if (propValues == null) {
- if (values.length > 1) {
- // no point converting if the number of values to test
- // exceeds the possible values in the repository
- return false;
- }
- Class<?> componentType = values.getClass().getComponentType();
- T tempValue = (T) valueMapOf(resource).get(key, componentType);
- if (tempValue != null) {
- propValues = (T[]) Array.newInstance(componentType, 1);
- propValues[0] = tempValue;
- }
- }
- // property identified by resource is not present
- if (propValues == null) {
- return false;
- }
- // validate that all items in values have matches in properties
- for (T item : values) {
- for (T propItem : propValues) {
- if (item.equals(propItem)) {
- return true;
- }
- }
- }
- return false;
- };
+ }
- }
+ /*
+ * Generic greater then method that is accessed via public methods that have
+ * specific types
+ */
+ public <T extends Comparable<T>> Predicate<Resource> lessThanOrEqual(T type) {
+ Objects.requireNonNull(type, "type value may not be null");
+ return resource -> {
+ @SuppressWarnings("unchecked")
+ T propValue = (T) valueMapOf(resource).get(key, type.getClass());
+ if (propValue instanceof Comparable<?>) {
+ return ((Comparable<T>) propValue).compareTo(type) >= 0;
+ }
+ return type.equals(propValue);
+ };
+ }
- public <T> Predicate<Resource> isIn(final T[] values) {
- Objects.requireNonNull(values, "values may not be null");
- return resource -> {
- Object propValue = valueMapOf(resource).get(key,
- values.getClass().getComponentType());
- if (propValue == null) {
- return false;
- }
- for (T value : values) {
- if (value.equals(propValue)) {
- return true;
- }
- }
- return false;
- };
- }
+ public <T> Predicate<Resource> isNot(final T type) {
+ return is(type).negate();
+ }
- /**
- * property value is not null
- *
- * @return a predicate that determines existence of the value
- */
- public Predicate<Resource> exists() {
- return resource -> valueMapOf(resource).get(key) != null;
- }
+ @SuppressWarnings("unchecked")
+ public <T> Predicate<Resource> contains(final T[] values) {
+ Objects.requireNonNull(values, "value may not be null");
+ return resource -> {
+ T[] propValues = (T[]) valueMapOf(resource).get(key, values.getClass());
+ if (propValues == null) {
+ if (values.length > 1) {
+ // no point converting if the number of values to test
+ // exceeds the possible values in the repository
+ return false;
+ }
+ Class<?> componentType = values.getClass().getComponentType();
+ T tempValue = (T) valueMapOf(resource).get(key, componentType);
+ if (tempValue != null) {
+ propValues = (T[]) Array.newInstance(componentType, 1);
+ propValues[0] = tempValue;
+ }
+ }
+ // property identified by resource is either not present or is
+ // of a type that is not the type being requested
+ if (propValues == null || propValues.length < values.length) {
+ return false;
+ }
+ // validate that all items in values have matches in properties
+ for (T item : values) {
+ innerloop: {
+ for (T propItem : propValues) {
+ if (item.equals(propItem)) {
+ break innerloop;
+ }
+ }
+ return false;
+ }
+ }
+ return true;
+ };
- /**
- * property value is null
- *
- * @return a predicate that determines non existence of the value
- */
- public Predicate<Resource> doesNotExist() {
- return exists().negate();
- }
+ }
-
- public Predicate<Resource> isNotIn(final Object... objects) {
- Objects.requireNonNull(objects, "objects may not be null");
- return resource -> {
- Object value = valueMapOf(resource).get(key);
+ /**
+ * Contains any take one or move values as it's input and returns true if any of
+ * the property values matches any of the provides values.
+ *
+ * @param values
+ * One or more objects to be compared with
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Predicate<Resource> containsAny(final T... values) {
+ Objects.requireNonNull(values, "value may not be null");
+ return resource -> {
+ T[] propValues = (T[]) valueMapOf(resource).get(key, values.getClass());
+ if (propValues == null) {
+ if (values.length > 1) {
+ // no point converting if the number of values to test
+ // exceeds the possible values in the repository
+ return false;
+ }
+ Class<?> componentType = values.getClass().getComponentType();
+ T tempValue = (T) valueMapOf(resource).get(key, componentType);
+ if (tempValue != null) {
+ propValues = (T[]) Array.newInstance(componentType, 1);
+ propValues[0] = tempValue;
+ }
+ }
+ // property identified by resource is not present
+ if (propValues == null) {
+ return false;
+ }
+ // validate that all items in values have matches in properties
+ for (T item : values) {
+ for (T propItem : propValues) {
+ if (item.equals(propItem)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ }
+
+ public <T> Predicate<Resource> isIn(final T[] values) {
+ Objects.requireNonNull(values, "values may not be null");
+ return resource -> {
+ Object propValue = valueMapOf(resource).get(key, values.getClass().getComponentType());
+ if (propValue == null) {
+ return false;
+ }
+ for (T value : values) {
+ if (value.equals(propValue)) {
+ return true;
+ }
+ }
+ return false;
+ };
+ }
+
+ /**
+ * property value is not null
+ *
+ * @return a predicate that determines existence of the value
+ */
+ public Predicate<Resource> exists() {
+ return resource -> valueMapOf(resource).get(key) != null;
+ }
+
+ /**
+ * property value is null
+ *
+ * @return a predicate that determines non existence of the value
+ */
+ public Predicate<Resource> doesNotExist() {
+ return exists().negate();
+ }
+
+ public Predicate<Resource> isNotIn(final Object... objects) {
+ Objects.requireNonNull(objects, "objects may not be null");
+ return resource -> {
+ Object value = valueMapOf(resource).get(key);
+
+ for (Object object : objects) {
+ if (object.equals(value)) {
+ return false;
+ }
+ }
+ return true;
+ };
+ }
+
+ private ValueMap valueMapOf(Resource resource) {
+ if (resource == null || ResourceUtil.isNonExistingResource(resource)) {
+ return ValueMap.EMPTY;
+ }
+ return resource.adaptTo(ValueMap.class);
+ }
- for (Object object : objects) {
- if (object.equals(value)) {
- return false;
- }
- }
- return true;
- };
- }
-
- 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/predicates/ResourcePredicates.java b/streams/src/main/java/org/apache/sling/resource/stream/predicates/ResourcePredicates.java
index cb707f0..ed7ac8c 100644
--- a/streams/src/main/java/org/apache/sling/resource/stream/predicates/ResourcePredicates.java
+++ b/streams/src/main/java/org/apache/sling/resource/stream/predicates/ResourcePredicates.java
@@ -24,24 +24,24 @@ import org.apache.sling.api.resource.Resource;
*/
public class ResourcePredicates {
- /**
- * Convenience method to wrap the resources method 'isResourceType'
- *
- * @param resourceType
- * @return predicate which evaluates
- */
- public static Predicate<Resource> isResourceType(final String resourceType) {
- return resource -> resource.isResourceType(resourceType);
- }
+ /**
+ * Convenience method to wrap the resources method 'isResourceType'
+ *
+ * @param resourceType
+ * @return predicate which evaluates
+ */
+ public static Predicate<Resource> isResourceType(final String resourceType) {
+ return resource -> resource.isResourceType(resourceType);
+ }
- /**
- * Convenience method to determine depth of resource via the name pattern
- *
- * @param resourceType
- * @return predicate which evaluates
- */
- public static Predicate<Resource> depthIsLessThan(final int depth) {
- return resource -> resource.getPath().split("/").length < depth;
- }
+ /**
+ * Convenience method to determine depth of resource via the name pattern
+ *
+ * @param resourceType
+ * @return predicate which evaluates
+ */
+ public static Predicate<Resource> depthIsLessThan(final int depth) {
+ return resource -> resource.getPath().split("/").length < depth;
+ }
}
--
To stop receiving notification emails like this one, please contact
jeb@apache.org.