Crate cttt_parser

Source
Expand description

§cttt-parser

Crates.io Docs.rs Test Audit

A parser for the Change This Then That.

§Examples

Basic usage:

let s = "
// @cttt.name(foo)
let x = 1;
// @cttt.change(bar)

// @cttt.name(bar)
let y = 2;
// @cttt.change(foo)
";

println!("{:#?}", cttt_parser::parse(s));

Strict usage:

let s = "
// @cttt.name(foo)
let x = 1;
// @cttt.change(bar)

// @cttt.name(bar)
let y = 2;
// @cttt.change(foo)
";

println!(
  "{:#?}",
  cttt_parser::parse_strict(s, vec!["name".to_string(), "change".to_string()])
);

Structs§

Comment
A Comment with a command and arguments
CommentDebug
Debug information for a Comment
UnknownCommandError
Error identifying location of unknown command

Enums§

Rule
StrictParseError
Error identifying location of unknown command or other parsing error

Statics§

NAMESPACE
Namespace for commands

Functions§

parse
Parse a string into a vector of Comments.
parse_strict
Parse a string into a vector of Comments, and check for unknown commands.