Lexer is not collecting hanging new lines
This commit is contained in:
@@ -114,6 +114,7 @@ struct Lex_Stream{
|
||||
String file;
|
||||
S32 line;
|
||||
S32 inside_brace_paren;
|
||||
S32 last_valid_indent;
|
||||
};
|
||||
|
||||
struct Lexer{
|
||||
@@ -481,7 +482,11 @@ lex__stream(Intern_Table *table, Array<Token> *array, Lex_Stream *s){
|
||||
if(t.len==0)
|
||||
lex_set_len(s,&t);
|
||||
|
||||
B32 skip = t.kind == TK_NewLine && s->inside_brace_paren > 0;
|
||||
B32 skip = 0;
|
||||
if(t.kind == TK_NewLine){
|
||||
if(s->inside_brace_paren > 0) skip = 1;
|
||||
if(array->len > 0 && array->last()->kind == TK_NewLine) array->pop();
|
||||
}
|
||||
if(!skip){
|
||||
array->add(t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user