-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(syntax) enable top-level HTML comments
Now it's possible to have top-level HTML-style comments in the hsp file: ``` <!-- this is a comment --> ``` They're emitted at parse time, and discarded at syntax generation time (replaced with newlines, to keep the 1:1 line mapping between input and generated file, we may change that in the future).
- Loading branch information
Showing
9 changed files
with
100 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<script> | ||
// edit me! | ||
</script> | ||
<!-- | ||
edit me! | ||
--> | ||
|
||
<template hello(name)> | ||
<div class="msg"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
##### Template: | ||
<!-- this is a comment --> | ||
<template hello1> | ||
Hello World! | ||
</template> | ||
|
||
|
||
<!-- this is | ||
yet another comment | ||
this time it's multiline | ||
--> | ||
<script> | ||
// comment | ||
function func2(z) {return z;} | ||
</script> | ||
|
||
<!-- | ||
-- this comment has some dashes and even <!-- in the content -- | ||
--> | ||
<template hello2> | ||
Hello Again! | ||
</template> | ||
##### Parsed Tree: | ||
|
||
[ | ||
{ type: 'toplevelcomment', value: ' this is a comment \n'}, | ||
{ type: 'template', name: 'hello1', args: [], content: [ | ||
{ type: 'text', value: 'Hello World!' } | ||
]}, | ||
{ type: 'plaintext', value: '\n\n'}, | ||
{ type: 'toplevelcomment', value: ' this is\nyet another comment\nthis time it\'s multiline\n\n'}, | ||
{ type: 'plaintext', value: '\n// comment\nfunction func2(z) {return z;}\n\n'}, | ||
{ type: 'plaintext', value: '\n'}, | ||
{ type: 'toplevelcomment', value: '\n -- this comment has some dashes and even <!-- in the content --\n \n'}, | ||
{ type: 'template', name: 'hello2', args: [], content: [ | ||
{ type: 'text', value: 'Hello Again!' } | ||
]}, | ||
] | ||
|
||
##### Syntax Tree: | ||
|
||
[ | ||
{ type: 'plaintext', value: '\n'}, | ||
{ type: 'template', name: 'hello1', args: [], content: [ | ||
{ type: 'text', value: 'Hello World!' } | ||
]}, | ||
{ type: 'plaintext', value: '\n\n'}, | ||
{ type: 'plaintext', value: '\n\n\n\n'}, | ||
{ type: 'plaintext', value: '\n// comment\nfunction func2(z) {return z;}\n\n'}, | ||
{ type: 'plaintext', value: '\n'}, | ||
{ type: 'plaintext', value: '\n\n\n'}, | ||
{ type: 'template', name: 'hello2', args: [], content: [ | ||
{ type: 'text', value: 'Hello Again!' } | ||
]}, | ||
] | ||
|
||
##### Template Code 1 | ||
hello1=[__s, | ||
n.$text(0, ["Hello World!"]) | ||
] | ||
|
||
##### Template Code 2 | ||
hello2=[__s, | ||
n.$text(0, ["Hello Again!"]) | ||
] |
fcab2c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR #308