Allocator logging
This commit is contained in:
18
new_lex.cpp
18
new_lex.cpp
@@ -138,7 +138,7 @@ lexcp(Lex_Stream *s){
|
||||
|
||||
function B32
|
||||
lex_is_whitespace(U8 c){
|
||||
B32 result = c == '\r' || c == ' ' || c == '\r';
|
||||
B32 result = c == ' ' || c == '\r';
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -263,8 +263,6 @@ break
|
||||
function void
|
||||
lex__stream(Intern_Table *table, Array<Token> *array, Lex_Stream *s){
|
||||
while(lexc(s)){
|
||||
while(lex_is_whitespace(lexc(s)))
|
||||
lex_advance(s);
|
||||
|
||||
Token t = {};
|
||||
t.str = lexcp(s);
|
||||
@@ -300,14 +298,18 @@ lex__stream(Intern_Table *table, Array<Token> *array, Lex_Stream *s){
|
||||
t.kind = TK_Semicolon;
|
||||
}break;
|
||||
|
||||
case ' ' : s->stream.str -= 1;
|
||||
case '\n': {
|
||||
t.kind = TK_NewLine;
|
||||
if(lexc(s) == '\r')
|
||||
lex_advance(s);
|
||||
|
||||
for(;;){
|
||||
if(lexc(s) == ' ') t.indent++;
|
||||
else if(lexc(s) == '\t') t.indent += 2;
|
||||
if(lexc(s) == ' ') {
|
||||
t.indent++;
|
||||
// @Todo(Krzosa): Detect indentation method, file an error while methods are mixed
|
||||
}
|
||||
else if(lexc(s) == '\t') t.indent++;
|
||||
else break;
|
||||
lex_advance(s);
|
||||
}
|
||||
@@ -482,6 +484,12 @@ lex__stream(Intern_Table *table, Array<Token> *array, Lex_Stream *s){
|
||||
lex_set_len(s,&t);
|
||||
|
||||
array->add(t);
|
||||
|
||||
while(lex_is_whitespace(lexc(s)))
|
||||
lex_advance(s);
|
||||
|
||||
if(s->iter >= s->stream.len) // End of stream
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user