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
Informatik 8
CoPaR
Commits
e0ff4214
Commit
e0ff4214
authored
Jul 24, 2018
by
Hans-Peter Deifel
Browse files
Inline helper functions in Coalgebra.Parser
parent
acaeffbc
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/MA/Coalgebra/Parser.hs
View file @
e0ff4214
...
...
@@ -56,6 +56,7 @@ class ParseMorphism f where
newState
::
MorphParser
l
h1
State
newState
=
nextState
<<%=
succ
{-# INLINE newState #-}
defineSymbol
::
Text
->
MorphParser
l
h1
State
defineSymbol
sym
=
use
(
symbolTable
.
at
sym
)
>>=
\
case
...
...
@@ -67,6 +68,7 @@ defineSymbol sym = use (symbolTable . at sym) >>= \case
define
::
State
->
MorphParser
l
h1
State
define
node
=
(
symbolTable
.
at
sym
.=
Just
(
node
,
Defined
))
*>
return
node
{-# INLINE defineSymbol #-}
lookupSymbol
::
Text
->
MorphParser
l
h1
State
lookupSymbol
sym
=
use
(
symbolTable
.
at
sym
)
>>=
\
case
...
...
@@ -76,6 +78,7 @@ lookupSymbol sym = use (symbolTable . at sym) >>= \case
where
markUndefined
::
State
->
MorphParser
l
h1
()
markUndefined
node
=
symbolTable
.
at
sym
.=
Just
(
node
,
Undefined
)
{-# INLINE lookupSymbol #-}
checkUndefinedRefs
::
MorphParser
l
h1
()
checkUndefinedRefs
=
use
(
symbolTable
.
to
M
.
toList
.
to
(
filter
isUndefined
))
>>=
\
case
...
...
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