Reorder class member for better memory usage/alignment.

This commit is contained in:
mingodad 2023-06-22 16:54:46 +02:00 • committed by Charles Baker
parent a807827db8
commit 7f1ea72807
2 changed files with 7 additions and 7 deletions

View file

@ -13,10 +13,10 @@ class ParserSymbol
{
public:
int index; ///< The index of this symbol.
SymbolType type; ///< The type of this symbol.
const char* identifier; ///< The identifier of this symbol.
const char* lexeme; ///< The lexeme of this symbol or null if this symbol is non-terminal.
const char* label; ///< The human-readable label for this symbol.
SymbolType type; ///< The type of this symbol.
};
}

View file

@ -296,15 +296,15 @@ void generate_cxx_parser_state_machine( const ParserStateMachine* state_machine
const ParserSymbol* symbols_end = symbols + state_machine->symbols_size;
for ( const ParserSymbol* symbol = symbols; symbol != symbols_end; ++symbol )
{
write( " {%d, \"%s\", \"%s\", \"%s\", (SymbolType) %d},\n",
symbol->index,
symbol->identifier,
write( " {%d, (SymbolType) %d, \"%s\", \"%s\", \"%s\"},\n",
symbol->index,
symbol->type,
symbol->identifier,
sanitize(symbol->lexeme).c_str(),
sanitize(symbol->label).c_str(),
symbol->type
sanitize(symbol->label).c_str()
);
}
write( " {-1, nullptr, nullptr, nullptr, (SymbolType) 0}\n" );
write( " {-1, (SymbolType) 0, nullptr, nullptr, nullptr}\n" );
write( "};\n" );
write( "\n" );