Fix some bugs in lexer

This commit is contained in:
Ilmir Usmanov 2014-08-01 15:24:48 +04:00
parent dd5f90d50f
commit d15cf8f436
2 changed files with 5 additions and 3 deletions

View File

@ -56,7 +56,7 @@ static const char *token_start;
static char static char
get_char (size_t i) get_char (size_t i)
{ {
JERRY_ASSERT (i < buffer_size); JERRY_ASSERT ((buffer + i) < (buffer_start + buffer_size));
return *(buffer + i); return *(buffer + i);
} }
@ -950,4 +950,6 @@ void
lexer_free (void) lexer_free (void)
{ {
mem_heap_free_block ((uint8_t *) strings_cache); mem_heap_free_block ((uint8_t *) strings_cache);
strings_cache = NULL;
strings_cache_size = 0;
} }

View File

@ -52,11 +52,11 @@ parser_run (const char *script_source, size_t script_source_size, bool is_show_o
offset = serializer_dump_strings (strings, strings_num); offset = serializer_dump_strings (strings, strings_num);
serializer_dump_nums (nums, nums_count, offset, strings_num); serializer_dump_nums (nums, nums_count, offset, strings_num);
lexer_free ();
parser_init (); parser_init ();
parser_parse_program (); parser_parse_program ();
lexer_free ();
opcodes = deserialize_bytecode (); opcodes = deserialize_bytecode ();
optimizer_run_passes ((OPCODE *) opcodes); optimizer_run_passes ((OPCODE *) opcodes);