mktables: Add Perl_IDStart property
authorKarl Williamson <public@khwilliamson.com>
Mon, 26 Sep 2011 20:46:00 +0000 (14:46 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sat, 1 Oct 2011 15:58:09 +0000 (09:58 -0600)
This is a space/time trade-off.  We add a table that is compiled to
calculate what Perl wants for a character to be the beginning of an
identifier.  This will enable us to not have to take the && of two
tables.

lib/unicore/mktables

index 910ef2f..645b76a 100644 (file)
@@ -11845,6 +11845,17 @@ sub compile_perl() {
     my $begin = $perl->add_match_table('_X_Begin', Perl_Extension => 1);
     my $extend = $perl->add_match_table('_X_Extend', Perl_Extension => 1);
 
+    # For backward compatibility, Perl has its own definition for IDStart
+    # First, we include the underscore, and then the regular XID_Start also
+    # have to be Words
+    $perl->add_match_table('_Perl_IDStart',
+                           Perl_Extension => 1,
+                           Internal_Only => 1,
+                           Initialize =>
+                             ord('_')
+                             + (property_ref('XID_Start')->table('Y') & $Word)
+                           );
+
     my $gcb = property_ref('Grapheme_Cluster_Break');
 
     # The 'extended' grapheme cluster came in 5.1.  The non-extended