mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +02:00
Add and use maybe_annotate_source helper in read.c
* libguile/read.c (maybe_annotate_source): New static helper function. (scm_read_sexp, scm_read_quote, scm_read_syntax): Use 'maybe_annotate_source'.
This commit is contained in:
parent
cfd15439b2
commit
d6cb0203cb
1 changed files with 11 additions and 12 deletions
|
@ -359,6 +359,14 @@ static SCM scm_read_expression (SCM port);
|
||||||
static SCM scm_read_sharp (int chr, SCM port);
|
static SCM scm_read_sharp (int chr, SCM port);
|
||||||
|
|
||||||
|
|
||||||
|
static SCM
|
||||||
|
maybe_annotate_source (SCM x, SCM port, long line, int column)
|
||||||
|
{
|
||||||
|
if (SCM_RECORD_POSITIONS_P)
|
||||||
|
scm_i_set_source_properties_x (x, line, column, SCM_FILENAME (port));
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
scm_read_sexp (scm_t_wchar chr, SCM port)
|
scm_read_sexp (scm_t_wchar chr, SCM port)
|
||||||
#define FUNC_NAME "scm_i_lreadparen"
|
#define FUNC_NAME "scm_i_lreadparen"
|
||||||
|
@ -423,10 +431,7 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (SCM_RECORD_POSITIONS_P)
|
return maybe_annotate_source (ans, port, line, column);
|
||||||
scm_i_set_source_properties_x (ans, line, column, SCM_FILENAME (port));
|
|
||||||
|
|
||||||
return ans;
|
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -780,10 +785,7 @@ scm_read_quote (int chr, SCM port)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = scm_cons2 (p, scm_read_expression (port), SCM_EOL);
|
p = scm_cons2 (p, scm_read_expression (port), SCM_EOL);
|
||||||
if (SCM_RECORD_POSITIONS_P)
|
return maybe_annotate_source (p, port, line, column);
|
||||||
scm_i_set_source_properties_x (p, line, column, SCM_FILENAME (port));
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM_SYMBOL (sym_syntax, "syntax");
|
SCM_SYMBOL (sym_syntax, "syntax");
|
||||||
|
@ -830,10 +832,7 @@ scm_read_syntax (int chr, SCM port)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = scm_cons2 (p, scm_read_expression (port), SCM_EOL);
|
p = scm_cons2 (p, scm_read_expression (port), SCM_EOL);
|
||||||
if (SCM_RECORD_POSITIONS_P)
|
return maybe_annotate_source (p, port, line, column);
|
||||||
scm_i_set_source_properties_x (p, line, column, SCM_FILENAME (port));
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue