Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder class member for better memory usage/alignment. #45

Merged
merged 1 commit into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading