redex typesetting: make token splitter more tolerant
Possibily the typesetting enginer should reject an ill-formed input, instead; I'm not sure what went wrong with the input.
This commit is contained in:
parent
0a7ac91427
commit
0dbd3f1610
|
@ -594,17 +594,18 @@
|
||||||
(define (split-token offset tok new-token)
|
(define (split-token offset tok new-token)
|
||||||
(cond
|
(cond
|
||||||
[(string-token? tok)
|
[(string-token? tok)
|
||||||
|
(define len (string-length (string-token-string tok)))
|
||||||
(list (make-string-token (token-column tok)
|
(list (make-string-token (token-column tok)
|
||||||
offset
|
offset
|
||||||
(substring (string-token-string tok)
|
(substring (string-token-string tok)
|
||||||
0 offset)
|
0 (min len offset))
|
||||||
(string-token-style tok))
|
(string-token-style tok))
|
||||||
new-token
|
new-token
|
||||||
(make-string-token (+ (token-column tok) offset)
|
(make-string-token (+ (token-column tok) offset)
|
||||||
(- (token-span tok) offset)
|
(- (token-span tok) offset)
|
||||||
(substring (string-token-string tok)
|
(substring (string-token-string tok)
|
||||||
offset
|
(min offset len)
|
||||||
(string-length (string-token-string tok)))
|
len)
|
||||||
(string-token-style tok)))]
|
(string-token-style tok)))]
|
||||||
[(pict-token? tok)
|
[(pict-token? tok)
|
||||||
(list new-token)]))
|
(list new-token)]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user