Hi,
I think David Ponce is best able to answer specifics about
EXPANDTAG.
Going from a parser action into a tag is a long process. First you
need one of the create macros. This just puts the basics together
that you specify.
To make a tag show up in the parser's end result (a list of tags),
the tag needs to be expanded (for compound tags), and it needs to be
cooked (a reparse symbol given for the incremental parser.) I think
that's what EXPANDTAG does.
It also needs positional information (for the overlays and tracking
system.) and it needs to be pushed into the tg stack. I don't recall
where that happens.
If you want to create a mock tag and put it into some other tags
attribute data, then you would not need to expand it.
I think your nested list issue may be a result of needing a
`semantic-tag-expand-function', or altering the one you have. See the
variable of the same name.
If I am incorrect, hopefully David can provide better advice.
Eric
>>> Austin Haas <austin@...> seems to think that:
>
>Is there ever a time that I would use one of the tag creation macros, like TAG
>or VARIABLE-TAG without wrapping it in EXPANDTAG?
>
>Looking at the wisent-java.wy, it seems that EXPANDTAG is always used.
>
>The problem that I am having is that EXPANDTAG causes the results to be wrapped
>in a list, even if there is only one tag. So, for example, the block that makes
>up the body of a function is a list with one tag (if I use EXPANDTAG). That is
>making it difficult for me to write application code that uses the parse tree,
>because I have to check if a value is a list, and then I have to check if the
>car of the list is a tag.
>
>The only reason that I'm asking is just to make sure that I'm not doing anything
>incorrectly.
>
>This is what my *Parser Output* looks like:
>
>(("sm_test" type
> (:members
> (("sm_test" function
> (:body
> (("block" block
> (:value
> (("a" variable
> (:default-value "3")
> (reparse-symbol variable_declarator)
> [44 49])))
> (reparse-symbol block_statement)
> [40 50])))
> (reparse-symbol method_declaration)
> #<overlay from 18 to 69 in sm_test.as>))
> :type "class")
> (reparse-symbol class_declaration)
> #<overlay from 1 to 71 in sm_test.as>))
>
>My grammar is for Actionscript, and I based it off of wisent-java.wy. For
>reference, here is the source file that was parsed:
>
>class sm_test{
> function sm_test(){
> var a = 3;
> }
>}
>
>I am trying to parse the source file completely.
>
>-austin
>
|