[ADD/WIP] Start making a simple SAX parser, ASwerk

This commit is contained in:
LDA 2024-06-15 12:29:34 +02:00
commit 79217d3608
14 changed files with 1066 additions and 26 deletions

36
src/include/XML.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef PARSEE_XML_H
#define PARSEE_XML_H
#include <Cytoplasm/HashMap.h>
#include <Cytoplasm/Stream.h>
typedef struct XMLexer XMLexer;
typedef struct XMLEvent {
enum {
XML_LEXER_UNKNOWN = 0,
XML_LEXER_STARTELEM,
XML_LEXER_ELEM, /* Empty attr */
XML_LEXER_DATA,
XML_LEXER_ENDELEM,
XML_RELAX
} type;
int line, col;
size_t offset;
/* The element name */
char *element;
/* Attributes hashmap */
HashMap *attrs;
/* The decoded data */
char *data;
} XMLEvent;
extern XMLexer * XMLCreateLexer(Stream *, bool);
extern XMLEvent * XMLCrank(XMLexer *);
extern void XMLFreeEvent(XMLEvent *);
extern void XMLFreeLexer(XMLexer *);
#endif