[MOD/WIP] Mess a bit with the XEP-0393 parser

It took a comical amount of time for me to do that LMAO
This commit is contained in:
LDA 2024-08-01 10:31:59 +02:00
commit cb0e77e7a4
5 changed files with 345 additions and 148 deletions

View file

@ -1,6 +1,7 @@
#ifndef PARSEE_STRINGSPLIT_H
#define PARSEE_STRINGSPLIT_H
#include <stdbool.h>
#include <stdlib.h>
/* Represents a boundary in a linesplit string */
@ -32,6 +33,29 @@ extern size_t StrLines(char **split);
/* Creates a full zone covering every part of the split */
extern StringRect StrFullRect(char **split);
extern char Str
/**
* Retrieves a character from a string rectview, or \0 if out of bounds.
* --------------
* Returns: A character at {line}, {col} in C-indices | '\0'
* Modifies: NOTHING */
extern char StrGet(StringRect rect, int line, int col);
/**
* Retrieves a line from a string rectview, or a NULL one
* --------------
* Returns: A stringview that lives along the original
* Modifies: NOTHING */
extern StringRect StrGetl(StringRect rect, int line, bool extend);
/**
* Returns a new stringrect, shifted by N chars.
* --------------
* Returns: A stringview that lives along the original
* Modifies: NOTHING */
extern StringRect StrShift(StringRect rect, int n);
extern size_t StrViewLines(StringRect);
extern size_t StrViewChars(StringRect, int line);
extern void PrintRect(StringRect rect);
#endif

View file

@ -7,9 +7,11 @@ typedef enum XEP393Type {
XEP393_ROOT,
XEP393_ITALIC,
XEP393_EMPH,
XEP393_SRKE,
XEP393_MONO,
XEP393_TEXT,
XEP393_QUOT,
XEP393_LINE,
XEP393_NL
} XEP393Type;
typedef struct XEP393Element {