Ultima attività 1748307761

sierra's Avatar sierra ha revisionato questo gist 1748307761. Vai alla revisione

2 files changed, 214 insertions

moonfall-todos.nv(file creato)

@@ -0,0 +1,141 @@
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(file creato)

@@ -0,0 +1,73 @@
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)
Più nuovi Più vecchi