Re: parsing format/{1,2,3} format strings
Michael Hendricks <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFHuXuaSyekJZhu2c801rHCv0WDiKu=MA3=ukAP-Qt8k4jWJNg@mail.gmail.com> |
On Tue, Dec 24, 2013 at 7:37 PM, Michael Hendricks <[email protected]> wrote: > Does anyone have code for parsing format strings used by format/{1,2,3} > predicates? > I just released the format_spec<http://www.swi-prolog.org/pack/list?p=format_spec>pack for parsing and analyzing format specifications. For those of you using SWI Prolog V7.1.5 or later, you also get integration with check/0. Here's an excerpt from the pack's documentation. ?- check. Warning: foo.pl:6:4: In goal: format("~ oops",[_G3495]) Invalid format string: "~ oops" Warning: foo.pl:7:4: In goal: format("hi",[superfluous]) Wrong argument count. Expected 0, got 1 Warning: foo.pl:9:4: In goal: debug(something,"Worth $~f",[nothing]) Type error: `float' expected, found `nothing' (an atom) Enjoy! -- Michael -------------- next part -------------- HTML attachment scrubbed and removed