[script] Adds debug support source files

This commit is contained in:
Charlie Brej 2009-08-30 19:07:51 +01:00
parent 0b4bb63bae
commit 6be18908b2
5 changed files with 63 additions and 8 deletions

View file

@ -0,0 +1,22 @@
/* script-debug.h - Debug handling matching memory loaded data to source locations
*
* Copyright (C) 2009 Charlie Brej <cbrej@cs.man.ac.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
#include "script-debug.h"

View file

@ -0,0 +1,33 @@
/* script-debug.h - Debug handling matching memory loaded data to source locations
*
* Copyright (C) 2009 Charlie Brej <cbrej@cs.man.ac.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
#ifndef SCRIPT_DEBUG_H
#define SCRIPT_DEBUG_H
typedef struct
{
int line_index;
int column_index;
} script_debug_source_location_t;
#endif /* SCRIPT_DEBUG_H */

View file

@ -150,8 +150,8 @@ static void script_parse_error (script_scan_token_t *token,
const char *expected)
{
ply_error ("Parser error L:%d C:%d : %s\n",
token->line_index,
token->column_index,
token->location.line_index,
token->location.column_index,
expected);
}
@ -628,7 +628,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
ply_list_append_data (op_list, op_first);
ply_list_append_data (op_list, op_for);
script_op_t *op_block = script_parse_new_op_block (op_list)
script_op_t *op_block = script_parse_new_op_block (op_list);
return op_block;
}
@ -721,7 +721,7 @@ static script_op_t *script_parse_op (script_scan_t *scan)
curtoken = script_scan_get_next_token (scan);
#endif
script_op_t *op = script_parse_new_op_exp (exp)
script_op_t *op = script_parse_new_op_exp (exp);
return op;
}
return NULL;

View file

@ -171,8 +171,8 @@ void script_scan_read_next_token (script_scan_t *scan,
}
break;
}
token->line_index = scan->line_index;
token->column_index = scan->column_index;
token->location.line_index = scan->line_index;
token->location.column_index = scan->column_index;
nextchar = script_scan_get_next_char (scan);
if (ply_bitarray_lookup (scan->identifier_1st_char, curchar))

View file

@ -22,6 +22,7 @@
#ifndef script_scan_H
#define script_scan_H
#include "script-debug.h"
#include "ply-bitarray.h"
#include <stdbool.h>
@ -49,8 +50,7 @@ typedef struct
double floatpoint;
} data;
int whitespace;
int line_index;
int column_index;
script_debug_source_location_t location;
} script_scan_token_t;
typedef struct