Modified:
trunk/src/com/xruby/compiler/RubyCompilerTest.java
trunk/src/com/xruby/compiler/parser/RubyLexer.java
Log:
fix parsing of "when ?':", found this bug when trying rbyaml
Modified: trunk/src/com/xruby/compiler/RubyCompilerTest.java
==============================================================================
--- trunk/src/com/xruby/compiler/RubyCompilerTest.java (original)
+++ trunk/src/com/xruby/compiler/RubyCompilerTest.java Tue Jul 1
19:24:19 2008
@@ -1265,6 +1265,10 @@
public void test_case() {
String[] program_texts = {
+ "case ?'\n" +
+ "when ?': print false\n" +
+ "end",
+
"case \"xxx\"\n" +
"when \"yyy\", \"xxx\"\n" +
" print true\n" +
@@ -1314,6 +1318,7 @@
};
String[] outputs = {
+ "false",
"true",
"1",
"0",
@@ -3598,7 +3603,7 @@
compile_run_and_compare_output(program_texts, outputs);
}
-
+
public void test_nested_assignment() {
String[] program_texts = {
"(a,), b, c = [[1],2,3]; p a",
@@ -4865,7 +4870,7 @@
"class TestSuper31; def f; 9; end; end\n" +
"class TestSuper32 < TestSuper31; def f; super.to_i; end;
end\n" +
"print TestSuper32.new.f",
-
+
"class TestSuper21;def f x, y;print x + y; end;end\n" +
"class TestSuper22 < TestSuper21; def f(x, y); super
x, y;end; end\n" +
"TestSuper22.new.f 3, 2",
Modified: trunk/src/com/xruby/compiler/parser/RubyLexer.java
==============================================================================
--- trunk/src/com/xruby/compiler/parser/RubyLexer.java (original)
+++ trunk/src/com/xruby/compiler/parser/RubyLexer.java Tue Jul 1
19:24:19 2008
@@ -890,6 +890,7 @@
case ']': // [?a]
case ';': // $state[n*2] = ?|;
case '.': // unless (?A..?Z) === klass[0]
+ case ':': // when ?':
return true;
default:
return false;