File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 :title (* " # " (some (+ :w + :s +)))
1010 :tasks (group (any :task ))
1111 :task (replace (* " - " :task-title :task-schedule (? " \n " )) ,task/build-scheduled-task )
12- :task-title (replace (capture (some (if-not " (" 1 ))) ,string/trim )
12+ :task-title (replace (capture (some (if-not ( + " (" " \n " ) 1 ))) ,string/trim )
1313 :task-schedule (* " (" (replace (capture (some (+ :w + :s + " -" ))) ,string/trim ) " )" )})
1414
15+ (defn- task-lines-count
16+ ```
17+ Returns the number of lines that start with '-' in the schedule string.
18+ ```
19+ [schedule-string ]
20+ (length (filter (fn [line ] (string/has-prefix? " -" line ))
21+ (string/split " \n " schedule-string ))))
22+
1523# # —————————————————————————————————————————————————————————————————————————————
1624# # Public Interface
1725
2836 (let [tasks (first parse-result )]
2937 (if (empty? tasks )
3038 {:errors [" Schedule is empty" ]}
31- {:tasks tasks }))
39+ (do
40+ (if (= (length tasks ) (task-lines-count schedule-string ))
41+ {:tasks tasks }
42+ {:errors [(string " Schedule can not be parsed - last parsed task is \" "
43+ ((last tasks ) :title )
44+ " \" " )]}))))
3245 {:errors [" Schedule can not be parsed" ]})))
You can’t perform that action at this time.
0 commit comments