Re: Indento-matic?

Jeremy Fitzhardinge (jeremy@nospam.suite.sw.oz.au)
Wed, 27 Apr 1994 15:45:54 +1000 (EST)

James Wondrasek bubbles:
> Anyone know anything that will indent parenthesised material a la:
>
> ( blah (
> blah
> )
> )
>
> ???
>
> There are probably lisp pretty printers that will do this, but do they
> work for non-lisp code? I really can't be bothered counting braces in:

It looks enough like lisp code to not matter much, I'd say.

> [...]

Well, it would be really easy to write one, but likely there's
something in Emacs to do the job. A few minutes with lisp-mode
gave me this (without paying much attention to the meaning of the
code):

Prog "Program" "id"
(Arglist "(" (Identlist "a1" "," (Ident "a2")) ")")
(Rest (Var "Var"
(Varlist "var" ":" "int" (Emptyvlist Epsilon)))
(Emptyconstl Epsilon)
(Main "Begin"
(Stlist
(If "If"
(Or (Gtr (Term (Tident "a"))
">"
(Term (Tident "b")))
"Or"
(Boolterm (Equal
(Term (Tident "a"))
"="
(Term (Tident "b")))))
"Then"
(Block "Begin"
(Stlist
(Assign "min" ":" "="
(Term (Tident "b")))
(Stlist
(Assign "max" ":" "="
(Term (Tident "a")))
(Emstl Epsilon)))
"End"))
(Emstl Epsilon))))
"End"

I suppose this is output of something you want to pretty-print
automatically. This is (syntactically) lisp code.

J