1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

35 commits

Author SHA1 Message Date
Maxime Devos
c78c130b1d ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation
of a Guile library.

* module/ice-9/read.scm
  (%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't
  #\#, don't eat CH.
* test-suite/tests/reader.test
  ("#{}#): Add four test cases.
2021-08-02 12:15:59 +02:00
Andy Wingo
3383a2cb10 Fix bug for read-syntax on ( . args)
* module/ice-9/boot-9.scm: Capture syntax?.
* module/ice-9/read.scm (read-syntax): Avoid re-annotating objects.
* test-suite/tests/reader.test ("read-syntax"): Add test.
2021-05-01 20:43:07 +02:00
Andy Wingo
7da831af18 Fix line and column for read errors
* module/ice-9/read.scm (%read): Add 1 to both line and column: the
former to make 1-based user lines instead of 0-based Guile lines, and
the latter because apparently that's how we always did it :)  Fixes
2021-04-29 21:46:31 +02:00
Andy Wingo
cad6094cbc Fix reading #!!#
* module/ice-9/read.scm (%read): Fix reading #!!#.
* test-suite/tests/reader.test ("reading"): Add some test cases.
2021-03-07 20:17:58 +01:00
Michael Gran
1114122fbb tweak unknown hash object error in reader
This makes it match the other species of unknown hash object error
when reading number with radix.

* module/ice-9/read.scm (read-sharp): modified
2021-03-05 22:33:20 -08:00
Michael Gran
d6753e5af5 print token in error msg for unknown hash object
* module/ice-9/read.scm (read-number-and-radix): modified
2021-03-05 22:26:00 -08:00
Michael Gran
1ae9a8df3a Handle <eof> in reader's character escape sequences
* module/ice-9/read.scm (read-r6rs-hex-escape, read-fixed-hex-escape):
    modified
2021-03-05 22:24:40 -08:00
Andy Wingo
9fb550b945 Fix reading "#;", "'", and similar premature-EOF situations
* module/ice-9/read.scm (%read): Adjust how subexpressions are read to
error on EOF.  Improve the error message.
* test-suite/tests/reader.test ("#;"): Adapt expectation.
2021-03-05 21:06:04 +01:00
Andy Wingo
9897650f7a Fix reading of #true / #false
* module/ice-9/read.scm (%read): Fix bad argument order to unread-char.
2021-03-05 20:44:58 +01:00
Andy Wingo
d904392885 Fix reading improper curly-infix expressions
* module/ice-9/read.scm (%read): A fix to last night's fix, to make
srfi-105.test pass.
2021-03-04 12:40:14 +01:00
Andy Wingo
eb5ffda6ce Fix reading #c32 vectors
* module/ice-9/read.scm (%read): Fix a wee typo.
2021-03-03 22:59:27 +01:00
Andy Wingo
ea86a5c6d2 Fix some srfi-105 parsing errors
* module/ice-9/read.scm (%read): Fix parsing errors.
2021-03-03 22:56:58 +01:00
Andy Wingo
94279414a8 Fix length of \U hex escape in new reader
* module/ice-9/read.scm (%read): \U escape is 6 digits long.
2021-03-03 22:44:30 +01:00
Daniel Llorens
9516a10ab3 Fix bug in new array reader
* module/ice-9/read.scm (read-array): Return pair for dimension when len
  is given; single number is lbnd for list->typed-array.
* test-suite/tests/arrays.test: More test cases for the reader.
2021-03-03 18:40:39 +01:00
Andy Wingo
8edf1dc623 Read-in-scheme replaces boot "read" definition
Instead of defining a separate module, given that "read" calls are quite
all over the place, we're just going to replace the boot "read" binding
with read.scm.  This way, we'll be able to remove support for reader
options in the boot reader, as it will only ever be used for a finite
set of files.

* NEWS: Update.
* module/Makefile.am (ice-9/boot-9.go): Depend on read.scm.
(SOURCES):
* am/bootstrap.am (SOURCES): Don't build a ice-9/read.go, as we include
it.
* module/ice-9/boot-9.scm (read-syntax): Define here, as "include" now
uses it.
(read-hash-procedures, read-hash-procedure, read-hash-extend): New
procedures.  Will replace C variants.
(read, read-syntax): Include read.scm to define these.
* module/ice-9/psyntax-pp.scm (include): Regenerate.
* module/ice-9/psyntax.scm (include): Use read-syntax, so we get better
source information.
* module/ice-9/read.scm (let*-values): New local definition, to avoid
loading srfi-11.
(%read): Use list->typed-array instead of u8-list->bytevector.
* module/language/scheme/spec.scm: Remove (ice-9 read) import;
read-syntax is there in the boot environment
2021-03-03 17:08:55 +01:00
Andy Wingo
079800d682 Fix unterminated #!...!# error message in Scheme reader
* module/ice-9/read.scm (%read): Tweak "unterminated block constant"
error to be more compatible with C reader.
2021-03-03 16:22:56 +01:00
Andy Wingo
dba7669077 Fix reading neoteric exprs in Scheme reader
* module/ice-9/read.scm (%read): Call the inner reader, not the outer
reader.
2021-03-03 16:22:56 +01:00
Andy Wingo
816c8d23a1 Fix reader extensions in Scheme reader
* module/ice-9/read.scm (%read): Fix invocation of hash procedure.
2021-03-03 16:22:56 +01:00
Andy Wingo
c802ed4832 Remove textual-ports include from (ice-9 read)
* module/ice-9/read.scm: We'll be loading this file early, so avoid
extraneous deps.
2021-03-03 15:08:10 +01:00
Daniel Llorens
a4a5fbced3 Fix another typo in routine reading arrays
* module/ice-9/read.scm: As stated.
* test-suite/tests/arrays.test: Test a fixed case.
2021-03-02 15:12:20 +01:00
Andy Wingo
d69062daf1 Fix bug reading arrays with lengths
* module/ice-9/read.scm (%read): Fix typo.
2021-03-02 14:29:34 +01:00
Andy Wingo
93b82fca20 Fix Scheme read without source positions
* module/ice-9/read.scm (read): Fix annotate when positions are
disabled.
2021-02-28 20:54:40 +01:00
Andy Wingo
6c57b2af79 read-syntax uses vector source representation
* module/ice-9/read.scm (read-syntax): Switch to sourcev format.
2021-02-25 21:26:17 +01:00
Andy Wingo
a758ba075a Fix read-syntax on vectors and arrays
* module/ice-9/read.scm (%read): Strip annotations from reading
the array elements.
2021-02-25 16:07:47 +01:00
Andy Wingo
a04a024f20 Implement read-syntax
* doc/ref/api-macros.texi (Syntax Case): Update documentation for
  datum->syntax.
* module/ice-9/psyntax.scm (datum->syntax): Use #:source keyword for
  source location info instead of an optional, and allow an alist.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/read.scm (%read, read): Refactor to allow read and
  read-syntax to share an implementation.
  (read-syntax): New function.
2021-02-21 22:09:41 +01:00
Andy Wingo
064b394d5a Use lists instead of string ports to accumulate results
* module/ice-9/read.scm (read): Use lists, like read-delimited does.
  About 30% faster.
2021-02-17 15:50:10 +01:00
Andy Wingo
7244461a11 Fix read.scm bugs related to nonstandard reader options
* module/ice-9/read.scm (compute-reader-options): Fix handling of reader
  options, inline and otherwise.
2021-02-17 15:24:34 +01:00
Andy Wingo
6353b448cc Improve read error reporting
* module/ice-9/read.scm (read): Issue properly formatted read-errors, as
  users expect.
2021-02-17 14:54:53 +01:00
Andy Wingo
71e53d73fe Scheme read respects "positions" reader option
* module/ice-9/read.scm (read): Don't add source positions if the option
  is off.
2021-02-17 12:14:15 +01:00
Andy Wingo
beac6a3e29 More read micro-optimizations
* module/ice-9/read.scm (read): Use R5RS read-char, peek-char,
  write-char rather than (ice-9 textual-ports) wrappers, because the
  latter are expressed in terms of the former.
2021-02-17 12:10:57 +01:00
Andy Wingo
5cd28ae0ac Micro-optimization to delimiter?
* module/ice-9/read.scm (read): Make sure we hit the "case"
  optimization.
2021-02-17 12:04:18 +01:00
Andy Wingo
b6df67fe06 Re-use string output port within read
* module/ice-9/read.scm (read): Just have one string output port during
  the read.
2021-02-17 11:55:53 +01:00
Andy Wingo
a194d04d11 Fix (ice-9 read) for #\"
* module/ice-9/read.scm (read): Fix #\ followed by a delimiter.
2021-02-14 22:17:54 +01:00
Andy Wingo
5275156b00 Fix (ice-9 read) for #!r6rs
* module/ice-9/read.scm (read): Fix read-directive.
2021-02-14 22:01:42 +01:00
Andy Wingo
40e4e3b2a4 Add "read" implementation in Scheme
* module/Makefile.am (SOURCES): Add ice-9/read.
* module/ice-9/read.scm: New file.  The idea is to move the compiler to
  use this "read", after proving that it does the same as C.  Then we
  can switch to read-syntax that returns syntax objects with source
  locations, allowing us to annotate any datum.
2021-02-13 22:36:05 +01:00