| Crates.io | to_do_parcer |
| lib.rs | to_do_parcer |
| version | 0.1.2 |
| created_at | 2025-11-11 21:53:31.554716+00 |
| updated_at | 2025-11-11 22:26:45.133562+00 |
| description | Rust parser for a custom task management with projects, dependencies, priorities, assignees, and tags. Used to describe the flow of tasks in text format. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1928242 |
| size | 48,381 |
Rust parser for a custom task management with projects, dependencies, priorities, assignees, and tags. Used to describe the flow of tasks in text format.
It includes:
The program reads text files with a project description, which may contain:
The pest library is used, which, based on the previously described grammar, determines the main thing in the document. The program forms a tree of elements in which each node corresponds to a separate object - a project, task, or attribute. After analysis, the user sees the result in console format.
Example:
file ->
project "Parser" {
todo: "Design grammar" @high due:2025-11-15 assign:@tanya
todo: "Write parser in Rust" depends_on:"Design grammar"
assign:@oleksii done: "Initialize Cargo project" }
[TODO] Design grammar Priority:
High Due: 2025-11-15
Assigned to: @tanya
[TODO] Write parser in Rust
Depends on: Design grammar
Assigned to: @oleksii
[DONE] Initialize Cargo project
-----------------------------------
Total: 3 tasks (2 active, 1 completed)
If there are syntax errors in the text (for example, a missing parenthesis or an incorrect date), the parser will report this to the console. Output to the console in a clear tabular form (as in the example above).
/// The root rule — represents the entire file.
///
/// Each file must contain one or more `project` blocks.
file = { SOI ~ project+ ~ EOI }
/// Defines a block (project) of tasks
project = {
"project" ~ quoted
~ "{"
~ task*
~ "}"
}
/// Kind of task
task = { (todo_task | done_task) ~ "," }
/// A task that is still pending.
todo_task = { "todo:" ~ quoted ~ attribute_list }
/// A task that has been completed.
done_task = { "done:" ~ quoted ~ attribute_list }
/// Optional list of attributes associated with a task.
attribute_list = { ("," ~ attribute)* }
/// Possible attributes for a task: priority, due date, assignee, dependencies, tags.
attribute = { priority | due_date | assignee | depends_on | tag }
/// Priority marker for a task.
priority = { "@high" | "@medium" | "@low" }
/// Task due date in YYYY-MM-DD format.
due_date = { "due:" ~ date }
assignee = { "assign:" ~ "@" ~ identifier }
depends_on = { "depends_on:" ~ quoted }
tag = { "@tag:" ~ quoted }
// Quoted string: "Something"
quoted = @{ "\"" ~ (!"\"" ~ ANY)* ~ "\"" }
identifier = @{ (ASCII_ALPHANUMERIC | "_" | "-")+ }
date = @{ ASCII_DIGIT{4} ~ "-" ~ ASCII_DIGIT{2} ~ "-" ~ ASCII_DIGIT{2} }
// Whitespace (space or tab)
WHITESPACE = _{ " " | "\t" | "\r\n" | "\n" }
// Line breaks
NEWLINE = _{ "\r"? ~ "\n" }
COMMENT = _{ "//" ~ (!NEWLINE ~ ANY)* ~ NEWLINE? }