From ef95bbec8fa31eae32a286d21888425308619da5 Mon Sep 17 00:00:00 2001 From: Andrew Cowie Date: Wed, 1 Oct 2025 11:34:16 +1000 Subject: [PATCH 1/3] Fix recognition of simple Techniques with only top-level steps --- examples/minimal/SimpleList.tq | 4 ++++ src/parsing/parser.rs | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 examples/minimal/SimpleList.tq diff --git a/examples/minimal/SimpleList.tq b/examples/minimal/SimpleList.tq new file mode 100644 index 0000000..023783a --- /dev/null +++ b/examples/minimal/SimpleList.tq @@ -0,0 +1,4 @@ + 1. Open door + 2. Through door + 3. Close door, accepting that it will make a smug and self-satisified + sigh with the knowledge of a job well done. diff --git a/src/parsing/parser.rs b/src/parsing/parser.rs index 42fde0b..f526b3f 100644 --- a/src/parsing/parser.rs +++ b/src/parsing/parser.rs @@ -252,8 +252,8 @@ impl<'i> Parser<'i> { } // Check if this Technique is a single set of one or more - // top-level Scope::SectionChunk - if is_section(self.source) && procedures.is_empty() { + // top-level Scopes (steps or sections) + if (is_section(self.source) || is_step(self.source)) && procedures.is_empty() { while !self.is_finished() { self.trim_whitespace(); if self.is_finished() { @@ -269,6 +269,24 @@ impl<'i> Parser<'i> { self.skip_to_next_line(); } } + } else if is_step_dependent(self.source) { + match self.read_step_dependent() { + Ok(step) => sections.push(step), + Err(error) => { + self.problems + .push(error); + self.skip_to_next_line(); + } + } + } else if is_step_parallel(self.source) { + match self.read_step_parallel() { + Ok(step) => sections.push(step), + Err(error) => { + self.problems + .push(error); + self.skip_to_next_line(); + } + } } else { self.problems .push(ParsingError::Unrecognized(self.offset, 0)); From abc690bce477952e5ebc4db36b1a267734c69077 Mon Sep 17 00:00:00 2001 From: Andrew Cowie Date: Wed, 1 Oct 2025 11:43:13 +1000 Subject: [PATCH 2/3] Ensure samples in both tests/ and examples/ parse successfully --- tests/parsing/samples.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/parsing/samples.rs b/tests/parsing/samples.rs index 85d0004..3a342ad 100644 --- a/tests/parsing/samples.rs +++ b/tests/parsing/samples.rs @@ -3,10 +3,8 @@ use std::path::Path; use technique::parsing; -#[test] -fn ensure_parse() { - let dir = Path::new("tests/samples/"); - +fn check_directory(dir: &Path) { + // Ensure the directory exists assert!(dir.exists(), "samples directory missing"); let entries = fs::read_dir(dir).expect("Failed to read samples directory"); @@ -49,3 +47,9 @@ fn ensure_parse() { ); } } + +#[test] +fn ensure_parse() { + check_directory(Path::new("tests/samples/")); + check_directory(Path::new("examples/minimal/")); +} From 26bbbf8f2ed987587449725ac99bf284884053e2 Mon Sep 17 00:00:00 2001 From: Andrew Cowie Date: Wed, 1 Oct 2025 11:54:06 +1000 Subject: [PATCH 3/3] Bump version and update dependenies --- Cargo.lock | 66 +++++++++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c71a5ab..03c3927 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" @@ -135,7 +135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.0", + "windows-sys 0.61.1", ] [[package]] @@ -167,9 +167,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.175" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "linux-raw-sys" @@ -220,9 +220,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "nu-ansi-term" @@ -247,9 +247,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "owo-colors" -version = "4.2.2" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" [[package]] name = "pin-project-lite" @@ -268,18 +268,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.11.2" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" dependencies = [ "aho-corasick", "memchr", @@ -289,9 +289,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" dependencies = [ "aho-corasick", "memchr", @@ -314,7 +314,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.0", + "windows-sys 0.61.1", ] [[package]] @@ -325,9 +325,9 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" -version = "1.0.226" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", @@ -335,18 +335,18 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.226" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.226" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -411,7 +411,7 @@ dependencies = [ [[package]] name = "technique" -version = "0.4.5" +version = "0.4.6" dependencies = [ "clap", "lsp-server", @@ -533,12 +533,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.0" @@ -560,16 +554,16 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.3", + "windows-targets 0.53.4", ] [[package]] name = "windows-sys" -version = "0.61.0" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" dependencies = [ - "windows-link 0.2.0", + "windows-link", ] [[package]] @@ -590,11 +584,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.3" +version = "0.53.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" dependencies = [ - "windows-link 0.1.3", + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/Cargo.toml b/Cargo.toml index 9b85ddc..56bc190 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "technique" -version = "0.4.5" +version = "0.4.6" edition = "2021" description = "A domain specific language for procedures." authors = [ "Andrew Cowie" ]