|
76 | 76 | [rest (string-take-right source (- (string-length source) position l))] |
77 | 77 | [blank (make-string l #\space)]) |
78 | 78 | (private:tolerant-parse->patch (string-append head blank rest)))] |
79 | | - [else |
80 | | - (display-condition e) |
81 | | - (newline) |
82 | | - (pretty-print (condition-irritants e)) |
83 | | - (pretty-print (car (condition-irritants e))) |
84 | | - (raise 'can-not-tolerant0)]))] |
| 79 | + [else (warning 'tokenizer-warning1 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))]))] |
85 | 80 | [(and (condition? e) (string? (caar (condition-irritants e)))) |
86 | 81 | (case (caar (condition-irritants e)) |
87 | 82 | [("unexpected dot (.)" "invalid sharp-sign prefix #~c" ) |
|
102 | 97 | [what (vector-ref (list->vector (string->list source)) position)] |
103 | 98 | [rest (string-take-right source (- (string-length source) position 1))]) |
104 | 99 | (private:tolerant-parse->patch (string-append head ")" rest)))] |
105 | | - [else (raise 'can-not-tolerant1)])] |
106 | | - [else (raise 'can-not-tolerant2)])))) |
| 100 | + [else (warning 'tokenizer-warning2 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))])] |
| 101 | + [else (warning 'tokenizer-warning2 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))])))) |
107 | 102 |
|
108 | 103 | (define source-file->annotations |
109 | 104 | (case-lambda |
|
125 | 120 | (let ([after (private:tolerant-parse->patch source)]) |
126 | 121 | (if (= (string-length after) (string-length source)) |
127 | 122 | (source-file->annotations after path start-position #f) |
128 | | - (raise 'can-not-tolerant)))] |
129 | | - [(condition? e) |
130 | | - (pretty-print `(format ,(condition-message e) ,@(condition-irritants e))) |
131 | | - (pretty-print path)] |
132 | | - [else |
133 | | - (pretty-print e) |
134 | | - (pretty-print path) |
135 | | - '()])))))))) |
| 123 | + (error 'tokenizer-error (condition-message e) (condition-irritants e))))] |
| 124 | + [(condition? e) (error 'tokenizer-error0 path `(,source ,path ,position ,tolerant? ,(condition-who e) ,(condition-message e) ,(condition-irritants e)))] |
| 125 | + [else (warning 'tokenizer-error0 path `(,source ,path ,position ,tolerant? ,(condition-who e) ,(condition-message e) ,(condition-irritants e)))])))))))) |
136 | 126 | ;https://github.com/cisco/ChezScheme/blob/e63e5af1a5d6805c96fa8977e7bd54b3b516cff6/s/7.ss#L268-L280 |
137 | 127 | ; consume |
138 | 128 | ; #!/usr/bin/env scheme-script |
|
0 commit comments