On Sat, Apr 05, 2008 at 07:59:36PM -0000, John M. Dlugosz wrote:
> I'm trying to fathom STD.pm.
> 
> Maybe someone can help me trace through this one?  
> 
> How is
>     $obj!privA = 1;
> parsed?
> 
> Reading expect_term, it trys <noun>, then <variable> sees the 
> "$" and commits to the decision, reads "obj" as a <desigilname>, 
> then checks for a ".", but doesn't have similar logic for "!".  

I'm not sure what you mean by "then checks for a '.'" -- I don't
the dot in the <variable> rule isn't the same as the method dot.

I think the way it parses is that we get $obj from the 
<noun> => <variable> sequence at the beginning of <expect_term>,
and then !privA is parsed via the <post> => dotty:sym<!> sequence.

So the parse tree looks something like:

    <expect_term> = {
      <noun> = {
        <variable> = {
          <sigil>                         # "$"
          <desigilname>                   # "obj"
        }
      }
      <post> = [
        [0] = {
          <dotty> = {
            <sym>                         # "!"
            <methodop> = {              
              <name>                      # "privA"
            }
          }
        }
      ]
    }

Pm

Reply via email to