Thread: [cedet-semantic] children tag haven't overlay
Brought to you by:
zappo
From: antoine no <ant...@gm...> - 2012-02-20 13:32:35
|
Bonjour, I have write a little parser for html. for an input like: <div att="abc"> <span> text </span> text <br /> </div> i get: (("div" tag (:children (("span" tag (:end ("span" end_tag nil nil nil 31 38) :start ("span" start_tag nil nil nil 19 25)) nil nil 19 38) ("br" tag nil nil nil 48 54)) :end ("div" end_tag nil nil nil 55 61) :start ("div" start_tag (:attributes (("att" attribute (:value "\"abc\"") nil nil 6 15))) nil nil 1 16)) nil #<overlay from 1 to 61 in test.html>)) You can notice that only the "div" tag as an overlay, "span" and "br" (contained in :children of "div") have no overlay at 5th position (semantic-tag-overlay tag) return nil. I have override semantic-tag-components and semantic-tag-components-with-overlays with: (define-mode-local-override semantic-tag-components-with-overlays html-mode (tag) "Return a list of components for TAG." (if (eq nil (semantic-tag-get-attribute tag :children)) '() (semantic-tag-get-attribute tag :children) )) semantic-tag-components is used in semantic--tag-link-to-buffer In this function i saw it need the semantic-tag-overlay return a vector. So my question is how to make the children tag have an overlay? Good Bye. |
From: antoine no <ant...@gm...> - 2012-02-20 16:35:59
|
I resolved this by adding (car (EXPANDTAG ...)) arroud the TAG generation in wisent grammar. I don't know if it is the right thing to do? |
From: Eric M. L. <eri...@gm...> - 2012-02-24 02:38:57
|
Hi Antoine, There are a few ways to deal with a child tag. Parser tags start out in a "raw" form, using numbers to represent the location. All raw tags need to be "cooked", which is the process of converting the location information into an overlay, or into a vector that can be saved to disk. This happens automatically for top-level tags. When you create a child tag, you have two choices. In the wisent manual, you will see a section on grammar styles. The bison style uses the EXPANDTAG macro to say that the created tag needss to be cooked. If you instead use the iterative style, you would use EXPANDFULL on some region of the buffer to recurse into the parser and expand all generated tags there. Iterative style can be tricky if you are used to regular Bison parsing, but can make life a lot easier. Eric On 02/20/2012 11:35 AM, antoine no wrote: > I resolved this by adding (car (EXPANDTAG ...)) arroud the TAG > generation in wisent grammar. > I don't know if it is the right thing to do? |