Fix couple of bugs show-opcodes: lexer should not dump lines, serializer must not rewrite a single opcode when dumping
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
static token saved_token;
|
||||
static token empty_token = { .type = TOK_EMPTY, .data.uid = 0 };
|
||||
static bool allow_dump_lines = false;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -93,6 +94,9 @@ dump_current_line (void)
|
||||
{
|
||||
const char *i;
|
||||
|
||||
if (!allow_dump_lines)
|
||||
return;
|
||||
|
||||
__printf ("// ");
|
||||
|
||||
for (i = buffer; *i != '\n' && *i != 0; i++)
|
||||
@@ -915,10 +919,11 @@ lexer_dump_buffer_state (void)
|
||||
}
|
||||
|
||||
void
|
||||
lexer_init( const char *source)
|
||||
lexer_init (const char *source, bool show_opcodes)
|
||||
{
|
||||
saved_token = empty_token;
|
||||
lexer_set_source( source);
|
||||
allow_dump_lines = show_opcodes;
|
||||
lexer_set_source (source);
|
||||
increase_strings_cache ();
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ typedef struct
|
||||
} __packed
|
||||
token;
|
||||
|
||||
void lexer_init(const char *);
|
||||
void lexer_init(const char *, bool);
|
||||
void lexer_free (void);
|
||||
void lexer_run_first_pass( void);
|
||||
token lexer_next_token (void);
|
||||
|
||||
Reference in New Issue
Block a user