Delete...
This commit is contained in:
parent
8bcb29ba37
commit
3e578583be
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -xe
|
|
||||||
|
|
||||||
gcc -ansi -Wall -Wextra -Wpedantic -o example example.c
|
|
||||||
cat example.c | ./example
|
|
||||||
|
|
||||||
exit
|
|
BIN
example/example
BIN
example/example
Binary file not shown.
@ -1,84 +0,0 @@
|
|||||||
#define XYNTAX_DECLARATION
|
|
||||||
#define XYNTAX_DEFINITION
|
|
||||||
|
|
||||||
#include <xolatile/xyntax.h>
|
|
||||||
|
|
||||||
#define ALLOCATION_CHUNK (1024)
|
|
||||||
|
|
||||||
int main (void) {
|
|
||||||
int buffer_size = 0;
|
|
||||||
int offset = 0;
|
|
||||||
int word = 0;
|
|
||||||
char * buffer = NULL;
|
|
||||||
|
|
||||||
char separator [29] = ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n";
|
|
||||||
|
|
||||||
char * c_keywords [32] = {
|
|
||||||
"register", "volatile", "auto", "const", "static", "extern", "if", "else",
|
|
||||||
"do", "while", "for", "continue", "switch", "case", "default", "break",
|
|
||||||
"enum", "union", "struct", "typedef", "goto", "void", "return", "sizeof",
|
|
||||||
"char", "short", "int", "long", "signed", "unsigned", "float", "double"
|
|
||||||
};
|
|
||||||
|
|
||||||
char * c_preprocessor [8] = {
|
|
||||||
"#include", "#define", "#ifdef", "#ifndef", "#undef", "#elif", "#if", "#endif"
|
|
||||||
};
|
|
||||||
|
|
||||||
char * c_common [4] = {
|
|
||||||
"NULL", "FILE", "size_t", "ssize_t"
|
|
||||||
};
|
|
||||||
|
|
||||||
syntax_define (0, 0, 0, "//", "\n", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 0, 0, "/*", "*/", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 0, 0, "'", "'", '\\', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 0, 0, "\"", "\"", '\\', TERMINAL_COLOUR_RED, TERMINAL_EFFECT_BOLD);
|
|
||||||
|
|
||||||
do {
|
|
||||||
syntax_define (0, 0, 1, c_keywords [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_BOLD);
|
|
||||||
} while (++word != 32);
|
|
||||||
|
|
||||||
word = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
syntax_define (0, 0, 1, c_preprocessor [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_NORMAL);
|
|
||||||
} while (++word != 8);
|
|
||||||
|
|
||||||
word = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
syntax_define (0, 0, 1, c_common [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_ITALIC);
|
|
||||||
} while (++word != 4);
|
|
||||||
|
|
||||||
syntax_define (0, 1, 0, "()[]{}", "", '\0', TERMINAL_COLOUR_GREEN, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 1, 0, ".,:;<=>+-*/%!&~^", "", '\0', TERMINAL_COLOUR_BLUE, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 1, 1, "0123456789", separator, '\0', TERMINAL_COLOUR_CYAN, TERMINAL_EFFECT_BOLD);
|
|
||||||
syntax_define (0, 1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separator, '\0', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_ITALIC);
|
|
||||||
syntax_define (0, 1, 1, "abcdefghijklmnopqrstuvwxyz", separator, '\0', TERMINAL_COLOUR_WHITE, TERMINAL_EFFECT_ITALIC);
|
|
||||||
syntax_define (0, 0, 1, "_", separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_ITALIC);
|
|
||||||
|
|
||||||
buffer = realloc (buffer, ALLOCATION_CHUNK);
|
|
||||||
|
|
||||||
do {
|
|
||||||
if ((buffer_size + 1) % ALLOCATION_CHUNK == 0) {
|
|
||||||
buffer = realloc (buffer, (unsigned long int) ((buffer_size + 1) / ALLOCATION_CHUNK + 1) * ALLOCATION_CHUNK);
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer [buffer_size] = '\0';
|
|
||||||
|
|
||||||
(void) read (STDIN_FILENO, & buffer [buffer_size], sizeof (* buffer));
|
|
||||||
|
|
||||||
++buffer_size;
|
|
||||||
} while (buffer [buffer_size - 1] != '\0');
|
|
||||||
|
|
||||||
buffer [buffer_size - 1] = '\0';
|
|
||||||
|
|
||||||
do {
|
|
||||||
offset += syntax_output (& buffer [offset]);
|
|
||||||
} while (buffer [offset] != '\0');
|
|
||||||
|
|
||||||
free (buffer);
|
|
||||||
|
|
||||||
syntax_delete ();
|
|
||||||
|
|
||||||
return (EXIT_SUCCESS);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user