Skip to content

Use chumsky to parse Technique procedure files #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8df238c
Stub module for parsing
istathar Sep 16, 2024
48a0ae9
Add pest dependency
istathar Sep 16, 2024
1e440ea
Grammar for procedure declaration
istathar Sep 16, 2024
5fb162a
Type is a reserved word so call types typas
istathar Sep 16, 2024
163c33b
Handle multiple types in domain
istathar Sep 16, 2024
024a6d0
Add parser test using macro
istathar Sep 16, 2024
31b2873
Rename type again, to forma
istathar Sep 19, 2024
c2ae2e8
Pass input file to parser when checking
istathar Sep 19, 2024
35ca520
Grammar for header lines in a Technique file
istathar Sep 19, 2024
9a7abaa
Reconsider place of newlines in grammar
istathar Sep 19, 2024
2132ef4
Test copyright string on spdx line
istathar Sep 20, 2024
08d1e04
Grammar for template line in header
istathar Sep 20, 2024
73a2427
Additional year tests
istathar Sep 20, 2024
900077e
Additional license tests
istathar Sep 20, 2024
e7da2c1
Test identifiers and declarations
istathar Sep 20, 2024
8f59595
Add winnow parser dependency
istathar Sep 23, 2024
df2cbea
Reimplement identifier parser
istathar Sep 25, 2024
47ce870
Improve parse_identifier to enforce first character
istathar Sep 26, 2024
61502e2
Use verify to ensure identifier parse is valid
istathar Sep 28, 2024
244a9db
Add chumsky parser dependency
istathar Sep 30, 2024
bb5d9ff
Reimplement identifier parser again
istathar Sep 30, 2024
33aa001
Parse magic line
istathar Sep 30, 2024
b32204d
Parse license and copyright header parts
istathar Sep 30, 2024
f15e592
Complete SPDX header line parser
istathar Oct 1, 2024
410cdcc
Parse template line
istathar Oct 3, 2024
e67d110
Remove obscelete test code
istathar Oct 8, 2024
2a5030e
Add failing test
istathar Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 250 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ repository = "https://github.com/technique-lang/technique"
license = "MIT"

[dependencies]
chumsky = "0.9.3"
clap = { version = "4.5.16", features = [ "wrap_help" ] }
pest = "2.7.11"
pest_derive = "2.7.11"
serde = { version = "1.0.209", features = [ "derive" ] }
tinytemplate = "1.2.1"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
winnow = "0.6.18"
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use tracing::debug;
use tracing_subscriber;

mod rendering;
mod parsing;

fn main() {
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
Expand Down Expand Up @@ -89,10 +90,11 @@ fn main() {

let filename = submatches
.get_one::<String>("filename")
.unwrap(); // argument are required by definitin so always present
.unwrap(); // argument are required by definition so always present

debug!(filename);

parsing::load(&Path::new(filename));
todo!();
}
Some(("format", submatches)) => {
Expand Down
Loading