Work on lambda body
This commit is contained in:
21
new_lex.cpp
21
new_lex.cpp
@@ -47,6 +47,8 @@ enum Token_Kind{
|
||||
TK_Dot,
|
||||
|
||||
TK_NewLine,
|
||||
TK_NewUpScope,
|
||||
TK_NewDownScope,
|
||||
TK_Colon,
|
||||
|
||||
TK_Assign,
|
||||
@@ -523,6 +525,17 @@ lex_restream(Lexer *lexer, String istream, String file){
|
||||
lexer->tokens.clear();
|
||||
lexer->token_iter = 0;
|
||||
lex__stream(&lexer->interns, &lexer->tokens, &lexer->stream);
|
||||
|
||||
S32 indent = 0;
|
||||
For(lexer->tokens){
|
||||
if(it->kind == TK_NewLine){
|
||||
if(it->indent > indent)
|
||||
it->kind = TK_NewUpScope;
|
||||
if(it->indent < indent)
|
||||
it->kind = TK_NewDownScope;
|
||||
indent = it->indent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Lexer
|
||||
@@ -640,17 +653,19 @@ token_kind_string(Token_Kind kind){
|
||||
case TK_LeftShift: return "<<"_s;
|
||||
case TK_RightShift: return ">>"_s;
|
||||
case TK_Arrow: return "->"_s;
|
||||
case TK_NewLine: return "NewLine"_s;
|
||||
case TK_NewLine: return "New_Line"_s;
|
||||
case TK_ExprSizeof: return "sizeof"_s;
|
||||
case TK_DocComment: return "DocComment"_s;
|
||||
case TK_DocComment: return "Doc_Comment"_s;
|
||||
case TK_Comment: return "Comment"_s;
|
||||
case TK_Identifier: return "Identifier"_s;
|
||||
case TK_StringLit: return "StringLit"_s;
|
||||
case TK_StringLit: return "String_Lit"_s;
|
||||
case TK_Character: return "Character"_s;
|
||||
case TK_Error: return "Error"_s;
|
||||
case TK_Float: return "Float"_s;
|
||||
case TK_Integer: return "Int"_s;
|
||||
case TK_Keyword: return "Keyword"_s;
|
||||
case TK_NewUpScope: return "New_Up_Scope"_s;
|
||||
case TK_NewDownScope: return "New_Down_Scope"_s;
|
||||
default: invalid_codepath; return "<Undefined>"_s;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user