Parse comments
This commit is contained in:
parent
6080451453
commit
cbc837978d
|
@ -0,0 +1,29 @@
|
|||
#ifndef _HDR_HYPERBUILD_STREAM_COMMENT
|
||||
#define _HDR_HYPERBUILD_STREAM_COMMENT
|
||||
|
||||
#include "../util/hbchar.h"
|
||||
#include "../util/pipe.c"
|
||||
|
||||
void hbs_comment(hbu_pipe_t pipe)
|
||||
{
|
||||
hbu_pipe_require(pipe, '<');
|
||||
hbu_pipe_require(pipe, '!');
|
||||
hbu_pipe_require(pipe, '-');
|
||||
hbu_pipe_require(pipe, '-');
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (hbu_pipe_peek_offset(pipe, 1) == '-' &&
|
||||
hbu_pipe_peek_offset(pipe, 2) == '-' &&
|
||||
hbu_pipe_peek_offset(pipe, 3) == '>')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
hbu_pipe_skip(pipe);
|
||||
}
|
||||
|
||||
hbu_pipe_skip_amount(pipe, 3);
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_STREAM_COMMENT
|
|
@ -9,6 +9,7 @@ void hbs_content(hbu_pipe_t pipe);
|
|||
|
||||
#include "./tag.c"
|
||||
#include "./bang.c"
|
||||
#include "./comment.c"
|
||||
|
||||
void hbs_content(hbu_pipe_t pipe) {
|
||||
while (1) {
|
||||
|
@ -23,6 +24,9 @@ void hbs_content(hbu_pipe_t pipe) {
|
|||
// Callee is responsible for requiring close tag (or not, if root)
|
||||
return;
|
||||
|
||||
} else if (hbu_pipe_peek_offset(pipe, 2) == '!' && hbu_pipe_peek_offset(pipe, 3) == '-') {
|
||||
hbs_comment(pipe);
|
||||
|
||||
} else if (hbu_pipe_peek_offset(pipe, 2) == '!') {
|
||||
// Check after comment
|
||||
hbs_bang(pipe);
|
||||
|
|
Loading…
Reference in New Issue