aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/select/parser
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /document/src/main/java/com/yahoo/document/select/parser
Publish
Diffstat (limited to 'document/src/main/java/com/yahoo/document/select/parser')
-rw-r--r--document/src/main/java/com/yahoo/document/select/parser/SelectInput.java14
-rw-r--r--document/src/main/java/com/yahoo/document/select/parser/SelectParserUtils.java27
-rw-r--r--document/src/main/java/com/yahoo/document/select/parser/package-info.java7
3 files changed, 48 insertions, 0 deletions
diff --git a/document/src/main/java/com/yahoo/document/select/parser/SelectInput.java b/document/src/main/java/com/yahoo/document/select/parser/SelectInput.java
new file mode 100644
index 00000000000..957a038d44a
--- /dev/null
+++ b/document/src/main/java/com/yahoo/document/select/parser/SelectInput.java
@@ -0,0 +1,14 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.document.select.parser;
+
+import com.yahoo.javacc.FastCharStream;
+
+/**
+ * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ */
+public class SelectInput extends FastCharStream implements CharStream {
+
+ public SelectInput(String input) {
+ super(input);
+ }
+}
diff --git a/document/src/main/java/com/yahoo/document/select/parser/SelectParserUtils.java b/document/src/main/java/com/yahoo/document/select/parser/SelectParserUtils.java
new file mode 100644
index 00000000000..c8458bcb5aa
--- /dev/null
+++ b/document/src/main/java/com/yahoo/document/select/parser/SelectParserUtils.java
@@ -0,0 +1,27 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.document.select.parser;
+
+import com.yahoo.javacc.UnicodeUtilities;
+
+import java.math.BigInteger;
+
+/**
+ * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ */
+public class SelectParserUtils {
+
+ public static long decodeLong(String str) {
+ if (str.startsWith("0x") || str.startsWith("0X")) {
+ str = Long.toString(new BigInteger(str.substring(2), 16).longValue());
+ }
+ return Long.decode(str);
+ }
+
+ public static String quote(String str, char quote) {
+ return UnicodeUtilities.quote(str, quote);
+ }
+
+ public static String unquote(String str) {
+ return UnicodeUtilities.unquote(str);
+ }
+}
diff --git a/document/src/main/java/com/yahoo/document/select/parser/package-info.java b/document/src/main/java/com/yahoo/document/select/parser/package-info.java
new file mode 100644
index 00000000000..7f058e86e28
--- /dev/null
+++ b/document/src/main/java/com/yahoo/document/select/parser/package-info.java
@@ -0,0 +1,7 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage
+@PublicApi
+package com.yahoo.document.select.parser;
+
+import com.yahoo.api.annotations.PublicApi;
+import com.yahoo.osgi.annotation.ExportPackage;