From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Pretty-printer? (Alternatives to "gnatpp") Date: Mon, 14 Mar 2016 13:01:30 +0100 Organization: A noiseless patient Spider Message-ID: References: <87a8m2jlp7.fsf@adaheads.consafe1.org> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 14 Mar 2016 11:58:23 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="3422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/062+0jbjh+qxHJQjr+lBmp8aW1EM+Y+Q=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Cancel-Lock: sha1:TiLsbLpSWXRRBCjXnR3mnCVxPns= Xref: news.eternal-september.org comp.lang.ada:29746 Date: 2016-03-14T13:01:30+01:00 List-Id: On 14.03.16 07:43, Bob Butler wrote: > On 2016-03-13, Georg Bauhaus wrote: >> On 13.03.16 19:07, Jacob Sparre Andersen wrote: >>> 2) You can't get it to select the casing of identifiers on a >>> word-by-word basis (which means that I have to repeat every acronym >>> we use in the project once for every identifier it occurs in). >> >> The (new) Ada mode for Emacs can be used as a pretty printer, >> for all versions of Ada, and it supports automatic letter case. >> The user may define a list of exceptions to the casing rules >> that he prefers. > > I thought of that too but I don't know if you can print from Emacs. I guess > you probably can, there isn't much Emacs can't do. You can print from Emacs, as the following example shows. (To "print" as in to "write pretty printed text to output"; there also is colored postscript printing, etc.) Ada mode does report syntax errors. Still, it is lenient when all that it should do is letter case. Example input: procedure Synerr is begin null: end synErr; about which file Emacs says, when visiting, synerr.adb:3:8: syntax error in grammar state 641; unexpected :, expecting one of (default SEMICOLON) And then, indeed, trying to indent will screw up the indentation. Nevertheless, evaluating the sequence of commands (ada-case-adjust-buffer) (write-file "synerr.pretty.adb") will yield a new file "synerr.pretty.adb" that looks like this: procedure Synerr is begin null: end Synerr; So, the last line now also follows the usual letter case rules, spelling "Synerr" the same in both places. (The syntax error is still present.)