Re: Java pretty printing in/with DocBook

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
  • dsssler wanted [repost], (continued)
    • Liam Quin - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id BAA07986Mon, 23 Feb 1998 01:28:32 -0500 (EST)
    • W. Eliot Kimber - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id KAA22240Sun, 22 Feb 1998 10:28:59 -0500 (EST)
      • Paul Prescod - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id QAA25020Sun, 22 Feb 1998 16:01:45 -0500 (EST)
        • Norman Walsh - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id QAA25601Sun, 22 Feb 1998 16:34:24 -0500 (EST)
      • Lassi A. Tuura - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id DAA13860Mon, 23 Feb 1998 03:41:50 -0500 (EST) <=
    • W. Eliot Kimber - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id QAA25353Sun, 22 Feb 1998 16:26:17 -0500 (EST)
    • Sean Mc Grath - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id GAA15693Mon, 23 Feb 1998 06:34:57 -0500 (EST)
      • Gavin Nicol - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id JAA17936Mon, 23 Feb 1998 09:34:06 -0500 (EST)
        • Christian Leutloff - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id MAA20975Mon, 23 Feb 1998 12:15:24 -0500 (EST)