Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Parser trying to extend with a SyntaxNode subclass weirdness.
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bernhard  
View profile  
 More options Jul 27 2012, 7:18 pm
From: Bernhard <bernhard.weic...@googlemail.com>
Date: Fri, 27 Jul 2012 16:18:49 -0700 (PDT)
Local: Fri, Jul 27 2012 7:18 pm
Subject: Re: Parser trying to extend with a SyntaxNode subclass weirdness.

Does not work for me.

changed

    rule top
        document '' { def as_xml; wrap('top',super); end }
    end

    rule document
       ( (noMarkupText / trace / markupAbort)* )
        { def as_xml;
            wrap('document',super);
          end
        }
    end

u see still no "document"

the result is

"<top><noMarkupText>text 1 </noMarkupText>[foo_bar_1234] ** lorem ipsum
header ** {lorem {ipsum} [nothing] }(foo_bar_1234,
bar_foo_1234)<noMarkupText> text2 </noMarkupText>[<noMarkupText> text3]
</noMarkupText></top>"

On Saturday, July 28, 2012 1:11:12 AM UTC+2, Clifford Heath wrote:

> On 28/07/2012, at 9:02 AM, Bernhard wrote:
> > Here we are at the problem: I annotated this single rule as you
> > describe. And I receive

> > (rdb:1) p r2.as_xml
> > "text 1 [foo_bar_1234] ** lorem ipsum header ** {lorem {ipsum} [nothing]
> }(foo_bar_1234, bar_foo_1234) text2 [ text3] "

> > no tag for documentation. The reason is, that the parse tree does not
> have a node here. And this is
> > what drives me to desperation: Why not?

> You do get a node for 'document', but not for 'top', since that only
> contains one sub-rule.

> When a rule contains only a single node, no new node is created.
> Any code block associated is put into a module which is mixed in
> to the existing node from the sub-rule.

> If you defined "top" like this you'd get a new node which is a sequence of
> two nodes

> rule top
>   document ''
> end

> This has the null rule '' which matches without consuming any characters.
> It means that 'top' is defined as a sequence, so must create a new node.

> Clifford Heath.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.