Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marc Coiffier
BHR
Commits
ec7e21df
Commit
ec7e21df
authored
Apr 07, 2019
by
Marc Coiffier
Browse files
Make CaPriCon preserve whitespace at the end of documents
parent
137faa42
Changes
3
Hide whitespace changes
Inline
Side-by-side
capricon/capricon.cabal
View file @
ec7e21df
...
...
@@ -2,7 +2,7 @@
-- see http://haskell.org/cabal/users-guide/
name: capricon
version: 0.12.2
version: 0.12.2
.1
-- synopsis:
-- description:
license: GPL-3
...
...
capricon/exe/WiQEE.hs
View file @
ec7e21df
...
...
@@ -154,7 +154,7 @@ runWordsState ws st = ($st) $ from (stateT.concatT) $^ do
runWithFS
::
JS
.
JSString
->
FSIO
a
->
JS
.
CIO
a
runWithFS
fsname
(
FSIO
r
)
=
newFS
fsname
>>=
r
^..
readerT
hasteDict
=
cocDict
(
"0.12.2-js"
::
String
)
getString
getBytes
setString
setBytes
hasteDict
=
cocDict
(
"0.12.2
.1
-js"
::
String
)
getString
getBytes
setString
setBytes
main
::
IO
()
main
=
do
...
...
capricon/src/CaPriCon/Run.hs
View file @
ec7e21df
...
...
@@ -134,17 +134,22 @@ stringWordsAndSpaces unquoteStrings = map (second fromString) . fromBlank id . t
fromWChar
k
""
=
[(
True
,
k
""
)]
literate
::
forall
str
.
IsCapriconString
str
=>
Parser
String
[
str
]
literate
=
intercalate
[
":s
\n
"
]
<$>
sepBy'
(
cmdline
"> "
">? "
<+?
cmdline
"$> "
"$>? "
<+?
commentline
)
(
single
'
\n
'
)
literate
=
liftA2
(
\
pref
r
->
pref
+
[
":s"
+
fromString
r
])
(
intercalate
[
":s
\n
"
]
<$>
sepBy'
(
cmdline
"> "
">? "
<+?
cmdline
"$> "
"$>? "
<+?
commentline
)
(
single
'
\n
'
))
remaining
where
wrapResult
::
Bool
->
[
str
]
->
[
str
]
wrapResult
isParagraph
l
=
case
isParagraph
of
True
->
":p["
:
l
+
[
":p]"
]
False
->
":s["
:
l
+
[
":s]"
]
cmdline
::
Parser
String
()
->
Parser
String
()
->
Parser
String
[
str
]
cmdline
pre
pre_ex
=
map
(
\
(
x
,
exs
)
->
[
":cp["
+
fromString
(
show
(
length
x
,
if
nonempty
exs
then
True
else
False
)),
":cp="
+
intercalate
"
\n
"
(
map
fst
x
)]
+
(
if
nonempty
exs
then
":x["
:
[
":x="
+
ex
|
ex
<-
exs
]
+
[
":x]"
]
else
[]
)
+
(
":cp]"
:
wrapResult
True
(
foldMap
snd
x
)))
((,)
<$>
sepBy1'
go
(
single
'
\n
'
)
<*>
option'
[]
(
"
\n
"
>>
sepBy1'
go_ex
(
single
'
\n
'
)))
cmdline
pre
pre_ex
=
do
indent
<-
many'
(
oneOf
[
' '
,
'
\t
'
])
map
(
\
(
x
,
exs
)
->
[
":s"
+
fromString
indent
,
":cp["
+
fromString
(
show
(
length
x
,
if
nonempty
exs
then
True
else
False
)),
":cp="
+
intercalate
"
\n
"
(
map
fst
x
)]
+
(
if
nonempty
exs
then
":x["
:
[
":x="
+
ex
|
ex
<-
exs
]
+
[
":x]"
]
else
[]
)
+
(
":cp]"
:
wrapResult
True
(
foldMap
snd
x
)))
((,)
<$>
sepBy1'
go
(
single
'
\n
'
)
<*>
option'
[]
(
"
\n
"
>>
sepBy1'
go_ex
(
single
'
\n
'
)))
where
go
=
do
pre
;
many'
(
noneOf
[
'
\n
'
])
<&>
\
x
->
(
fromString
x
,
map
fromString
(
stringWords
x
+
[
"steps."
]))
go_ex
=
do
pre_ex
;
many'
(
noneOf
[
'
\n
'
])
<&>
fromString
commentline
=
map
(
foldMap
(
pure
.
(
":s"
+
)
<|>
\
(
x
,
t
)
->
":s["
:
t
+
[
":cs"
+
x
,
":s]"
::
str
]))
$
(
<*
lookingAt
eol
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment