Skip to content

Commit

Permalink
Synthesize the first imaginary token to take location from the stream.
Browse files Browse the repository at this point in the history
Rather than assume the token stream starts at line 1, column 0, position 1,
use the stream to inform the position.
  • Loading branch information
dyoo committed Jan 9, 2013
1 parent e92e51b commit 1b37e25
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions collects/algol60/cfg-parser.rkt
Expand Up @@ -27,6 +27,8 @@
;; grammar to tokens specific to this parser. In other words, this
;; parser uses `parser' so that it doesn't have to know anything about
;; tokens.
;;



(require parser-tools/yacc
Expand Down Expand Up @@ -758,13 +760,19 @@
(#,start tok-list
;; we simulate a token at the very beginning with zero width
;; for use with the position-generating code (*-start-pos, *-end-pos).
(tok #f #f #f
(position 1
#,(if src-pos? #'1 #'#f)
#,(if src-pos? #'0 #'#f))
(position 1
#,(if src-pos? #'1 #'#f)
#,(if src-pos? #'0 #'#f)))
(if (null? tok-list)
(tok #f #f #f
(position 1
#,(if src-pos? #'1 #'#f)
#,(if src-pos? #'0 #'#f))
(position 1
#,(if src-pos? #'1 #'#f)
#,(if src-pos? #'0 #'#f)))
(tok (tok-name (car tok-list))
(tok-orig-name (car tok-list))
(tok-val (car tok-list))
(tok-start (car tok-list))
(tok-start (car tok-list))))
0
(length tok-list)
success-k
Expand Down

0 comments on commit 1b37e25

Please sign in to comment.