[ADD/WIP] Congestion, basic ad-hoc commands

Woah, took me a while, eh? Next up, getting forms!
This commit is contained in:
LDA 2024-07-13 16:26:33 +02:00
commit 408888ef67
9 changed files with 911 additions and 14 deletions

View file

@ -141,20 +141,27 @@ IdentifySpan(char span_tag, StrView in, StrView *view)
view->end = in.start;
return true;
}
static void
XEP393Decode(StrView view, XEP393Element *root)
{
StrView subview = view;
StrView textview = view;
XEP393Element *text, *span;
size_t i;
bool managed = false;
char prev = '\0', curr = '\0';
textview.end = subview.start;
for (i = 0; subview.start < subview.end; subview.start++)
for (; subview.start < subview.end; subview.start++)
{
StrView span_view;
managed = false;
curr = *subview.start;
if (prev == '\0' || prev == '\n')
{
/* TODO: Start of line, start parsing blocks. */
}
#define Spanify(xep_symbol) \
managed = true; \
textview.end = subview.start; \
@ -193,7 +200,8 @@ XEP393Decode(StrView view, XEP393Element *root)
/* Text character: update end */
textview.end = subview.start;
}
(void) i;
prev = curr;
}
if (!managed)
@ -215,7 +223,10 @@ XEP393(char *message)
/* TODO: Parse blocks first, *then* spans. Considering the
* current architecture, this shouldn't be too hard to integrate,
* given how string views already manage boundaries, and elements
* can already be used to contain blocks I think. */
* can already be used to contain blocks I think.
*
* Actually, nevermind, these would be pure pain. Nested blocks,
* unterminated ones, QUOTES. Just hell. I hate parsing this shit. */
XEP393Decode(view, root);
return root;
}