More formatting fixes

This commit is contained in:
Edward R. Gonzalez 2023-08-22 02:09:20 -04:00
parent c4846dad26
commit a6c6574390
3 changed files with 29 additions and 15 deletions

View File

@ -136,7 +136,7 @@ int gen_main()
header.print( interface ); header.print( interface );
header.print_fmt( "\npragma region Inlines\n" ); header.print_fmt( "\n#pragma region Inlines\n" );
header.print( inlines ); header.print( inlines );
header.print( fmt_newline ); header.print( fmt_newline );
header.print( ast_inlines ); header.print( ast_inlines );

View File

@ -255,6 +255,25 @@ namespace Parser
move_forward(); \ move_forward(); \
} }
#define end_line() \
do \
{ \
while ( left && current == ' ' ) \
{ \
move_forward(); \
} \
if ( left && current == '\r' ) \
{ \
move_forward(); \
move_forward(); \
} \
else if ( left && current == '\n' ) \
{ \
move_forward(); \
} \
} \
while (0)
s32 left = content.Len; s32 left = content.Len;
char const* scanner = content.Ptr; char const* scanner = content.Ptr;
@ -303,7 +322,6 @@ namespace Parser
token.Length++; token.Length++;
Tokens.append( token ); Tokens.append( token );
// log_fmt( "NewLine: %d\n", token.Line );
continue; continue;
} }
} }
@ -401,11 +419,7 @@ namespace Parser
if ( token.Type == TokType::Preprocess_Else || token.Type == TokType::Preprocess_EndIf ) if ( token.Type == TokType::Preprocess_Else || token.Type == TokType::Preprocess_EndIf )
{ {
Tokens.append( token ); Tokens.append( token );
while ( left && current != '\n' ) end_line();
{
move_forward();
}
move_forward();
continue; continue;
} }
@ -611,6 +625,8 @@ namespace Parser
if (left) if (left)
move_forward(); move_forward();
end_line();
goto FoundToken; goto FoundToken;
case '[': case '[':
@ -714,6 +730,8 @@ namespace Parser
if (left) if (left)
move_forward(); move_forward();
end_line();
goto FoundToken; goto FoundToken;
case '"': case '"':
@ -915,11 +933,7 @@ namespace Parser
move_forward(); move_forward();
move_forward(); move_forward();
while ( left && current != '\n' ) end_line();
{
move_forward();
}
move_forward();
continue; continue;
} }
} }

View File

@ -215,7 +215,7 @@ int gen_main()
CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" ); CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" );
CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
header.print_fmt( "\njGEN_NS_BEGIN\n"); header.print_fmt( "\nGEN_NS_BEGIN\n");
header.print( static_data ); header.print( static_data );
header.print_fmt( "#pragma region AST\n\n" ); header.print_fmt( "#pragma region AST\n\n" );
@ -229,7 +229,7 @@ int gen_main()
header.print_fmt( "\n#pragma region Parsing\n\n" ); header.print_fmt( "\n#pragma region Parsing\n\n" );
header.print( parser_nspace ); header.print( parser_nspace );
header.print( parsing ); header.print( parsing );
header.print_fmt( "\npragma endregion Parsing\n" ); header.print_fmt( "\n#pragma endregion Parsing\n" );
header.print( untyped ); header.print( untyped );
header.print_fmt( "\n#pragma endregion Interface\n\n"); header.print_fmt( "\n#pragma endregion Interface\n\n");
@ -237,7 +237,7 @@ int gen_main()
{ {
header.print_fmt( "#pragma region Builder\n" ); header.print_fmt( "#pragma region Builder\n" );
header.print( scan_file( project_dir "auxillary/builder.cpp" ) ); header.print( scan_file( project_dir "auxillary/builder.cpp" ) );
header.print_fmt( "\npragma endregion Builder\n\n" ); header.print_fmt( "\n#pragma endregion Builder\n\n" );
} }
#if 0 #if 0