Subject: Re: Java pretty printing in/with DocBook From: "Lassi A. Tuura" <lat@xxxxxx> Date: Mon, 23 Feb 1998 09:40:30 +0100 (MET) |
|> It would certainly be possible to write DSSSL functions that parse the Java |> source and do the formatting. My first approach would be to see if there's |> an emacs mode for Java (there must be) and see if I could use that as the |> base (as emacs is a lisp application). Or maybe there's already lisp or |> scheme code for doing Java parsing out there? Actually, nowadays emacs does most of this formatting via `font-lock-mode', which essentially does its job based on regular expressions (there is a little syntactic matching involved, e.g. for multi-line comments and strings). For instance, I have largely rewritten the C++ font-locking expressions so that I get correct formatting almost all the time, regardless of how complicated templates and operator definitions the source contains. However, in the worst case the regular expressions end up having about 30 of nested matchers, and the matcher the designates the "hit" (thing to format) is in the worst case at level 10 or so (the rest of the matchers are either before it or inside it to make sure it really is the right thing to format). Trying to duplicate that behaviour without strong regexp support would be, umm, challenging. I would think Java would be *much* easier to handle and fontify -- even easier than C. I wouldn't think it would be all that hard to duplicate those regexps as scheme code. Real regexps would of course help ;-) I would agree with the others that you should do this via perl or emacs batch-mode jobs. Both can do the regexps wonderfully, and can decorate the code with whathever formatting you like. It could be SGML or something else you find easy to parse in DSSSL/scheme. //lat -- Every old idea will be proposed again with a different name and a different presentation, regardless of whether it works. --RFC1925 DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Java pretty printing in/with Do, Norman Walsh | Thread | Re: Java pretty printing in/with Do, W. Eliot Kimber |
dsssler wanted [repost], Liam Quin | Date | Re: conditionaly setting characteri, Richard Light |
Month |