Author: pmichaud
Date: Tue Nov  1 00:01:49 2005
New Revision: 9682

Modified:
   trunk/compilers/pge/PGE/Exp.pir
   trunk/t/p6rules/modifiers.t
   trunk/t/p6rules/ws.t
Log:
* Added ignorecase (:i / :ignorecase) pattern modifiers
* Removed "todo" labels from selected tests


Modified: trunk/compilers/pge/PGE/Exp.pir
==============================================================================
--- trunk/compilers/pge/PGE/Exp.pir     (original)
+++ trunk/compilers/pge/PGE/Exp.pir     Tue Nov  1 00:01:49 2005
@@ -174,13 +174,17 @@ register.
     .param string label
     .param string next
     .local pmc emit
-    .local int min, max, islazy, iscut
+    .local int min, max, islazy, iscut, ignorecase
     (min, max, islazy, iscut, $S0) = self."quant"()
+    ignorecase = self["ignorecase"]
     emit = find_global "PGE::Exp", "emit"
     emit(code, "    litlen = length lit")
     unless min == 1 goto quant
     unless max == 1 goto quant
     emit(code, "    $S0 = substr target, pos, litlen")
+    if ignorecase == 0 goto init_1
+    emit(code, "    downcase $S0")
+  init_1:
     emit(code, "    if $S0 != lit goto fail")
     emit(code, "    pos += litlen")
     emit(code, "    goto %s", next)
@@ -376,8 +380,12 @@ register.
     .param string next
     .local pmc emit
     ($I0, $I1, $I2, $I3, $S0) = self."quant"()
+    $I0 = self["ignorecase"]
     emit = find_global "PGE::Exp", "emit"
     $S1 = self["value"]
+    if $I0 == 0 goto init_1
+    downcase $S1
+  init_1:
     $P0 = find_global "Data::Escape", "String"
     $S1 = $P0($S1, '"')
     emit(code, "\n  %s: # literal %s    ##", label, $S0)

Modified: trunk/t/p6rules/modifiers.t
==============================================================================
--- trunk/t/p6rules/modifiers.t (original)
+++ trunk/t/p6rules/modifiers.t Tue Nov  1 00:01:49 2005
@@ -13,12 +13,12 @@ use Parrot::Test::PGE;
 ## :i
 ## TODO lexical scoping of :i
 p6rule_is  ('abcdef', ':i bcd', 'ignorecase (:i)');
-p6rule_is  ('aBcdef', ':i bcd', 'ignorecase (:i)', todo => 'not yet 
implemented');
-p6rule_is  ('abCdef', ':i bcd', 'ignorecase (:i)', todo => 'not yet 
implemented');
-p6rule_is  ('abcDef', ':i bcd', 'ignorecase (:i)', todo => 'not yet 
implemented');
+p6rule_is  ('aBcdef', ':i bcd', 'ignorecase (:i)');
+p6rule_is  ('abCdef', ':i bcd', 'ignorecase (:i)');
+p6rule_is  ('abcDef', ':i bcd', 'ignorecase (:i)');
 p6rule_isnt('abc-ef', ':i bcd', 'ignorecase (:i)');
-p6rule_is  ('abcdef', ':ignorecase bcd', 'ignorecase (:ignorecase)', todo => 
'not yet implemented');
-p6rule_is  ('aBCDef', ':ignorecase bcd', 'ignorecase (:ignorecase)', todo => 
'not yet implemented');
+p6rule_is  ('abcdef', ':ignorecase bcd', 'ignorecase (:ignorecase)');
+p6rule_is  ('aBCDef', ':ignorecase bcd', 'ignorecase (:ignorecase)');
 p6rule_isnt('abc-ef', ':ignorecase bcd', 'ignorecase (:ignorecase)');
 
 
@@ -34,11 +34,11 @@ p6rule_is  ('a b c def', ':w b c d', 'wo
 p6rule_isnt('ab c d ef', ':w b c d', 'words (:w)');
 p6rule_isnt('a bcdef', ':w b c d', 'words (:w)');
 p6rule_isnt('abcdef', ':w b c d', 'words (:w)');
-p6rule_is  ('a bcdef', ':words bcd', 'words (:words)', todo => 'not yet 
implemented');
-p6rule_is  ('a bcd ef', ':words bcd', 'words (:words)', todo => 'not yet 
implemented');
+p6rule_is  ('a bcdef', ':words bcd', 'words (:words)');
+p6rule_is  ('a bcd ef', ':words bcd', 'words (:words)');
 p6rule_isnt('abcdef', ':words bcd', 'words (:words)');
-p6rule_is  ('a b c d ef', ':words b c d', 'words (:words)', todo => 'not yet 
implemented');
-p6rule_is  ('a b c def', ':words b c d', 'words (:words)', todo => 'not yet 
implemented');
+p6rule_is  ('a b c d ef', ':words b c d', 'words (:words)');
+p6rule_is  ('a b c def', ':words b c d', 'words (:words)');
 p6rule_isnt('ab c d ef', ':words b c d', 'words (:words)');
 
 

Modified: trunk/t/p6rules/ws.t
==============================================================================
--- trunk/t/p6rules/ws.t        (original)
+++ trunk/t/p6rules/ws.t        Tue Nov  1 00:01:49 2005
@@ -25,8 +25,7 @@ p6rule_is  ('foo-bar', ':w foo -? bar', 
 p6rule_isnt('foobar', ':w foo -? bar', 'basic ws non-match');
 
 # with :w not separated by a space
-p6rule_is  ('foo - bar', ':w()foo -? bar', 'basic ws match',
-    todo => 'words modifier () separation not implemented');
+p6rule_isnt('foo - bar', ':w()foo -? bar', 'basic ws match');
 p6rule_is  ('foo - bar', ':w[]foo -? bar', 'basic ws match',
     todo => 'words modifier [] separation not implemented');
 p6rule_is  ('foo - bar', ':w\bfoo -? bar',

Reply via email to