Parse bangs
This commit is contained in:
parent
2c7992585a
commit
6080451453
|
@ -0,0 +1,24 @@
|
|||
#ifndef _HDR_HYPERBUILD_STREAM_BANG
|
||||
#define _HDR_HYPERBUILD_STREAM_BANG
|
||||
|
||||
#include "../util/hbchar.h"
|
||||
#include "../util/pipe.c"
|
||||
|
||||
void hbs_bang(hbu_pipe_t pipe)
|
||||
{
|
||||
hbu_pipe_require_match(pipe, "<!");
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (hbu_pipe_peek_offset(pipe, 1) == '>')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
hbu_pipe_skip(pipe);
|
||||
}
|
||||
|
||||
hbu_pipe_skip(pipe);
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_STREAM_BANG
|
|
@ -8,6 +8,7 @@
|
|||
void hbs_content(hbu_pipe_t pipe);
|
||||
|
||||
#include "./tag.c"
|
||||
#include "./bang.c"
|
||||
|
||||
void hbs_content(hbu_pipe_t pipe) {
|
||||
while (1) {
|
||||
|
@ -21,9 +22,14 @@ void hbs_content(hbu_pipe_t pipe) {
|
|||
if (hbu_pipe_peek_offset(pipe, 2) == '/') {
|
||||
// Callee is responsible for requiring close tag (or not, if root)
|
||||
return;
|
||||
}
|
||||
|
||||
hbs_tag(pipe);
|
||||
} else if (hbu_pipe_peek_offset(pipe, 2) == '!') {
|
||||
// Check after comment
|
||||
hbs_bang(pipe);
|
||||
|
||||
} else {
|
||||
hbs_tag(pipe);
|
||||
}
|
||||
break;
|
||||
|
||||
case '&':
|
||||
|
|
Loading…
Reference in New Issue