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:
Ilmir Usmanov
2014-07-31 21:09:42 +04:00
parent 0d1935e3a8
commit 14f0563d1a
4 changed files with 14 additions and 8 deletions
+7 -2
View File
@@ -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 ();
}
+1 -1
View File
@@ -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);