Basic tag streaming
This commit is contained in:
parent
fefe796887
commit
e647872756
|
@ -1,12 +1,17 @@
|
|||
#ifndef _HDR_HYPERBUILD_STREAM_TAG
|
||||
#define _HDR_HYPERBUILD_STREAM_TAG
|
||||
|
||||
#include "../error/error.c"
|
||||
|
||||
#include "../rule/char/whitespace.c"
|
||||
#include "../rule/tag/voidtags.c"
|
||||
|
||||
#include "../util/hbchar.h"
|
||||
#include "../util/pipe.c"
|
||||
|
||||
#include "./helper/tagname.c"
|
||||
#include "./helper/attr.c"
|
||||
|
||||
// Declare first before content.c, as content.c depends on it
|
||||
void hbs_tag(hbu_pipe_t pipe);
|
||||
|
||||
|
@ -15,9 +20,18 @@ void hbs_tag(hbu_pipe_t pipe);
|
|||
void hbs_tag(hbu_pipe_t pipe) {
|
||||
hbu_pipe_require(pipe, '<');
|
||||
hbu_buffer_t opening_name = hbsh_tagname(pipe);
|
||||
// TODO
|
||||
while (hbu_pipe_peek(pipe) != '>') {
|
||||
hbu_pipe_require_predicate(pipe, &hb_r_whitespace_check, "whitespace between attributes");
|
||||
hbu_pipe_skip_while_predicate(pipe, &hb_r_whitespace_check);
|
||||
|
||||
hbsh_attr(pipe);
|
||||
}
|
||||
hbu_pipe_require(pipe, '>');
|
||||
|
||||
if (hb_r_voidtags_check(hbu_buffer_underlying(opening_name))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Content
|
||||
hbs_content(pipe);
|
||||
|
||||
|
@ -26,6 +40,11 @@ void hbs_tag(hbu_pipe_t pipe) {
|
|||
hbu_pipe_require(pipe, '/');
|
||||
hbu_buffer_t closing_name = hbsh_tagname(pipe);
|
||||
hbu_pipe_require(pipe, '>');
|
||||
|
||||
if (!hbu_buffer_equal(opening_name, closing_name)) {
|
||||
// TODO
|
||||
hbe_fatal("EUNCTAG");
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_STREAM_TAG
|
||||
|
|
Loading…
Reference in New Issue