Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Parse and check format/2 specifications |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.0.2 |
SHA1 sum: | 5bc0c72d72fd73b9c34e329e549a536a51bf9621 |
Author: | Michael Hendricks <michael@ndrix.org> |
Maintainer: | Michael Hendricks <michael@ndrix.org> |
Packager: | Michael Hendricks <michael@ndrix.org> |
Home page: | http://packs.ndrix.com/format_spec/index.html |
Download URL: | http://packs.ndrix.com/format_spec/format_spec-0.0.2.tgz |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.0.1 | 0dbd10b366a0f5e42495eca7fe28c56933721522 | 1 | http://packs.ndrix.com/format_spec/format_spec-0.0.1.tgz |
0.0.2 | 5bc0c72d72fd73b9c34e329e549a536a51bf9621 | 45 | http://packs.ndrix.com/format_spec/format_spec-0.0.2.tgz |
?- use_module(library(format_spec)). ?- format_spec("Hello, ~s~n", Spec). Spec = [ text("Hello, ") , escape(nothing, no_colon, s) , escape(nothing, no_colon, n) ]. ?- spec_arity($Spec, Arity). Arity = 1. ?- spec_types($Spec, Types). Types = [text]. ?- 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)
Parse, analyze and check your format/2 strings. In SWI Prolog 7.1.5 or later, load this module and run check/0 to check your code for common format string errors. If you only want the check/0 integration, load the module with
:- use_module(library(format_spec), [])).
See Synopsis above for examples.
Using SWI-Prolog 6.3 or later:
?- pack_install(format_spec).
This module uses semantic versioning.
Source code available and pull requests accepted at http://github.com/mndrix/format_spec
Pack contains 5 files holding a total of 10.3K bytes.