Skip to content

Commit

Permalink
allow comment inside base structure
Browse files Browse the repository at this point in the history
  • Loading branch information
metelkin committed May 20, 2024
1 parent 29c24a7 commit f6ab7cc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/pegjs/heta.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MultylineComment
return null;
}

BaseStruct = fullLine: (Space/Break/Note/Id/Index/Action/Type/Title/Dict/Assignment)* EndSign
BaseStruct = fullLine: (Space/Break/Note/Id/Index/Action/Type/Title/Dict/Assignment/MultylineComment/LineComment)* EndSign
{
let res = Object.assign({}, ...fullLine);
return res;
Expand Down
8 changes: 8 additions & 0 deletions test/parse/input/notes.heta
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ This is very long text. This is very long text. This is very long text. This is
This is very long text.
'''
S4 @species {compartment: comp1};

'''Notes with trailing comment'''
/* This is comment */
k1 @Const = 1.1;

'''Notes with trailing comment'''
// This is comment
k1 @Const = 1.1;
14 changes: 14 additions & 0 deletions test/parse/output/notes.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,19 @@
"class": "Species",
"compartment": "comp1",
"notes": "\nThis is very long text. This is very long text's.\nThis is very long text. This is very long text.\nThis is very long text. This is very long text. This is very long text. This is very long text.\nThis is very long text.\n"
},
{
"id": "k1",
"action": "upsert",
"class": "Const",
"notes": "Notes with trailing comment",
"num": 1.1
},
{
"id": "k1",
"action": "upsert",
"class": "Const",
"notes": "Notes with trailing comment",
"num": 1.1
}
]

0 comments on commit f6ab7cc

Please sign in to comment.