RDF 1.1 Turtle parser for Rust.
Turtle is a textual syntax for RDF that allows an RDF graph to be completely
written in a compact and natural text form, with abbreviations for common
usage patterns and datatypes. This library provides a Turtle parser for Rust that keeps tracks of code mapping metadata for each syntax node using the locspan library.
Basic usage
Elements of the Turtle abstract syntax tree (implementing Parsable)
are parsed using a Token iterator (a.k.a a lexer).
A Lexer can be created from a char iterator.
We can then use the Document::parse function to parse a Turtle document
from the lexer.
In the following example, we use the excellent codespan_reporting crate
to report errors.
use ;
use SimpleFiles;
use ;
use Meta;
use File;
use Read;
use ;
The above code will have the following kind of output when a syntax error is detected:
error: parse error: unexpected character ` `
┌─ examples/syntax_error.ttl:5:34
│
5 │ <http://www.w3.org/TR/rdf-syntax- grammar>
│ ^
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.