tki
6 years ago
commit
7cfadc190c
12 changed files with 112 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||||
|
*.out |
||||
|
*.o |
||||
|
.#* |
||||
|
.env |
@ -0,0 +1,23 @@ |
|||||
|
root = true |
||||
|
|
||||
|
[*] |
||||
|
end_of_line = lf |
||||
|
insert_final_newline = true |
||||
|
charset = utf-8 |
||||
|
indent_size = 2 |
||||
|
indent_style = space |
||||
|
|
||||
|
[*.py] |
||||
|
indent_style = space |
||||
|
indent_size = 4 |
||||
|
|
||||
|
[*.imba] |
||||
|
indent_style = tab |
||||
|
indent_size = 4 |
||||
|
|
||||
|
[Makefile] |
||||
|
indent_style = tab |
||||
|
|
||||
|
[*.c] |
||||
|
indent_style = tab |
||||
|
indent_size = 4 |
@ -0,0 +1 @@ |
|||||
|
export RML_DEBUG:=0 |
@ -0,0 +1,14 @@ |
|||||
|
include .env |
||||
|
|
||||
|
CC=gcc |
||||
|
CFLAGS=-Wall -C -I. -Isrc/include |
||||
|
DEPS = dom.h tokenizer.h nodes_t.h |
||||
|
|
||||
|
%.o: %.c $(DEPS) |
||||
|
(CC) -c -o $@ $< $(CFLAGS) -D DEBUG=$(RML_DEBUG) |
||||
|
|
||||
|
rmlp: src/main.o src/dom.o src/tokenizer.o |
||||
|
$(CC) -o rmlp.out src/main.o src/dom.o src/tokenizer.o |
||||
|
|
||||
|
clean: |
||||
|
rm src/*.o |
@ -0,0 +1,5 @@ |
|||||
|
Reduced Markup Language Parser |
||||
|
|
||||
|
#### NAME |
||||
|
|
||||
|
*rmlp* --- It slurps reduced html and barfs out DOM tree. |
@ -0,0 +1,5 @@ |
|||||
|
<!-- should produce colorful text with random skewing --> |
||||
|
<div class="_rainbow"> |
||||
|
<div class="_random-skew">This is colorful</div> |
||||
|
</div> |
||||
|
<a href="imba.io">Imba language</a> |
@ -0,0 +1,13 @@ |
|||||
|
#include "nodes_t.h" |
||||
|
|
||||
|
node current_node(void) { |
||||
|
return NULL; |
||||
|
} |
||||
|
|
||||
|
tree add_child(node *child) { |
||||
|
return NULL; |
||||
|
} |
||||
|
|
||||
|
tree add_sibling(node *sibling) { |
||||
|
return NULL; |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
#ifndef __MACROS__ |
||||
|
#define __MACROS__ |
||||
|
|
||||
|
#if DEBUG == 0 |
||||
|
#define DEBUG_MODE 0 |
||||
|
#else |
||||
|
#define DEBUG_MODE 1 |
||||
|
#endif /*debug*/ |
||||
|
|
||||
|
#define log(fmt, ...) \ |
||||
|
do { if (DEBUG_MODE) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ |
||||
|
__LINE__, __func__, __VA_ARGS__); } while (0) |
||||
|
|
||||
|
#endif //macros
|
@ -0,0 +1,8 @@ |
|||||
|
#ifndef __NODES_T__ |
||||
|
#define __NODES_T__ |
||||
|
|
||||
|
typedef struct node { |
||||
|
char *element; |
||||
|
} node; |
||||
|
|
||||
|
#endif //nodes
|
@ -0,0 +1,10 @@ |
|||||
|
#ifndef __TOKENIZER__ |
||||
|
#define __TOKENIZER__ |
||||
|
|
||||
|
typedef struct node { |
||||
|
char *element; |
||||
|
} node; |
||||
|
|
||||
|
node slurp_whitespace(char*); |
||||
|
|
||||
|
#endif //tokenizer
|
@ -0,0 +1,9 @@ |
|||||
|
#include <stdio.h> |
||||
|
#include "macros.h" |
||||
|
#include "tokenizer.h" |
||||
|
|
||||
|
int main(int argc, char **argv) { |
||||
|
char *input = argv[1]; |
||||
|
log("Got: %s\n", input); |
||||
|
return 0; |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
#include "nodes_t.h" |
||||
|
#include "tokenizer.h" |
||||
|
|
||||
|
node slurp_whitespace(char* input_line) { |
||||
|
return NULL; |
||||
|
} |
Loading…
Reference in new issue