Use verbose error messages
parent
94e9641264
commit
13e72f4c98
|
@ -194,7 +194,7 @@ ms_lex_parse_number (MSLex *lex,
|
||||||
{
|
{
|
||||||
if (value > 1000000)
|
if (value > 1000000)
|
||||||
{
|
{
|
||||||
g_warning ("number is too big");
|
g_print ("syntax error, number is too big\n", G_STRLOC);
|
||||||
return ms_lex_error (parser);
|
return ms_lex_error (parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ ms_lex_parse_number (MSLex *lex,
|
||||||
}
|
}
|
||||||
else if (IS_WORD (c))
|
else if (IS_WORD (c))
|
||||||
{
|
{
|
||||||
g_warning ("number followed by word char");
|
g_print ("syntax error, number followed by word char\n", G_STRLOC);
|
||||||
return ms_lex_error (parser);
|
return ms_lex_error (parser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -213,8 +213,8 @@ ms_lex_parse_number (MSLex *lex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_critical ("oops");
|
_ms_script_yylval.ival = value;
|
||||||
return ms_lex_error (parser);
|
return NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void
|
||||||
_ms_script_yyerror (MSParser *parser,
|
_ms_script_yyerror (MSParser *parser,
|
||||||
const char *string)
|
const char *string)
|
||||||
{
|
{
|
||||||
g_print ("error: %s\n", string);
|
g_print ("%s\n", string);
|
||||||
parser->failed = TRUE;
|
parser->failed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -492,7 +492,7 @@ node_dict_assign (MSParser *parser,
|
||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE 0
|
# define YYERROR_VERBOSE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
|
@ -501,7 +501,7 @@ node_dict_assign (MSParser *parser,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
#line 360 "/home/muntyan/projects/moo/moo/mooutils/mooscript/mooscript-yacc.y"
|
#line 364 "/home/muntyan/projects/moo/moo/mooutils/mooscript/mooscript-yacc.y"
|
||||||
typedef union YYSTYPE {
|
typedef union YYSTYPE {
|
||||||
int ival;
|
int ival;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
#line 360 "/home/muntyan/projects/moo/moo/mooutils/mooscript/mooscript-yacc.y"
|
#line 364 "/home/muntyan/projects/moo/moo/mooutils/mooscript/mooscript-yacc.y"
|
||||||
typedef union YYSTYPE {
|
typedef union YYSTYPE {
|
||||||
int ival;
|
int ival;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
|
@ -356,6 +356,10 @@ node_dict_assign (MSParser *parser,
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%name-prefix="_ms_script_yy"
|
%name-prefix="_ms_script_yy"
|
||||||
|
%error-verbose
|
||||||
|
%lex-param {MSParser *parser}
|
||||||
|
%parse-param {MSParser *parser}
|
||||||
|
/* %expect 1 */
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
int ival;
|
int ival;
|
||||||
|
@ -382,10 +386,6 @@ node_dict_assign (MSParser *parser,
|
||||||
%token UMINUS
|
%token UMINUS
|
||||||
%token TWODOTS
|
%token TWODOTS
|
||||||
|
|
||||||
%lex-param {MSParser *parser}
|
|
||||||
%parse-param {MSParser *parser}
|
|
||||||
/* %expect 1 */
|
|
||||||
|
|
||||||
%left '-' '+'
|
%left '-' '+'
|
||||||
%left '*' '/'
|
%left '*' '/'
|
||||||
%left '%'
|
%left '%'
|
||||||
|
|
|
@ -54,10 +54,7 @@ static int run_interactive (void)
|
||||||
free (line);
|
free (line);
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
|
||||||
g_print ("syntax error\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
val = ms_top_node_eval (node, ctx);
|
val = ms_top_node_eval (node, ctx);
|
||||||
ms_node_unref (node);
|
ms_node_unref (node);
|
||||||
|
@ -92,6 +89,21 @@ int main (int argc, char *argv[])
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
ms_type_init ();
|
ms_type_init ();
|
||||||
|
|
||||||
|
if (argc > 1 && !strcmp (argv[1], "--g-fatal-warnings"))
|
||||||
|
{
|
||||||
|
GLogLevelFlags fatal_mask;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||||
|
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||||
|
g_log_set_always_fatal (fatal_mask);
|
||||||
|
|
||||||
|
for (i = 1; i < argc - 1; ++i)
|
||||||
|
argv[i] = argv[i+1];
|
||||||
|
argv[argc-1] = NULL;
|
||||||
|
argc -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return run_interactive ();
|
return run_interactive ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue