mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-14 07:51:12 +03:00
drop leading and trailing whitespace from doc blocks
This commit is contained in:
parent
823d8be1e4
commit
76e2cb48a0
@ -479,8 +479,9 @@ lexer0 scope rem =
|
|||||||
Right Nothing -> Token (Err UnknownLexeme) pos pos : recover l pos rem
|
Right Nothing -> Token (Err UnknownLexeme) pos pos : recover l pos rem
|
||||||
Left e -> Token (Err e) pos pos : recover l pos rem
|
Left e -> Token (Err e) pos pos : recover l pos rem
|
||||||
|
|
||||||
lexDoc l pos rem = case rem of
|
lexDoc l pos rem = case span isSpace rem of
|
||||||
_ -> docBlob l pos rem pos []
|
(spaces,rem) -> docBlob l pos' rem pos' []
|
||||||
|
where pos' = incBy spaces pos
|
||||||
|
|
||||||
docBlob l pos rem blobStart acc = case rem of
|
docBlob l pos rem blobStart acc = case rem of
|
||||||
'@' : (hqToken (inc pos) -> Just (tok, rem)) ->
|
'@' : (hqToken (inc pos) -> Just (tok, rem)) ->
|
||||||
@ -501,7 +502,8 @@ lexer0 scope rem =
|
|||||||
docBlob l pos' rem pos' []
|
docBlob l pos' rem pos' []
|
||||||
':' : ']' : rem ->
|
':' : ']' : rem ->
|
||||||
let pos' = inc . inc $ pos in
|
let pos' = inc . inc $ pos in
|
||||||
(if null acc then id else (Token (Textual (reverse acc)) blobStart pos :)) $
|
(if null acc then id
|
||||||
|
else (Token (Textual (reverse $ dropWhile isSpace acc)) blobStart pos :)) $
|
||||||
Token Close pos pos' : goWhitespace l pos' rem
|
Token Close pos pos' : goWhitespace l pos' rem
|
||||||
[] -> recover l pos rem
|
[] -> recover l pos rem
|
||||||
ch : rem -> docBlob l (incBy [ch] pos) rem blobStart (ch:acc)
|
ch : rem -> docBlob l (incBy [ch] pos) rem blobStart (ch:acc)
|
||||||
|
Loading…
Reference in New Issue
Block a user