Re: [CEDET-devel] php for cedet
Brought to you by:
zappo
From: <jo...@ve...> - 2007-05-03 22:57:17
|
"Eric M. Ludlam" <er...@si...> writes: Hi, Wouldnt it be easier and more general to hook into the "multiple modes mode", mmm or mumamo? These multi-modes know when the buffer is supposed to change mode. When this happens, the correct semantic parser could be called. Semantic doesnt necessarily have to understand the entire buffer, right? This way, each "combination" mode wont need to be made semantic aware. There are several such ones, besides the xml compliant ones. > Hi, > > For a CEDET/Semantic parser to work, it will need to handle the > entire buffer during a parse. That way, the tags can be nested in the > output correctly. > > The parser itself would also be nested. The first stage would > likely use the existing nxhtml code to identify what HTML tags are > important, and the chunk mechanism to identify when to call a > secondary parser on the php or javascript code. It seems likely an > nxhtml semantic parser could call out to multiple wisent parsers, but > I'll have to investigate what dependencies there are on local > variables for these cases as I hadn't tried this before. > > If someone knows how to convert existing nxhtml parsing tools to > produce semantic tags, plus an example file with embedded javascript, > I'll be able to combine the two, and thus provide a framework for php > to be inserted later. > > I haven't looked into nxhtml parsing mechanisms, but for the > semantic side, create a list of tags by calling `semantic-tag' > whenever there is something interesting, like an H1 line, or a > Javascript block. Code might look like this: > > (cons (append (semantic-tag nameofh1 'H1 :somefeature "somevalue") > ;; Append the bounds of this tag for later processing. > (list startpos endpos)) > mylistotags) > > See semantic-html.el for my simple html parser. It collects the > tags, then sorts them into a nested tree and is, on the whole, pretty > simple. > > Once such a function exists, with some obvious places where > javascript or php parser might go, I'll be happy to figure out how to get the > parser to nest, and set up the rest of the semantic harness around it. > > Thanks! > Eric > >>>> "Lennart Borgman (gmail)" <len...@gm...> seems to think that: >>Hi Eric and Suraj, >> >>I was just notified by Joakim Verona that you are discussing this and >>maybe I can contribute a bit. It is quite nice to read that you think it >>is possible to combine nxml-mode and CEDET. >> >>Let me explain what I have done in nXhtml so that you can see whether >>the approch there can be used together with CEDET/Semantic. >> >>nxhtml-mode is the preferred mode for editing XHTML in nXhtml. >>nxhtml-mode is derived from nxml-mode. It is specialized against XHTML >>and I have added some user interface variations (like popup style >>completion). There are no deeper technical changes like separating the >>xml parser from the rest of nxml-mode. (I have thought about it, but I >>just do not understand how to do it and I do not think that I will be >>able to understand it in a reasonable time). >> >>I use the validation state for completion and I try to set it at the >>start of the file. That is all. >> >>nxhtml-mode has no support for multiple modes in a buffer. Instead >>multiple modes are supported by another compononet in nXhtml, >>mumamo-mode. mumamo-mode divides the buffer into chunks with different >>major modes. When moving into a chunk the major mode in the buffer is >>switched from the main major mode in the buffer. Indentation and >>fontification according to that major mode is also supported. >> >>The dividing into chunks is made when starting mumamo-mode and after >>changes. It lives in the buffer in the form of overlays with some >>properties for mumamo-mode to read later. >> >>There is support for surviving buffer local variables when switching >>major modes while moving between the chunks, but this has to be handcrafted. >> >>mumamo-mode can be used separately from nxhtml-mode. >> >>(BTW the action of dividing into chunks is a simple approach I have >>tried to make as stable as possible. I believe it is stable, but I have >>not taken the time to really investigate if it is or if it can get into >>an oscillating state.) >> >>How does this sound to you? Is there anything special needed in >>mumamo-mode for it to work with CEDET/Semantic? Is there anything >>special needed in nxhtml-mode? >> >>- L >> >> >> >>Eric M. Ludlam wrote: >>> I use nxml mode at work for xml, and can attest to its spiffyness. >>> >>> One of these days I'd like to use the xml parser in it to provide >>> semantic tags, but have not yet had the motivation, as determining >>> where to put tag class boundaries is custom per schema. >>> >>> Using nxhtml would be more deterministic, and make creating a tag >>> parser a simple matter of list management, and not text parsing. It >>> would form a nice baseline for starting nxml tag generation as well. >>> >>> Thanks for pointing this out Suraj. >>> Eric >>> >>>>>> "Suraj Acharya" <sac...@gm...> seems to think that: >>>> Also look at Nxhtml mode, which builds on nxml-mode. >>>> http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html>>> It supposedly has support for "PHP, CSS, JavaScript, eRuby, [and] JSP". >>>> >>>> >>>> It requires Emacs 22 however, and you have to convert your any >>>> existing html to xhtml >>>> http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html#tidy>>> >>>> I've not used it much myself, but I use nxml-mode a lot and find it very useful. >>>> >>>> Suraj >>>> >>>> On 5/3/07, Eric M. Ludlam <er...@si...> wrote: >>>>> If I remember rightly, PHP has mixed-mode issues, meaning you mix >>>>> html and php code together. You should investigate emacswiki.org and >>>>> look at mmm-mode, multi-mode, or one of the other options. One of >>>>> them should have setups for php/html. >>>>> >>>>> For CEDET/semantic, I don't know how to combine the two modes together >>>>> via one of the multi-modes. It should be straight forward to combine >>>>> a regexp based parser (for html) with a PHP wisent parser. Start w/ >>>>> PHP code w/out html, and get a wisent parser working there. See the >>>>> nice wisent manual to get started, and perhaps a simple grammar like >>>>> the one for awk, calc, or cogre/wisent-dot.wy. >>>>> >>>>> Once you have something like that, we can devise a way to combine it >>>>> w/ the existing html parser. This would be useful, as I suspect there >>>>> are some folks out there who would like the same features w/ >>>>> javascript. >>>>> >>>>> Good Luck >>>>> Eric >>>>> >>>>>>>> Rohan Nicholls <roh...@go...> seems to think that: >>>>>> Hi all, >>>>>> >>>>>> I have been lurking on this list for a while, and have been reading the >>>>>> mails, while I get the gumption up to face getting cedet and php working >>>>>> together. >>>>>> >>>>>> As far as I can tell, this means first getting semantic to parse/process >>>>>> php properly, and other than that I am not sure. >>>>>> >>>>>> Could anyone guide me as to what I would need to do to get this to >>>>>> happen? I have checked out the stuff for java as I thought that would >>>>>> be pretty close syntactically at least. I have thought about what would >>>>>> be needed for something like cedet to do its thing, so I think I have a >>>>>> fairly good idea of what needs to be covered. >>>>>> >>>>>> Thanks in advance, all. A friend/colleague of mine would like to chip >>>>>> in, so that could make things happen. My elisp skills don't suck, but I >>>>>> am no guru (yet). >>>>>> >>>>>> One of the reasons for this is to have a viable (read: emacs based) >>>>>> option to the zend studio ide closed source bloatware, so we are fairly >>>>>> motivated, as my first trial of it, was less than revelatory. :) >>>>>> >>>>>> Rohan >>>>> [ ... ] >> >> >>------------------------------------------------------------------------- >>This SF.net email is sponsored by DB2 Express >>Download DB2 Express C - the FREE version of DB2 express and take >>control of your XML. No limits. Just data. Click to get it now. >>http://sourceforge.net/powerbar/db2/>_______________________________________________ >>Cedet-devel mailing list >>Ced...@li... >>https://lists.sourceforge.net/lists/listinfo/cedet-devel> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ -- Joakim Verona http://www.verona.se |