Added .clang-format.
This commit is contained in:
parent
53c303095d
commit
aae8402403
12
.clang-format
Normal file
12
.clang-format
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AlignConsecutiveShortCaseStatements:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: true
|
||||||
|
AcrossComments: true
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
IndentWidth: 4
|
||||||
|
PointerAlignment: Left
|
22
src/lexer.c
22
src/lexer.c
@ -14,30 +14,20 @@ Lexer* lexer_init(char* src) {
|
|||||||
return lexer;
|
return lexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lexer_destroy(Lexer *lexer) {
|
void lexer_destroy(Lexer* lexer) {
|
||||||
free(lexer->src);
|
free(lexer->src);
|
||||||
|
|
||||||
for (
|
for (int i = 0; i < lexer->ntokens; token_destroy(lexer->tokens[i++]));
|
||||||
int i = 0;
|
|
||||||
i < lexer->ntokens;
|
|
||||||
token_destroy(lexer->tokens[i++])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lexer_do_confused(Lexer *lexer) {
|
void lexer_do_confused(Lexer* lexer) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void lexer_lex(Lexer* lexer) {
|
void lexer_lex(Lexer* lexer) {
|
||||||
while (*lexer->cchar) {
|
while (*lexer->cchar) {
|
||||||
switch (lexer->state) {
|
switch (lexer->state) {
|
||||||
case LEXER_STATE_CONFUSED:
|
case LEXER_STATE_CONFUSED: lexer_do_confused(lexer); break;
|
||||||
lexer_do_confused(lexer);
|
case LEXER_STATE_NUM: lexer_do_number(lexer); break;
|
||||||
break; case LEXER_STATE_NUM:
|
case LEXER_STATE_CALL: lexer_do_call(lexer); break;
|
||||||
lexer_do_number(lexer);
|
|
||||||
break; case LEXER_STATE_CALL:
|
|
||||||
lexer_do_call(lexer);
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user