seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

lexer error when last datum is sharp-semicolon commented #185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the program:

#!r6rs
(import (rnrs))
(write 'ciao)
#;(list 1)

What is the expected output? What do you see instead?
It should print "ciao".   It fails with:

 Condition components:
 1. &lexical 
 2. &i/o-read
 3. &who            who: "read"
 4. &message        message: "syntax error near [<end of file>] at <transcoded-textual-input-port <binary-input-port proof2.sps>>:6. "

What version of the product are you using? On what operating system?
Mosh R6RS scheme interpreter, version 0.2.6 (revision master 2010/10/21 
22:57:00 mosh-0.2.5-192-gdbe4428).  i686-pc-linux-gnu.

Please provide any additional information below.
It seems to happen whenever the last datum is #; prefixed.

Original issue reported on code.google.com by mrc....@gmail.com on 9 Jan 2011 at 1:03

GoogleCodeExporter commented 9 years ago
confirmed.

prism:~ oku$ nmosh
nmosh top program
nmosh> #;hoge
 Condition components:
 1. &lexical 
 2. &i/o-read
 3. &who            "read"
 4. &message        "syntax error near [<end of file>] at <string-input-port>:1. "

--

this can fixed like:

diff --git a/src/Reader.y b/src/Reader.y
index 6d74292..864dc61 100644
--- a/src/Reader.y
+++ b/src/Reader.y
@@ -87,6 +87,7 @@ datum          : lexme_datum
                | defining_datum
                | defined_datum
                | DATUM_COMMENT datum datum { $$ = $3; }
+               | DATUM_COMMENT datum END_OF_FILE { 
currentVM()->readerContext()->setParsed(Object::Eof); YYACCEPT; }
                | DATUM_COMMENT lexme_datum { $$ = Object::Ignore; }
                | DATUM_COMMENT compound_datum { $$ = Object::Ignore; }
                ;

but needs more test.

Original comment by oku...@gmail.com on 9 Jan 2011 at 1:32

GoogleCodeExporter commented 9 years ago
cc higepon.

Original comment by oku...@gmail.com on 9 Jan 2011 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 31 Jan 2011 at 2:18

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 31 Jan 2011 at 3:11

GoogleCodeExporter commented 9 years ago
Fixed.
https://github.com/higepon/mosh/commit/d71c499ec531ad8ccc6ff98aec7bd4e17377a1e5

Original comment by hige...@gmail.com on 31 Jan 2011 at 11:33

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 31 Jan 2011 at 11:40