Restructure and start tag stream
This commit is contained in:
parent
e2aa3fa6f5
commit
0771faba44
|
@ -0,0 +1,27 @@
|
|||
#ifndef _HDR_HYPERBUILD_STREAM_HELPER_TAGNAME
|
||||
#define _HDR_HYPERBUILD_STREAM_HELPER_TAGNAME
|
||||
|
||||
#include "../../rule/char/tagname.c"
|
||||
|
||||
#include "../../util/hbchar.h"
|
||||
#include "../../util/pipe.c"
|
||||
|
||||
hbu_buffer_t hbsh_tagname(hbu_pipe_t pipe) {
|
||||
hbu_buffer_t name = hbu_buffer_create();
|
||||
|
||||
while (1) {
|
||||
hb_char_t c = hbu_pipe_peek(pipe);
|
||||
|
||||
if (!hb_r_tagname_check(c)) {
|
||||
break;
|
||||
}
|
||||
|
||||
hbu_buffer_append(name, c);
|
||||
|
||||
hbu_pipe_accept(pipe);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_STREAM_HELPER_TAGNAME
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef _HDR_HYPERBUILD_STREAM_TAG
|
||||
#define _HDR_HYPERBUILD_STREAM_TAG
|
||||
|
||||
#include "../rule/tag/voidtags.c"
|
||||
|
||||
#include "../util/hbchar.h"
|
||||
#include "../util/pipe.c"
|
||||
|
||||
#include "./helper/tagname.c"
|
||||
#include "./content.c"
|
||||
|
||||
void hbs_tag(hbu_pipe_t pipe) {
|
||||
hbu_pipe_require(pipe, '<');
|
||||
hbu_buffer_t opening_name = hbsh_tagname(pipe);
|
||||
// TODO
|
||||
hbu_pipe_require(pipe, '>');
|
||||
|
||||
// Content
|
||||
hbs_content(pipe);
|
||||
|
||||
// Closing tag for non-void
|
||||
hbu_pipe_require(pipe, '<');
|
||||
hbu_pipe_require(pipe, '/');
|
||||
hbu_buffer_t closing_name = hbsh_tagname(pipe);
|
||||
hbu_pipe_require(pipe, '>');
|
||||
}
|
||||
|
||||
#endif // _HDR_HYPERBUILD_STREAM_TAG
|
Loading…
Reference in New Issue