|
From: <cr...@us...> - 2009-02-01 09:15:54
|
Revision: 4954
http://jnode.svn.sourceforge.net/jnode/?rev=4954&view=rev
Author: crawley
Date: 2009-02-01 09:15:46 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
Fix for tokenization bug which caused '#' to be treated as a comment
start in ${#a}. Also diagnose a missing '}' in ${a.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneTokenizer.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java 2009-02-01 06:49:07 UTC (rev 4953)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneContext.java 2009-02-01 09:15:46 UTC (rev 4954)
@@ -630,6 +630,10 @@
}
ch = ci.nextCh();
}
+
+ if (braceLevel > 0) {
+ throw new ShellSyntaxException("unmatched '{'");
+ }
// Deal with case where the braces are empty ...
if (sb.length() == 0) {
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneTokenizer.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneTokenizer.java 2009-02-01 06:49:07 UTC (rev 4953)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneTokenizer.java 2009-02-01 09:15:46 UTC (rev 4954)
@@ -222,7 +222,6 @@
case ';':
case '&':
case '|':
- case '#':
case ' ':
case '\t':
if (quoteChar == 0) {
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-01 06:49:07 UTC (rev 4953)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-01 09:15:46 UTC (rev 4954)
@@ -117,8 +117,8 @@
<command>test</command>
<runMode>AS_SCRIPT</runMode>
<script>#!bjorne
-A=5
-while expr $A != 0 ; do echo A is $A ; if expr $A = 2 ; then break ; fi ; A=`expr $A - 1`; done
+ A=5
+ while expr $A != 0 ; do echo A is $A ; if expr $A = 2 ; then break ; fi ; A=`expr $A - 1`; done
</script>
<output>1
A is 5
@@ -135,4 +135,20 @@
</output>
<rc>0</rc>
</testSpec>
+ <testSpec>
+ <title>${...} expansions</title>
+ <command>test</command>
+ <runMode>AS_SCRIPT</runMode>
+ <script>#!bjorne
+ A=cat
+ echo A is $A
+ echo A is ${A}
+ echo A length is ${#A}
+ </script>
+ <output>A is cat
+A is cat
+A length is 3
+</output>
+ <rc>0</rc>
+ </testSpec>
</testSpecs>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|