summaryrefslogtreecommitdiffstats
path: root/src/wcps/server/cli/grammar.java
diff options
context:
space:
mode:
authorAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-06-08 17:49:13 +0200
committerAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-07-07 10:55:14 +0200
commitd2b0e006273d55c170ed6cd56f9509bc1eaa90eb (patch)
treeb778bcbf3211d2ff5d5a0dee8daaad480095aa8c /src/wcps/server/cli/grammar.java
parente60efdbfb39124b6a36465e17fe2ad349580c18b (diff)
Implemented Condense Expression and Constant Coverage Expression. WCPS Grammar modified
Diffstat (limited to 'src/wcps/server/cli/grammar.java')
-rw-r--r--src/wcps/server/cli/grammar.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/wcps/server/cli/grammar.java b/src/wcps/server/cli/grammar.java
index eabee72..29961a2 100644
--- a/src/wcps/server/cli/grammar.java
+++ b/src/wcps/server/cli/grammar.java
@@ -24,22 +24,30 @@ public class grammar {
if (args.length != 1)
{
System.err.println("AbstractGrammarGen: no query as parameter !");
- query = "for r in (rgb) return encode( r * ((r.green > 130) and " +
- "(r.red < 110)), \"jpeg\")";
+ query = "for a in (rgb) return " +
+ "condense + over $x x(1:10), $y y(25:75) " +
+ "using $x * (a[x($x), y($y)]).red";
}
else
query = args[0];
System.out.println("Running with the following query: " + query);
- String xmlString = runQuery(query);
+ String xmlString = convertAbstractQueryToXml(query);
System.out.println("Output XML: \n****************\n" + xmlString);
System.exit(0);
}
- public static String runQuery(String query) throws IOException, RecognitionException
+ /** Converts a WCPS abstract syntax query to an XML query
+ *
+ * @param query Abstract Syntax query
+ * @return String XML query
+ * @throws java.io.IOException
+ * @throws org.antlr.runtime.RecognitionException
+ */
+ public static String convertAbstractQueryToXml(String query) throws IOException, RecognitionException
{
InputStream stream = new ByteArrayInputStream(query.getBytes()); // defaults to ISO-1
ANTLRInputStream inputStream = new ANTLRInputStream(stream);