[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01-cleanup.patch
From: |
Akim Demaille |
Subject: |
01-cleanup.patch |
Date: |
Mon, 21 Oct 2002 09:23:15 +0200 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/getargs.h (trace_e): Add trace_scan, and trace_parse.
* src/getargs.c (trace_types, trace_args): Adjust.
* src/reader.c (grammar_current_rule_prec_set)
(grammar_current_rule_dprec_set, grammar_current_rule_merge_set):
Standardize error messages.
And s/@prec/%prec/!
(reader): Use trace_flag to enable scanner/parser debugging,
instead of an adhoc scheme.
* src/scan-gram.l: Remove trailing debugging code.
Index: src/getargs.c
--- src/getargs.c Wed, 31 Jul 2002 21:42:03 +0200 akim
+++ src/getargs.c Thu, 17 Oct 2002 09:26:49 +0200 akim
@@ -52,6 +52,8 @@
/* In a series of synonyms, present the most meaningful first, so
that argmatch_valid be more readable. */
"none - no report",
+ "scan - scanner traces",
+ "parse - parser traces",
"automaton - contruction of the automaton",
"bitsets - use of bitsets",
"grammar - reading, reducing of the grammar",
@@ -66,6 +68,8 @@
static const int trace_types[] =
{
trace_none,
+ trace_scan,
+ trace_parse,
trace_automaton,
trace_bitsets,
trace_grammar,
Index: src/getargs.h
--- src/getargs.h Wed, 31 Jul 2002 21:42:03 +0200 akim
+++ src/getargs.h Thu, 17 Oct 2002 09:27:36 +0200 akim
@@ -39,13 +39,15 @@
enum trace_e
{
trace_none = 0,
- trace_resource = 1 << 0,
- trace_sets = 1 << 1,
- trace_bitsets = 1 << 2,
- trace_tools = 1 << 3,
- trace_automaton = 1 << 4,
- trace_grammar = 1 << 5,
- trace_time = 1 << 6,
+ trace_scan = 1 << 0,
+ trace_parse = 1 << 1,
+ trace_resource = 1 << 2,
+ trace_sets = 1 << 3,
+ trace_bitsets = 1 << 4,
+ trace_tools = 1 << 5,
+ trace_automaton = 1 << 6,
+ trace_grammar = 1 << 7,
+ trace_time = 1 << 8,
trace_all = ~0
};
extern int trace_flag;
Index: src/reader.c
--- src/reader.c Sun, 13 Oct 2002 10:01:29 +0200 akim
+++ src/reader.c Thu, 17 Oct 2002 09:28:20 +0200 akim
@@ -341,7 +341,7 @@
grammar_current_rule_prec_set (symbol_t *precsym, location_t location)
{
if (current_rule->ruleprec)
- complain_at (location, _("two @prec's in a row"));
+ complain_at (location, _("only one %s allowed per rule"), "%prec");
current_rule->ruleprec = precsym;
}
@@ -351,11 +351,12 @@
grammar_current_rule_dprec_set (int dprec, location_t location)
{
if (! glr_parser)
- warn_at (location, _("%%dprec affects only GLR parsers"));
+ warn_at (location, _("%s affects only GLR parsers"), "%dprec");
if (dprec <= 0)
- complain_at (location, _("%%dprec must be followed by positive number"));
+ complain_at (location,
+ _("%s must be followed by positive number"), "%dprec");
else if (current_rule->dprec != 0)
- complain_at (location, _("only one %%dprec allowed per rule"));
+ complain_at (location, _("only one %s allowed per rule"), "%dprec");
current_rule->dprec = dprec;
}
@@ -366,9 +367,9 @@
grammar_current_rule_merge_set (const char* name, location_t location)
{
if (! glr_parser)
- warn_at (location, _("%%merge affects only GLR parsers"));
+ warn_at (location, _("%s affects only GLR parsers"), "%merge");
if (current_rule->merger != 0)
- complain_at (location, _("only one %%merge allowed per rule"));
+ complain_at (location, _("only one %s allowed per rule"), "%merge");
current_rule->merger =
get_merge_function (name, current_rule->sym->type_name, location);
}
@@ -499,8 +500,8 @@
finput = xfopen (infile, "r");
gram_in = finput;
- gram_debug = !!getenv ("parse");
- gram__flex_debug = !!getenv ("scan");
+ gram__flex_debug = trace_flag & trace_scan;
+ gram_debug = trace_flag & trace_parse;
scanner_initialize ();
gram_parse (&gram_control);
Index: src/scan-gram.l
--- src/scan-gram.l Sun, 13 Oct 2002 16:57:14 +0200 akim
+++ src/scan-gram.l Thu, 17 Oct 2002 09:14:32 +0200 akim
@@ -107,18 +107,7 @@
%{
/* At each yylex invocation, mark the current position as the
start of the next token. */
-#define TR_POS 0
-#if TR_POS
- fprintf (stderr, "FOO1: %p: ", yylloc);
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, "\n");
-#endif
YY_STEP;
-#if TR_POS
- fprintf (stderr, "BAR1: ");
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, "\n");
-#endif
%}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 01-cleanup.patch,
Akim Demaille <=