mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Add support for source properties on non-immediate numbers
* libguile/read.c (scm_read_number): Set source properties on non-immediate numbers if the 'positions' reader option is set. * doc/ref/api-debug.texi (Source Properties): Update manual.
This commit is contained in:
parent
32fbc38fbb
commit
38f190749d
2 changed files with 9 additions and 3 deletions
|
@ -239,8 +239,8 @@ Guile's debugger can point back to the file and location where the
|
|||
expression originated.
|
||||
|
||||
The way that source properties are stored means that Guile cannot
|
||||
associate source properties with individual numbers, symbols,
|
||||
characters, booleans, or keywords. This can be seen by typing
|
||||
associate source properties with individual symbols, keywords,
|
||||
characters, booleans, or small integers. This can be seen by typing
|
||||
@code{(xxx)} and @code{xxx} at the Guile prompt (where the variable
|
||||
@code{xxx} has not been defined):
|
||||
|
||||
|
|
|
@ -600,6 +600,10 @@ scm_read_number (scm_t_wchar chr, SCM port)
|
|||
int overflow;
|
||||
scm_t_port *pt = SCM_PTAB_ENTRY (port);
|
||||
|
||||
/* Need to capture line and column numbers here. */
|
||||
long line = SCM_LINUM (port);
|
||||
int column = SCM_COL (port) - 1;
|
||||
|
||||
scm_ungetc (chr, port);
|
||||
overflow = read_complete_token (port, buffer, sizeof (buffer),
|
||||
&overflow_buffer, &bytes_read);
|
||||
|
@ -611,13 +615,15 @@ scm_read_number (scm_t_wchar chr, SCM port)
|
|||
pt->ilseq_handler);
|
||||
|
||||
result = scm_string_to_number (str, SCM_UNDEFINED);
|
||||
if (!scm_is_true (result))
|
||||
if (scm_is_false (result))
|
||||
{
|
||||
/* Return a symbol instead of a number */
|
||||
if (SCM_CASE_INSENSITIVE_P)
|
||||
str = scm_string_downcase_x (str);
|
||||
result = scm_string_to_symbol (str);
|
||||
}
|
||||
else if (SCM_NIMP (result))
|
||||
result = maybe_annotate_source (result, port, line, column);
|
||||
|
||||
if (overflow)
|
||||
free (overflow_buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue