Skip to content

Commit 11f5c84

Browse files
committed
Release 0.1.4
1 parent 1411b3f commit 11f5c84

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

bin/todo-cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ try {
5151
}
5252

5353
let outJson = parse(data, 0);
54-
if (outJson != null) {
54+
if (outJson != null && outJson != {} && outJson != '') {
5555
doingJson.todo = doingJson.todo.concat(outJson);
5656
}
5757
outJson = parse(data, 1);
58-
if (outJson != null) {
58+
if (outJson != null && outJson != {} && outJson != '') {
5959
criticalJson.todo = criticalJson.todo.concat(outJson);
6060
}
6161
});

lib/parser.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ const grammar = {
44
'bnf': {
55
'todo-plus': [
66
['todo-list EOF', 'return $1;'],
7+
['EOF', 'return null'],
78
],
89
'todo-list': [
910
['todo', '$$ = $1 == null ? null : [$1];'],
1011
['todo-list todo',
11-
'if ($1 == null) { $$ = $2; } else { if ($2 == null) { $$ == $1; } else { $$ = $1.concat($2); } };'],
12+
'if ($1 == null) { $$ = $2; } ' +
13+
'else { if ($2 == null) { $$ == $1; } ' +
14+
'else { $$ = [].concat($1).concat($2); } };'],
1215
],
1316
'todo': [
1417
['item', '$$ = {name: $1, todo: []};'],
15-
// ["NEWLINE", "$$ = []"],
1618
['item INDENT todo-list DEDENT', '$$ = $3 == null ? $3 : {name: $1, todo: $3};'],
1719
['item INDENT DEDENT', '$$ = null;'],
20+
['INDENT DEDENT', '$$ = null'],
1821
],
1922
'item': [
2023
['NAME', '$$ = yytext;'],

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "todo-plus-parser",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "parse todo file to fetch doing and critical todo items then generate html file",
55
"main": "lib/ast.js",
66
"bin": {

0 commit comments

Comments
 (0)