Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
b7070c77
Commit
b7070c77
authored
Jan 26, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning, adding :set to affect parsing, closes #169
parent
72060398
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
26 deletions
+37
-26
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+23
-15
Parser.hs
src/IHaskell/Eval/Parser.hs
+14
-11
No files found.
src/IHaskell/Eval/Evaluate.hs
View file @
b7070c77
...
@@ -462,21 +462,29 @@ evalCommand output (Directive SetExtension opts) state = do
...
@@ -462,21 +462,29 @@ evalCommand output (Directive SetExtension opts) state = do
evalCommand
a
(
Directive
SetOption
opts
)
state
=
do
evalCommand
a
(
Directive
SetOption
opts
)
state
=
do
write
$
"Option: "
++
opts
write
$
"Option: "
++
opts
let
(
lost
,
found
)
=
partitionEithers
let
(
existing
,
nonExisting
)
=
partition
optionExists
$
words
opts
[
case
filter
(
elem
w
.
getOptionName
)
kernelOpts
of
if
not
$
null
nonExisting
[
x
]
->
Right
(
getUpdateKernelState
x
)
then
[]
->
Left
w
let
err
=
"No such options: "
++
intercalate
", "
nonExisting
in
ds
->
error
(
"kernelOpts has duplicate:"
++
show
(
map
getOptionName
ds
))
return
EvalOut
{
|
w
<-
words
opts
]
evalStatus
=
Failure
,
warn
evalResult
=
displayError
err
,
|
null
lost
=
mempty
evalState
=
state
,
|
otherwise
=
displayError
(
"Could not recognize options: "
++
intercalate
","
lost
)
evalPager
=
""
return
EvalOut
{
}
evalStatus
=
if
null
lost
then
Success
else
Failure
,
else
evalResult
=
warn
,
let
options
=
mapMaybe
findOption
$
words
opts
evalState
=
foldl'
(
flip
(
$
))
state
found
,
updater
=
foldl'
(
.
)
id
$
map
getUpdateKernelState
options
in
evalPager
=
""
return
EvalOut
{
}
evalStatus
=
Success
,
evalResult
=
mempty
,
evalState
=
updater
state
,
evalPager
=
""
}
where
optionExists
=
isJust
.
findOption
findOption
opt
=
find
(
elem
opt
.
getOptionName
)
kernelOpts
evalCommand
_
(
Directive
GetType
expr
)
state
=
wrapExecution
state
$
do
evalCommand
_
(
Directive
GetType
expr
)
state
=
wrapExecution
state
$
do
write
$
"Type: "
++
expr
write
$
"Type: "
++
expr
...
...
src/IHaskell/Eval/Parser.hs
View file @
b7070c77
...
@@ -125,7 +125,10 @@ parseString codeString = do
...
@@ -125,7 +125,10 @@ parseString codeString = do
activateParsingExtensions
::
GhcMonad
m
=>
CodeBlock
->
m
()
activateParsingExtensions
::
GhcMonad
m
=>
CodeBlock
->
m
()
activateParsingExtensions
(
Directive
SetExtension
ext
)
=
void
$
setExtension
ext
activateParsingExtensions
(
Directive
SetExtension
ext
)
=
void
$
setExtension
ext
activateParsingExtensions
_
=
return
()
activateParsingExtensions
(
Directive
SetDynFlag
flags
)
=
case
stripPrefix
"-X"
flags
of
Just
ext
->
void
$
setExtension
ext
Nothing
->
return
()
-- | Parse a single chunk of code, as indicated by the layout of the code.
-- | Parse a single chunk of code, as indicated by the layout of the code.
parseCodeChunk
::
GhcMonad
m
=>
String
->
LineNumber
->
m
CodeBlock
parseCodeChunk
::
GhcMonad
m
=>
String
->
LineNumber
->
m
CodeBlock
...
@@ -251,16 +254,16 @@ parseDirective (':':directive) line = case find rightDirective directives of
...
@@ -251,16 +254,16 @@ parseDirective (':':directive) line = case find rightDirective directives of
[]
->
False
[]
->
False
dir
:
_
->
dir
`
elem
`
tail
(
inits
dirname
)
dir
:
_
->
dir
`
elem
`
tail
(
inits
dirname
)
directives
=
directives
=
[(
GetType
,
"type"
)
[
(
GetType
,
"type"
)
,(
GetInfo
,
"info"
)
,
(
GetInfo
,
"info"
)
,(
SearchHoogle
,
"hoogle"
)
,
(
SearchHoogle
,
"hoogle"
)
,(
GetDoc
,
"documentation"
)
,
(
GetDoc
,
"documentation"
)
,(
SetDynFlag
,
"set"
)
,
(
SetDynFlag
,
"set"
)
,(
LoadFile
,
"load"
)
,
(
LoadFile
,
"load"
)
,(
SetOption
,
"option"
)
,
(
SetOption
,
"option"
)
,(
SetExtension
,
"extension"
)
,
(
SetExtension
,
"extension"
)
,(
GetHelp
,
"?"
)
,
(
GetHelp
,
"?"
)
,(
GetHelp
,
"help"
)
,
(
GetHelp
,
"help"
)
]
]
parseDirective
_
_
=
error
"Directive must start with colon!"
parseDirective
_
_
=
error
"Directive must start with colon!"
...
...
Write
Preview
Markdown
is supported
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