Improved main.c and syntax for the sake of the future children of the world
Removed division from get_stdin, and made it fail properly on failed allocation Fixed the retard brain #include syntax/c.h shit (god I hope I didn't break highlightlighting I'm not - I checked and it outputs the same under the last commit, it's probably fine anon'll fix it what a cuck) Much better input handling, properly using perror and handling multible files even under a noexist condition, probably fixed a seggy on noexist condition
This commit is contained in:
@ -1,23 +1,27 @@
|
||||
const char * c_keywords[] = {
|
||||
"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",
|
||||
NULL
|
||||
};
|
||||
void
|
||||
highlight_c(void)
|
||||
{
|
||||
const char * c_keywords[] = {
|
||||
"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",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char * preprocessor_keywords[] = {
|
||||
"#include", "#pragma", "#define", "#undef", "#ifdef", "#ifndef", "#elifdef", "#elifndef",
|
||||
"#if", "#elif", "#else", "#endif", "#embed", "#line", "#error", "#warning",
|
||||
NULL
|
||||
};
|
||||
const char * preprocessor_keywords[] = {
|
||||
"#include", "#pragma", "#define", "#undef", "#ifdef", "#ifndef", "#elifdef", "#elifndef",
|
||||
"#if", "#elif", "#else", "#endif", "#embed", "#line", "#error", "#warning",
|
||||
NULL
|
||||
};
|
||||
|
||||
new_char_tokens("+-&|.()[]{}", operator_hl);
|
||||
new_keyword_tokens(c_keywords, control_hl);
|
||||
new_keyword_tokens(preprocessor_keywords, special_hl);
|
||||
new_region_token("/\\*", "\\*/", comment_hl);
|
||||
new_region_token("//", "\\n", comment_hl);
|
||||
new_region_token("\"", "\"", string_literal_hl);
|
||||
new_region_token("<", ">", string_literal_hl);
|
||||
new_keyword_token("keyword", special_hl);
|
||||
new_keyword_token("while", operator_hl);
|
||||
new_char_tokens("+-&|.()[]{}", operator_hl);
|
||||
new_keyword_tokens(c_keywords, control_hl);
|
||||
new_keyword_tokens(preprocessor_keywords, special_hl);
|
||||
new_region_token("/\\*", "\\*/", comment_hl);
|
||||
new_region_token("//", "\\n", comment_hl);
|
||||
new_region_token("\"", "\"", string_literal_hl);
|
||||
new_region_token("<", ">", string_literal_hl);
|
||||
new_keyword_token("keyword", special_hl);
|
||||
new_keyword_token("while", operator_hl);
|
||||
}
|
||||
|
6
include/syntax/syntax.h
Normal file
6
include/syntax/syntax.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef SYNTAX_H_
|
||||
|
||||
#include "c.h"
|
||||
|
||||
#define SYNTAX_H_
|
||||
#endif
|
Reference in New Issue
Block a user