Commits

allison committed d4bb7de

Naming a few long-lived variables for clarity.

Comments (0)

Files changed (1)

Spix/PEG/Parser.pir

     .param string input
     .param int pos
     .local pmc tree
+    .local string ident_string
     tree = self.'get_memo'(pos, 'IdentStart')
     unless null tree goto got_tree
+    ident_string = ''
 
     $I0 = self.'length'()
     if pos == $I0 goto got_tree
 
     .local int char
     char = ord input, pos
-    $S0 = chr char
+    ident_string = chr char
 
     # Check lower class
     .local int a, z
     if $I2 goto matched
 
     # Check underscore
-    if $S0 == '_' goto matched
+    if ident_string == '_' goto matched
 
     goto got_tree
 
   matched:
     $I0 = pos + 1
     self.'pos'($I0)
-    tree = self.'new_node'('name'=>'IdentStart', 'src'=>$S0, 'pos'=>pos)
+    tree = self.'new_node'('name'=>'IdentStart', 'src'=>ident_string, 'pos'=>pos)
     self.'set_memo'(pos, 'IdentStart', tree)
 
   got_tree:
     .param string input
     .param int pos
     .local pmc tree
+    .local string ident_string
     tree = self.'get_memo'(pos, 'IdentCont')
     unless null tree goto got_tree
 
     # One of IdentStart or digit is required, mutually exclusive
     $P0 = self.'IdentStart'(input, pos)
     if null $P0 goto try_digit
-    $S0 = $P0.'src'()
-    tree = self.'new_node'('name'=>'IdentCont', 'src'=>$S0, 'pos'=>pos, 'IdentStart'=>$P0)
+    ident_string = $P0.'src'()
+    tree = self.'new_node'('name'=>'IdentCont', 'src'=>ident_string, 'pos'=>pos, 'IdentStart'=>$P0)
     $I0 = pos + 1
     self.'pos'($I0)
     goto memo_tree
   try_digit:
     .local int char
     char = ord input, pos
-    $S0 = chr char
+    ident_string = chr char
 
     # Check digits
     .local int zero, nine
   matched:
     $I0 = pos + 1
     self.'pos'($I0)
-    tree = self.'new_node'('name'=>'IdentCont', 'src'=>$S0, 'pos'=>pos)
+    tree = self.'new_node'('name'=>'IdentCont', 'src'=>ident_string, 'pos'=>pos)
 
   memo_tree:
     self.'set_memo'(pos, 'IdentCont', tree)