This commit is contained in:
Yarmo Mackenbach 2024-08-12 10:47:19 +02:00
commit dad77f64ec
No known key found for this signature in database
GPG key ID: 2B71CD64664999B6
6 changed files with 209 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.antlr

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# takentaal
## Commands
```bash
nix develop
antlr4-parse takentaal.g4 takentaal example -tree
antlr4-parse takentaal.g4 takentaal example -tokens
``

20
example Normal file
View file

@ -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}

61
flake.lock generated Normal file
View file

@ -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
}

20
flake.nix Normal file
View file

@ -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
];
};
});
}

98
takentaal.g4 Normal file
View file

@ -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_()., ]
;