moonfall-todos.nv
· 3.9 KiB · Text
Orginalformat
Playground
| |
:todo: ([ ] high priority)
:todo: "Logging levels"
:todo: ([ ] mid priority)
:todo: "Typo spotting tools"
:todo: ([ ] mid priority)
:todo: "Interactive debugging tools"
:todo: ([X] high priority)
:todo: "Get Lua code gen working"
:todo: ([ ] mid priority)
:todo: "Implement warnings for unbound varable"
:todo: ([ ] mid priority)
:todo: "Implement dead code elimination"
:todo: ([/] high priority)
:todo: "Copy stdio port"
:todo: ([ ] high priority)
:todo: "Copy graphics port"
:todo: ([ ] high priority)
:todo: "Copy math jet"
:todo: ([ ] low priority)
:todo: "Copy array jet"
:todo: ([ ] low priority)
:todo: "Copy time jet"
:todo: ([ ] mid priority)
:todo: "Make code gen output a Lua module"
:todo: ([ ] mid priority)
:todo: "Better expansion of special forms"
|| :: render todo list
|:: render todo list|
:: sort task by priority
:: render high priority task
:: render mid priority task
:: render low priority task
|:: sort task by priority? :todo: ([X] $level priority)|
:: add task to $level with finished state
|:: sort task by priority? :todo: ([/] $level priority)|
:: add task to $level with wip state
|:: sort task by priority? :todo: ([ ] $level priority)|
:: add task to $level with unstarted state
|:: sort task by priority? :todo: ([] $level priority)|
:: add task to $level with unstarted state
|:: sort task by priority|
|:: add task to $level with $state state|
:: set task $state to $level
:: move task to $level
:: close $level
|:: set task $state to high| :high: $state
|:: set task $state to mid| :mid: $state
|:: set task $state to low| :low: $state
|:: move task to $level :todo: [X]?|
|:: move task to $level :todo: [/]?|
|:: move task to $level :todo: []?|
|:: move task to $level :todo: [?|
|:: move task to high? :todo: $char|
:high: $char
|:: move task to mid? :todo: $char|
:mid: $char
|:: move task to low? :todo: $char|
:low: $char
|:: move task to $level|
|:: close high| :high:
|:: close mid | :mid:
|:: close low | :low:
|:: render high priority task? :high: finished|
:: push finished check box
:: push high
|:: render high priority task? :high: wip|
:: push wip check box
:: push high
|:: render high priority task? :high: unstarted|
:: push unstarted check box
:: push high
|:: render high priority task? :high: | :: push new line
|:: render high priority task? :high: $char| :message: $char
|:: render high priority task|
:message: "High Priorty Task" :message: 10
:: print message
|:: render mid priority task? :mid: finished|
:: push finished check box
:: push mid
|:: render mid priority task? :mid: wip|
:: push wip check box
:: push mid
|:: render mid priority task? :mid: unstarted|
:: push unstarted check box
:: push mid
|:: render mid priority task? :mid: | :: push new line
|:: render mid priority task? :mid: $char| :message: $char
|:: render mid priority task|
:message: "Mid Priorty Task" :message: 10
:: print message
|:: render low priority task? :low: finished|
:: push finished check box
:: push low
|:: render low priority task? :low: wip|
:: push wip check box
:: push low
|:: render low priority task? :low: unstarted|
:: push unstarted check box
:: push low
|:: render low priority task? :low: | :: push new line
|:: render low priority task? :low: $char| :message: $char
|:: render low priority task|
:message: "Low Priorty Task" :message: 10
:: print message
|:: push low| :message: "low"
|:: push mid| :message: "mid"
|:: push high| :message: "high"
|:: push finished check box| :message: 9 :message: "[X] "
|:: push wip check box| :message: 9 :message: "[/] "
|:: push unstarted check box| :message: 9 :message: "[ ] "
|:: push new line | :message: 10
|:: print message? :message: $char|
:@stdio: write $char
|:: print message|
1 | | | |
2 | :todo: ([ ] high priority) |
3 | :todo: "Logging levels" |
4 | |
5 | :todo: ([ ] mid priority) |
6 | :todo: "Typo spotting tools" |
7 | |
8 | :todo: ([ ] mid priority) |
9 | :todo: "Interactive debugging tools" |
10 | |
11 | :todo: ([X] high priority) |
12 | :todo: "Get Lua code gen working" |
13 | |
14 | :todo: ([ ] mid priority) |
15 | :todo: "Implement warnings for unbound varable" |
16 | |
17 | :todo: ([ ] mid priority) |
18 | :todo: "Implement dead code elimination" |
19 | |
20 | :todo: ([/] high priority) |
21 | :todo: "Copy stdio port" |
22 | |
23 | :todo: ([ ] high priority) |
24 | :todo: "Copy graphics port" |
25 | |
26 | :todo: ([ ] high priority) |
27 | :todo: "Copy math jet" |
28 | |
29 | :todo: ([ ] low priority) |
30 | :todo: "Copy array jet" |
31 | |
32 | :todo: ([ ] low priority) |
33 | :todo: "Copy time jet" |
34 | |
35 | :todo: ([ ] mid priority) |
36 | :todo: "Make code gen output a Lua module" |
37 | |
38 | :todo: ([ ] mid priority) |
39 | :todo: "Better expansion of special forms" |
40 | |
41 | |
42 | || :: render todo list |
43 | |
44 | |:: render todo list| |
45 | :: sort task by priority |
46 | :: render high priority task |
47 | :: render mid priority task |
48 | :: render low priority task |
49 | |
50 | |:: sort task by priority? :todo: ([X] $level priority)| |
51 | :: add task to $level with finished state |
52 | |:: sort task by priority? :todo: ([/] $level priority)| |
53 | :: add task to $level with wip state |
54 | |:: sort task by priority? :todo: ([ ] $level priority)| |
55 | :: add task to $level with unstarted state |
56 | |:: sort task by priority? :todo: ([] $level priority)| |
57 | :: add task to $level with unstarted state |
58 | |:: sort task by priority| |
59 | |
60 | |:: add task to $level with $state state| |
61 | :: set task $state to $level |
62 | :: move task to $level |
63 | :: close $level |
64 | |
65 | |:: set task $state to high| :high: $state |
66 | |:: set task $state to mid| :mid: $state |
67 | |:: set task $state to low| :low: $state |
68 | |
69 | |:: move task to $level :todo: [X]?| |
70 | |:: move task to $level :todo: [/]?| |
71 | |:: move task to $level :todo: []?| |
72 | |:: move task to $level :todo: [?| |
73 | |:: move task to high? :todo: $char| |
74 | :high: $char |
75 | |:: move task to mid? :todo: $char| |
76 | :mid: $char |
77 | |:: move task to low? :todo: $char| |
78 | :low: $char |
79 | |:: move task to $level| |
80 | |
81 | |:: close high| :high: |
82 | |:: close mid | :mid: |
83 | |:: close low | :low: |
84 | |
85 | |:: render high priority task? :high: finished| |
86 | :: push finished check box |
87 | :: push high |
88 | |:: render high priority task? :high: wip| |
89 | :: push wip check box |
90 | :: push high |
91 | |:: render high priority task? :high: unstarted| |
92 | :: push unstarted check box |
93 | :: push high |
94 | |:: render high priority task? :high: | :: push new line |
95 | |:: render high priority task? :high: $char| :message: $char |
96 | |:: render high priority task| |
97 | :message: "High Priorty Task" :message: 10 |
98 | :: print message |
99 | |
100 | |:: render mid priority task? :mid: finished| |
101 | :: push finished check box |
102 | :: push mid |
103 | |:: render mid priority task? :mid: wip| |
104 | :: push wip check box |
105 | :: push mid |
106 | |:: render mid priority task? :mid: unstarted| |
107 | :: push unstarted check box |
108 | :: push mid |
109 | |:: render mid priority task? :mid: | :: push new line |
110 | |:: render mid priority task? :mid: $char| :message: $char |
111 | |:: render mid priority task| |
112 | :message: "Mid Priorty Task" :message: 10 |
113 | :: print message |
114 | |
115 | |:: render low priority task? :low: finished| |
116 | :: push finished check box |
117 | :: push low |
118 | |:: render low priority task? :low: wip| |
119 | :: push wip check box |
120 | :: push low |
121 | |:: render low priority task? :low: unstarted| |
122 | :: push unstarted check box |
123 | :: push low |
124 | |:: render low priority task? :low: | :: push new line |
125 | |:: render low priority task? :low: $char| :message: $char |
126 | |:: render low priority task| |
127 | :message: "Low Priorty Task" :message: 10 |
128 | :: print message |
129 | |
130 | |:: push low| :message: "low" |
131 | |:: push mid| :message: "mid" |
132 | |:: push high| :message: "high" |
133 | |
134 | |:: push finished check box| :message: 9 :message: "[X] " |
135 | |:: push wip check box| :message: 9 :message: "[/] " |
136 | |:: push unstarted check box| :message: 9 :message: "[ ] " |
137 | |:: push new line | :message: 10 |
138 | |
139 | |:: print message? :message: $char| |
140 | :@stdio: write $char |
141 | |:: print message| |
todo_item.py
· 1.7 KiB · Python
Orginalformat
Playground
from dataclasses import dataclass
from enum import Enum
from typing import Any, Self
import re
text_rendered_todo_re = re.compile(r"\[[ X/]{0,1}\]")
class TodoState(Enum):
UNSTARTED = ("Unstarted", "[ ]")
WORK_IN_PROGRESS = ("Work in Progress", "[/]")
FINISHED = ("Finished", "[X]")
def __init__(self, state: str, rendered: str):
self.state = state
self.rendered = rendered
@classmethod
def _missing_(cls, value: object) -> Any:
if type(value) is str:
value = "[ ]" if value == "[]" else value
is_rendered = text_rendered_todo_re.match(value)
for member in cls:
if is_rendered and member.rendered == value:
return member
elif member.state == value:
return member
return super()._missing_(value)
class TodoPriority(Enum):
LOW = "low"
MID = "mid"
HIGH = "high"
def __init__(self, priority: str):
self.priority = priority
todo_line_re = re.compile(
r"^(?P<priority>(low|mid|high))\t(?P<state>\[[ X/]{0,1}\]) (?P<description>.*)$"
)
@dataclass
class TodoItem:
state: TodoState
priority: TodoPriority
description: str
@classmethod
def from_string(cls, line: str) -> Self:
if match := todo_line_re.match(line):
state = TodoState(match.group("state"))
priority = TodoPriority(match.group("priority"))
return TodoItem(state, priority, match.group("description"))
if __name__ == "__main__":
import sys
todos = []
for line in sys.stdin:
if item := TodoItem.from_string(line.strip()):
todos.append(item)
print(f"Found {len(todos)} todo items.")
for item in todos:
print(item)
1 | from dataclasses import dataclass |
2 | from enum import Enum |
3 | from typing import Any, Self |
4 | import re |
5 | |
6 | text_rendered_todo_re = re.compile(r"\[[ X/]{0,1}\]") |
7 | |
8 | |
9 | class TodoState(Enum): |
10 | UNSTARTED = ("Unstarted", "[ ]") |
11 | WORK_IN_PROGRESS = ("Work in Progress", "[/]") |
12 | FINISHED = ("Finished", "[X]") |
13 | |
14 | def __init__(self, state: str, rendered: str): |
15 | self.state = state |
16 | self.rendered = rendered |
17 | |
18 | @classmethod |
19 | def _missing_(cls, value: object) -> Any: |
20 | if type(value) is str: |
21 | value = "[ ]" if value == "[]" else value |
22 | is_rendered = text_rendered_todo_re.match(value) |
23 | |
24 | for member in cls: |
25 | if is_rendered and member.rendered == value: |
26 | return member |
27 | elif member.state == value: |
28 | return member |
29 | |
30 | return super()._missing_(value) |
31 | |
32 | |
33 | class TodoPriority(Enum): |
34 | LOW = "low" |
35 | MID = "mid" |
36 | HIGH = "high" |
37 | |
38 | def __init__(self, priority: str): |
39 | self.priority = priority |
40 | |
41 | |
42 | todo_line_re = re.compile( |
43 | r"^(?P<priority>(low|mid|high))\t(?P<state>\[[ X/]{0,1}\]) (?P<description>.*)$" |
44 | ) |
45 | |
46 | |
47 | @dataclass |
48 | class TodoItem: |
49 | state: TodoState |
50 | priority: TodoPriority |
51 | description: str |
52 | |
53 | @classmethod |
54 | def from_string(cls, line: str) -> Self: |
55 | if match := todo_line_re.match(line): |
56 | state = TodoState(match.group("state")) |
57 | priority = TodoPriority(match.group("priority")) |
58 | return TodoItem(state, priority, match.group("description")) |
59 | |
60 | |
61 | if __name__ == "__main__": |
62 | import sys |
63 | |
64 | todos = [] |
65 | |
66 | for line in sys.stdin: |
67 | if item := TodoItem.from_string(line.strip()): |
68 | todos.append(item) |
69 | |
70 | print(f"Found {len(todos)} todo items.") |
71 | |
72 | for item in todos: |
73 | print(item) |