Two thoughts, at either end of the abstraction spectrum:

Low:

> +        # Skip things that respond to :instantiate (classes, nodes,
> +        # and definitions), because they have already been
> +        # instantiated.
> +        if !child.respond_to?(:instantiate)
>           child.safeevaluate(scope)
>         end

I think you have an indentation error here.


> +# statements is like statements_and_declarations, but it doesn't allow
> +# nested definitions, classes, or nodes.
> +statements: statements_and_declarations {
> +  val[0].each do |stmt|
> +    if stmt.is_a?(AST::TopLevelConstruct)
> +      error "Classes, definitions, and nodes may only appear at toplevel
or inside other classes"
> +    end
> +  end
> +  result = val[0]
> +}
> +

Wouldn't it be simpler / easier / clearer to leave statements as is and
define statements_and_declarations in terms of statements and declarations?
E.g., let the grammar handle it rather than dynamically enforcing a
grammatical rule by checking the AST as it's built?

-- M
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to