You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/05/25 08:01:56 UTC

svn commit: r409309 - in /geronimo/sandbox/gshell/trunk/gshell-core: ./ src/main/grammar/ src/main/java/org/apache/geronimo/gshell/commandline/ src/main/java/org/apache/geronimo/gshell/commandline/parser/ src/test/java/org/apache/geronimo/gshell/comman...

Author: jdillon
Date: Wed May 24 23:01:55 2006
New Revision: 409309

URL: http://svn.apache.org/viewvc?rev=409309&view=rev
Log:
Opaque (single quoted) arguments

Added:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLineBuilder.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/parser/ASTOpaqueArgument.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/grammar/CommandLineParser.jjt
    geronimo/sandbox/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/commandline/parser/CommandLineParserTest.java

Modified: geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/pom.xml?rev=409309&r1=409308&r2=409309&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/pom.xml Wed May 24 23:01:55 2006
@@ -105,6 +105,7 @@
                                     <fileset dir="${pom.basedir}/target/generated-sources/jjtree">
                                         <include name="ASTPlainArgument.java"/>
                                         <include name="ASTQuotedArgument.java"/>
+                                        <include name="ASTOpaqueArgument.java"/>
                                     </fileset>
                                 </delete>
                             </tasks>

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/grammar/CommandLineParser.jjt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/grammar/CommandLineParser.jjt?rev=409309&r1=409308&r2=409309&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/grammar/CommandLineParser.jjt (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/grammar/CommandLineParser.jjt Wed May 24 23:01:55 2006
@@ -86,6 +86,19 @@
       )+
   >
 |
+  < OPAQUE_ARGUMENT:
+      "'"
+      (   (~["\"","\\","\n","\r"])
+        | ("\\"
+            ( ["n","t","b","r","f","\\","'","\""]
+            | ["0"-"7"] ( ["0"-"7"] )?
+            | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+            )
+          )
+      )*
+      "'"
+  >
+|
   < QUOTED_ARGUMENT:
       "\""
       (   (~["\"","\\","\n","\r"])
@@ -115,7 +128,7 @@
 
 void Argument() : {}
 {
-    QuotedArgument() | PlainArgument()
+    QuotedArgument() | OpaqueArgument() | PlainArgument()
 }
 
 void QuotedArgument() #QuotedArgument:
@@ -124,6 +137,17 @@
 }
 {
     t=<QUOTED_ARGUMENT>
+    {
+        jjtThis.setToken(t);
+    }
+}
+
+void OpaqueArgument() #OpaqueArgument:
+{
+    Token t;
+}
+{
+    t=<OPAQUE_ARGUMENT>
     {
         jjtThis.setToken(t);
     }

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java?rev=409309&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java Wed May 24 23:01:55 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * 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.geronimo.gshell.commandline;
+
+/**
+ * ???
+ *
+ * @version $Id: Variables.java 404908 2006-05-08 03:42:51Z jdillon $
+ */
+public class CommandLine
+{
+    //
+    // void execute() throws Exception;
+    //
+}

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLineBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLineBuilder.java?rev=409309&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLineBuilder.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/CommandLineBuilder.java Wed May 24 23:01:55 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * 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.geronimo.gshell.commandline;
+
+/**
+ * ???
+ *
+ * @version $Id: Variables.java 404908 2006-05-08 03:42:51Z jdillon $
+ */
+public class CommandLineBuilder
+{
+}

Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/parser/ASTOpaqueArgument.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/parser/ASTOpaqueArgument.java?rev=409309&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/parser/ASTOpaqueArgument.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/parser/ASTOpaqueArgument.java Wed May 24 23:01:55 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * 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.geronimo.gshell.commandline.parser;
+
+/**
+ * Represents a <em>plain</em> unquoted argument.
+ *
+ * @version $Id$
+ */
+public class ASTOpaqueArgument
+    extends ASTArgumentSupport
+{
+    public ASTOpaqueArgument(int id) {
+        super(id);
+    }
+
+    public ASTOpaqueArgument(CommandLineParser p, int id) {
+        super(p, id);
+    }
+}
\ No newline at end of file

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/commandline/parser/CommandLineParserTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/commandline/parser/CommandLineParserTest.java?rev=409309&r1=409308&r2=409309&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/commandline/parser/CommandLineParserTest.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/commandline/parser/CommandLineParserTest.java Wed May 24 23:01:55 2006
@@ -98,4 +98,14 @@
         // TODO: Verify 2 plain arguments + 1 quoted
         //
     }
+
+    public void testOpaqueArguments1() throws Exception {
+        String input = "a 'b -c' d";
+
+        ASTCommandLine cl = parse(input);
+
+        //
+        // TODO: Verify 2 plain arguments + 1 opaque
+        //
+    }
 }