Author: fperrad
Date: Sun Mar  4 09:38:10 2007
New Revision: 17332

Modified:
   trunk/languages/lua/lib/luaregex.pir
   trunk/languages/lua/t/regex.t

Log:
[Lua]
- improve regex (step 3)
- declare TODO

Modified: trunk/languages/lua/lib/luaregex.pir
==============================================================================
--- trunk/languages/lua/lib/luaregex.pir        (original)
+++ trunk/languages/lua/lib/luaregex.pir        Sun Mar  4 09:38:10 2007
@@ -439,7 +439,7 @@
     if pos >= lastpos goto err_close
     $S0 = substr target, pos, 1
     inc pos
-    if $S0 == "\\" goto backslash
+    if $S0 == '%' goto percent
     goto addchar
   scan:
     if pos >= lastpos goto err_close
@@ -447,13 +447,10 @@
     inc pos
     if $S0 == ']' goto endclass
     if $S0 == '-' goto hyphenrange
-    if $S0 != "\\" goto addchar
-  backslash:
+    if $S0 != '%' goto addchar
+  percent:
     $S0 = substr target, pos, 1
     inc pos
-    $I0 = index 'nrtfae0b', $S0
-    if $I0 == -1 goto addchar
-    $S0 = substr "\n\r\t\f\a\e\0\b", $I0, 1
   addchar:
     if isrange goto addrange
     charlist .= $S0

Modified: trunk/languages/lua/t/regex.t
==============================================================================
--- trunk/languages/lua/t/regex.t       (original)
+++ trunk/languages/lua/t/regex.t       Sun Mar  4 09:38:10 2007
@@ -57,6 +57,15 @@
     'rx_metachars',
 );
 
+my %todo_info = (
+    7   => 'empty capture',
+    8   => 'back reference',
+    9   => 'back reference',
+    145 => 'balanced',
+    147 => 'balanced',
+    148 => 'balanced',
+);
+
 my $test_number = 0;
 
 foreach (@test_files) {
@@ -64,8 +73,7 @@
     open my $FH, '<', $filename
             or die "can't open $filename ($!)\n";
     while (<$FH>) {
-        next if (/^#/);
-        next if (/^\s*$/);
+        last if (/^\s*$/);
         my ($pattern, $target, $result, $desc) = split /\t+/, $_;
         $pattern = '' if ($pattern eq "''");
         $pattern =~ s/"/\\"/g;
@@ -85,6 +93,8 @@
         $test_number ++;
 
         my $code = "print(string.match(\"$target\", \"$pattern\"))";
+
+        local $TODO = $todo_info{$test_number} if (exists 
$todo_info{$test_number});
         if ($output =~ /^\//) {
             language_output_like( 'lua', $code, $output . "\n", $desc );
         }

Reply via email to