From dad77f64ec0ae271a68d215f7f3a33edd322afb0 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Mon, 12 Aug 2024 10:47:19 +0200 Subject: [PATCH] init --- .gitignore | 1 + README.md | 9 +++++ example | 20 +++++++++++ flake.lock | 61 ++++++++++++++++++++++++++++++++ flake.nix | 20 +++++++++++ takentaal.g4 | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 209 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 example create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 takentaal.g4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ccca18c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.antlr \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..130cbf7 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# takentaal + +## Commands + +```bash +nix develop +antlr4-parse takentaal.g4 takentaal example -tree +antlr4-parse takentaal.g4 takentaal example -tokens +`` \ No newline at end of file diff --git a/example b/example new file mode 100644 index 0000000..a29a58e --- /dev/null +++ b/example @@ -0,0 +1,20 @@ +# Full work plan {5000} + +This is the description of the entire work plan. + +## First task {1000} + +This is the description of the first task. +This line is still part of the first paragraph of the description. + +This is a second paragraph of that description. + +- First subtask {500} +/ Second subtask {500} + +## Second task {1000} + +This is the description of the second task. + +* First subtask {500} +- Second subtask {500} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e5e1302 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1721782431, + "narHash": "sha256-UNDpwjYxNXQet/g3mgRLsQ9zxrbm9j2JEvP4ijF3AWs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f02464258baaf54992debfd010a7a3662a25536", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..916b738 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShell = with pkgs; mkShell { + buildInputs = [ + jdk + antlr + ]; + }; + }); +} \ No newline at end of file diff --git a/takentaal.g4 b/takentaal.g4 new file mode 100644 index 0000000..df9bb5a --- /dev/null +++ b/takentaal.g4 @@ -0,0 +1,98 @@ +grammar takentaal; + +takentaal + : line+ EOF + ; + +line + : plan + | task + | subtask + | comment + ; + +plan + : PLAN_TOKEN TEXT + | PLAN_TOKEN TEXT AMOUNT + ; + +task + : TASK_TOKEN TEXT + | TASK_TOKEN TEXT AMOUNT + ; + +subtask + : subtask_new + | subtask_partial + | subtask_complete + | subtask_obsolete + ; + +subtask_new + : SUBTASK_NEW_TOKEN TEXT AMOUNT? + ; + +subtask_partial + : SUBTASK_PARTIAL_TOKEN TEXT AMOUNT? + ; + +subtask_complete + : SUBTASK_COMPLETE_TOKEN TEXT AMOUNT? + ; + +subtask_obsolete + : SUBTASK_OBSOLETE_TOKEN TEXT AMOUNT? + ; + +comment + : TEXT + ; + +PLAN_TOKEN + : '# ' + ; + +TASK_TOKEN + : '## ' + ; + +SUBTASK_NEW_TOKEN + : '- ' + ; + +SUBTASK_PARTIAL_TOKEN + : '/ ' + ; + +SUBTASK_COMPLETE_TOKEN + : '* ' + ; + +SUBTASK_OBSOLETE_TOKEN + : '! ' + ; + +WS + : [ \r\n\t]+ -> skip + ; + +AMOUNT + : '{' INT+ '}' + ; + +fragment INT + : [0-9] + ; + +TEXT + : TEXTHEAD TEXTBODY* + ; + +fragment TEXTHEAD + : [a-zA-Z] + ; + +fragment TEXTBODY + : TEXTHEAD + | [0-9_()., ] + ; \ No newline at end of file