Dump script line before bytecode (Only on host). Fix parsing literals: assing literal to temp before usage.

This commit is contained in:
Ilmir Usmanov
2014-07-23 18:43:03 +04:00
parent d57da2aa8a
commit e5cdf93d2d
3 changed files with 40 additions and 12 deletions
+19 -1
View File
@@ -178,6 +178,16 @@ get_char (size_t i)
#define LA(I) (get_char (I))
static void
dump_current_line (void)
{
const char *i;
for (i = buffer; *i != '\n' && *i != 0; i++)
__putchar (*i);
__putchar ('\n');
}
#else
/* Represents the contents of a file. */
@@ -898,9 +908,17 @@ static int i = 0;
token
lexer_next_token (void)
{
LA (0); // Init buffers
if (buffer == buffer_start)
dump_current_line ();
token tok = lexer_next_token_private ();
if (tok.type == TOK_NEWLINE)
return tok;
{
dump_current_line ();
return tok;
}
if (tok.type == TOK_CLOSE_BRACE)
{
// if (i == 300)