Fix memory corruptions in lexer, which occured while parsing cse.js; remove lexer.log and parser.log files
This commit is contained in:
+1
-20
@@ -88,7 +88,7 @@ num_and_token;
|
||||
#define MAX_NAMES 100
|
||||
#define MAX_NUMS 25
|
||||
|
||||
static string_and_token seen_names[MAX_NUMS];
|
||||
static string_and_token seen_names[MAX_NAMES];
|
||||
static uint8_t seen_names_count = 0;
|
||||
|
||||
static num_and_token seen_nums[MAX_NAMES] =
|
||||
@@ -112,7 +112,6 @@ static const char *token_start;
|
||||
#define LA(I) (*(buffer + I))
|
||||
|
||||
#ifdef __HOST
|
||||
_FILE *lexer_debug_log;
|
||||
|
||||
static void
|
||||
dump_current_line (void)
|
||||
@@ -816,10 +815,6 @@ lexer_next_token_private (void)
|
||||
parser_fatal (ERR_NON_CHAR);
|
||||
}
|
||||
|
||||
#ifdef __HOST
|
||||
static int i = 0;
|
||||
#endif /* __HOST */
|
||||
|
||||
token
|
||||
lexer_next_token (void)
|
||||
{
|
||||
@@ -836,12 +831,6 @@ lexer_next_token (void)
|
||||
dump_current_line ();
|
||||
return tok;
|
||||
}
|
||||
if (tok.type == TOK_CLOSE_BRACE)
|
||||
{
|
||||
// if (i == 300)
|
||||
__fprintf (lexer_debug_log, "lexer_next_token(%d): type=%d, data=%d\n", i, tok.type, tok.data.uid);
|
||||
i++;
|
||||
}
|
||||
#endif /* __HOST */
|
||||
return tok;
|
||||
}
|
||||
@@ -849,10 +838,6 @@ lexer_next_token (void)
|
||||
void
|
||||
lexer_save_token (token tok)
|
||||
{
|
||||
#ifdef __HOST
|
||||
if (tok.type == TOK_CLOSE_BRACE)
|
||||
__fprintf (lexer_debug_log, "lexer_save_token(%d): type=%d, data=%d\n", i, tok.type, tok.data.uid);
|
||||
#endif /* __HOST */
|
||||
saved_token = tok;
|
||||
}
|
||||
|
||||
@@ -867,10 +852,6 @@ lexer_init( const char *source)
|
||||
{
|
||||
saved_token = empty_token;
|
||||
lexer_set_source( source);
|
||||
|
||||
#ifdef __HOST
|
||||
lexer_debug_log = __fopen ("lexer.log", "w");
|
||||
#endif /* __HOST */
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -27,10 +27,6 @@ static OPCODE opcode;
|
||||
static T_IDX opcode_counter = 0;
|
||||
static T_IDX temp_name_stack[MAX_OPCODES], temp_name_stack_head = 0, max_temp_name;
|
||||
|
||||
#ifdef __HOST
|
||||
_FILE *debug_file;
|
||||
#endif
|
||||
|
||||
static T_IDX parse_expression (void);
|
||||
static void parse_statement (void);
|
||||
static T_IDX parse_assignment_expression (void);
|
||||
@@ -147,13 +143,13 @@ insert_semicolon (void)
|
||||
do { skip_newlines (); ID = parse_##TYPE (); } while (0)
|
||||
|
||||
#define DUMP_VOID_OPCODE(GETOP) \
|
||||
do { opcode=getop_##GETOP (); serializer_dump_opcode (&opcode); opcode_counter++; } while (0)
|
||||
do { opcode=getop_##GETOP (); serializer_dump_opcode (opcode); opcode_counter++; } while (0)
|
||||
|
||||
#define DUMP_OPCODE(GETOP, ...) \
|
||||
do { opcode=getop_##GETOP (__VA_ARGS__); serializer_dump_opcode (&opcode); opcode_counter++; } while (0)
|
||||
do { opcode=getop_##GETOP (__VA_ARGS__); serializer_dump_opcode (opcode); opcode_counter++; } while (0)
|
||||
|
||||
#define REWRITE_OPCODE(OC, GETOP, ...) \
|
||||
do { opcode=getop_##GETOP (__VA_ARGS__); serializer_rewrite_opcode (OC, &opcode); } while (0)
|
||||
do { opcode=getop_##GETOP (__VA_ARGS__); serializer_rewrite_opcode (OC, opcode); } while (0)
|
||||
|
||||
static T_IDX
|
||||
integer_zero (void)
|
||||
@@ -1835,9 +1831,6 @@ void
|
||||
parser_init (void)
|
||||
{
|
||||
max_temp_name = temp_name = min_temp_name = lexer_get_reserved_ids_count ();
|
||||
#ifdef __HOST
|
||||
debug_file = __fopen ("parser.log", "w");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user