FELIX-1526: rename <> operators to (), as this is more like bash.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@810280 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
index ae188c5..1b01fdd 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
@@ -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;
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
index e705335..60d09ba 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
@@ -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);
}
diff --git a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
index 54aeb02..804261c 100644
--- a/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
+++ b/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
@@ -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));