felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From db...@apache.org
Subject svn commit: r810280 - in /felix/trunk/gogo/runtime/src: main/java/org/apache/felix/gogo/runtime/shell/Closure.java main/java/org/apache/felix/gogo/runtime/shell/Parser.java test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
Date Tue, 01 Sep 2009 22:21:36 GMT
Author: dbaum
Date: Tue Sep  1 22:21:35 2009
New Revision: 810280

URL: http://svn.apache.org/viewvc?rev=810280&view=rev
Log:
FELIX-1526: rename <> operators to (), as this is more like bash.

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
    felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java?rev=810280&r1=810279&r2=810280&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
(original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
Tue Sep  1 22:21:35 2009
@@ -119,10 +119,10 @@
 		buf.append(' ');
                 buf.append(token);
             }
-            System.err.println(buf);
+            session.err.println(buf);
         }
 
-        if (statement.size() == 1 && statement.get(0).charAt(0) == '<')
+        if (statement.size() == 1 && statement.get(0).charAt(0) == '(')
         {
             return eval(statement.get(0));
         }
@@ -241,7 +241,7 @@
             char c = p.peek();
             if (!p.escaped)
             {
-                if (c == '$' || c == '<' || c == '\'' || c == '"' || c == '[' || c ==
'{')
+                if (c == '$' || c == '(' || c == '\'' || c == '"' || c == '[' || c == '{')
                 {
                     if (start != p.current || res != null)
                     {
@@ -294,9 +294,9 @@
                             res = array(seq.subSequence(start + 1, p.find(']', '[') - 1));
                             start = p.current;
                             continue;
-                        case '<':
+                        case '(':
                             p.next();
-                            Closure cl = new Closure(session, this, p.text.subSequence(start
+ 1, p.find('>', '<') - 1));
+                            Closure cl = new Closure(session, this, p.text.subSequence(start
+ 1, p.find(')', '(') - 1));
                             res = cl.execute(session, parms);
                             start = p.current;
                             continue;

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java?rev=810280&r1=810279&r2=810280&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
(original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
Tue Sep  1 22:21:35 2009
@@ -365,10 +365,10 @@
             int end = find('}', '{');
             return text.subSequence(start, end);
         }
-        if (c == '<')
+        if (c == '(')
         {
             next();
-            int end = find('>', '<');
+            int end = find(')', '(');
             return text.subSequence(start, end);
         }
 

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java?rev=810280&r1=810279&r2=810280&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
(original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
Tue Sep  1 22:21:35 2009
@@ -42,8 +42,8 @@
         c.addCommand("capture", this);
 
         assertEquals("a", c.execute("echo a | capture"));
-        assertEquals("a", c.execute("<echo a> | capture"));
-        assertEquals("a", c.execute("<<echo a>> | capture"));
+        assertEquals("a", c.execute("(echo a) | capture"));
+        assertEquals("a", c.execute("((echo a)) | capture"));
     }
 
     public void testUnknownCommand() throws Exception
@@ -110,12 +110,12 @@
         c.addCommand("grep", this);
         c.addCommand("echoout", this);
         c.execute("myecho = { echoout $args }");
-        assertEquals("def", c.execute("echo def|grep (d.*)|capture"));
-        assertEquals("def", c.execute("echoout def|grep (d.*)|capture"));
-        assertEquals("def", c.execute("myecho def|grep (d.*)|capture"));
-        assertEquals("def", c.execute("echo abc; echo def; echo ghi|grep (d.*)|capture"));
+        assertEquals("def", c.execute("echo def|grep d.*|capture"));
+        assertEquals("def", c.execute("echoout def|grep d.*|capture"));
+        assertEquals("def", c.execute("myecho def|grep d.*|capture"));
+        assertEquals("def", c.execute("echo abc; echo def; echo ghi|grep d.*|capture"));
         assertEquals("hello world", c.execute("echo hello world|capture"));
-        assertEquals("defghi", c.execute("echo abc; echo def; echo ghi|grep (def|ghi)|capture"));
+        assertEquals("defghi", c.execute("echo abc; echo def; echo ghi|grep 'def|ghi'|capture"));
     }
 
     public void testAssignment() throws Exception
@@ -126,8 +126,8 @@
         assertEquals("a", c.execute("a = a; echo $$a"));
 
         assertEquals("hello", c.execute("echo hello"));
-        assertEquals("hello", c.execute("a = <echo hello>"));
-        assertEquals("a", c.execute("a = a; echo $<echo a>"));
+        assertEquals("hello", c.execute("a = (echo hello)"));
+        assertEquals("a", c.execute("a = a; echo $(echo a)"));
         assertEquals("3", c.execute("a=3; echo $a"));
         assertEquals("3", c.execute("a = 3; echo $a"));
         assertEquals("a", c.execute("a = a; echo $$a"));
@@ -239,9 +239,9 @@
         Context c = new Context();
         c.addCommand("echo", this);
         assertEquals("a", c.execute("echo a") + "");
-        assertEquals("a", c.execute("<echo echo> a") + "");
-        assertEquals("a", c.execute("<<echo echo> echo> <echo a>") + "");
-        assertEquals("3", c.execute("[a=2 <echo b>=<echo 3>] get b").toString());
+        assertEquals("a", c.execute("(echo echo) a") + "");
+        assertEquals("a", c.execute("((echo echo) echo) (echo a)") + "");
+        assertEquals("3", c.execute("[a=2 (echo b)=(echo 3)] get b").toString());
     }
 
     public CharSequence echo(Object args[])
@@ -286,7 +286,7 @@
         assertEquals(10, beentheredonethat);
 
         beentheredonethat = 0;
-        Integer result = (Integer) c.execute("ls <ls 5>");
+        Integer result = (Integer) c.execute("ls (ls 5)");
         assertEquals(10, beentheredonethat);
         assertEquals((Integer) 5, result);
     }
@@ -341,13 +341,13 @@
 
     public void testSimpleValue()
     {
-        List<CharSequence> x = new Parser("abc def.ghi http://www.osgi.org?abc=&x=1
[1,2,3] {{{{{{{xyz}}}}}}} <immediate> {'{{{{{'} {\\}} 'abc{}'").statement();
+        List<CharSequence> x = new Parser("abc def.ghi http://www.osgi.org?abc=&x=1
[1,2,3] {{{{{{{xyz}}}}}}} (immediate) {'{{{{{'} {\\}} 'abc{}'").statement();
         assertEquals("abc", x.get(0));
         assertEquals("def.ghi", x.get(1));
         assertEquals("http://www.osgi.org?abc=&x=1", x.get(2));
         assertEquals("[1,2,3]", x.get(3));
         assertEquals("{{{{{{{xyz}}}}}}}", x.get(4));
-        assertEquals("<immediate>", x.get(5));
+        assertEquals("(immediate)", x.get(5));
         assertEquals("{'{{{{{'}", x.get(6));
         assertEquals("{\\}}", x.get(7));
         assertEquals("'abc{}'", x.get(8));



Mime
View raw message