Skip to content

Commit

Permalink
Reorder class member for better memory usage/alignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mingodad authored and Charles Baker committed Jul 16, 2023
1 parent a807827 commit 7f1ea72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lalr/ParserSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};

}
Expand Down
12 changes: 6 additions & 6 deletions src/lalr/lalrc/lalrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );

Expand Down

0 comments on commit 7f1ea72

Please sign in to comment.