Skip to content
Snippets Groups Projects
Commit 080c53ca authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Minor cleanup for PDF.

parent 3f1da918
Branches
No related tags found
No related merge requests found
...@@ -56,16 +56,18 @@ commentParser = Comment <$> (char '#' *> whitespaces *> manyTill anyChar eol) ...@@ -56,16 +56,18 @@ commentParser = Comment <$> (char '#' *> whitespaces *> manyTill anyChar eol)
\item[version] strings. Mostly ignored \item[version] strings. Mostly ignored
\begin{code} \begin{code}
protoEditionParser :: GenParser Char () ProtocolAItem protoEditionParser :: GenParser Char () ProtocolAItem
protoEditionParser = fmap ProtoEdition $ protoEditionParser
string "%PROTOEDITION" *> whitespaces *> word = fmap ProtoEdition $ string "%PROTOEDITION" *> whitespaces *> word
protoVerParser :: GenParser Char () ProtocolAItem protoVerParser :: GenParser Char () ProtocolAItem
protoVerParser = fmap ProtoVer $ protoVerParser
string "%PROTOVER" *> whitespaces *> word = fmap ProtoVer $ string "%PROTOVER" *> whitespaces *> word
lysKomDVersionParser :: GenParser Char () ProtocolAItem lysKomDVersionParser :: GenParser Char () ProtocolAItem
lysKomDVersionParser = fmap LysKomDVersion $ lysKomDVersionParser
string "%LYSKOMDVERSION" *> whitespaces *> word = fmap LysKomDVersion $ string "%LYSKOMDVERSION"
*> whitespaces
*> word
\end{code} \end{code}
\item[aliases], which come in three variants, all handled through a simple helper. \item[aliases], which come in three variants, all handled through a simple helper.
......
...@@ -212,7 +212,8 @@ selection ( ...@@ -212,7 +212,8 @@ selection (
selectionFieldParser :: GenParser Char () (Int, String, (String, LysType)) selectionFieldParser :: GenParser Char () (Int, String, (String, LysType))
selectionFieldParser selectionFieldParser
= (,,) = (,,)
<$> (intParser <* char '=') <*> (withWS word) <$> (intParser <* char '=')
<*> withWS word
<*> structFieldParser <* whitespaces <*> structFieldParser <* whitespaces
selectionTypeParser :: GenParser Char () LysType selectionTypeParser :: GenParser Char () LysType
......
...@@ -58,9 +58,6 @@ Frist step is to take the specification of Protocol A and parse it into ...@@ -58,9 +58,6 @@ Frist step is to take the specification of Protocol A and parse it into
something we can handle. Ideally a ready made parser would be useful, but the something we can handle. Ideally a ready made parser would be useful, but the
variant of ASN.1 (Abstract Syntax Notation One) which was used is slightly non-standard. variant of ASN.1 (Abstract Syntax Notation One) which was used is slightly non-standard.
See appendix~\ref{app:ast} for sample output for all parsers defined in this
chapter.
\input{lhs/LysKom/ProtocolA.lhs} \input{lhs/LysKom/ProtocolA.lhs}
\input{lhs/LysKom/ProtocolA/Types.lhs} \input{lhs/LysKom/ProtocolA/Types.lhs}
\input{lhs/LysKom/ProtocolA/Requests.lhs} \input{lhs/LysKom/ProtocolA/Requests.lhs}
...@@ -78,9 +75,6 @@ Haskell code from it. Now we start actually looking towards actual data! ...@@ -78,9 +75,6 @@ Haskell code from it. Now we start actually looking towards actual data!
\label{sec:datatype} \label{sec:datatype}
\input{lhs/Datatype.lhs} \input{lhs/Datatype.lhs}
\section{Notes}
\input{lhs/Notes.lhs}
\chapter {Binding it Together} \chapter {Binding it Together}
\label{cha:binding} \label{cha:binding}
...@@ -93,15 +87,6 @@ Haskell code from it. Now we start actually looking towards actual data! ...@@ -93,15 +87,6 @@ Haskell code from it. Now we start actually looking towards actual data!
We need some extra functions for making everything else go together. We need some extra functions for making everything else go together.
This includes extra parsers, a main method, and code for other things. This includes extra parsers, a main method, and code for other things.
\input{lhs/LysKom/ProtocolA/Helpers.lhs} \lstinputlisting{lhs/LysKom/ProtocolA/Helpers.hs}
\chapter {AST examples}
\label{app:ast}
Here follows some examples on syntax trees constructed from the parser
detailed in chapter~\ref{cha:bnfast}. The section isn't really necessary, but
should be good as a reference when figuring out how the parser contraction
works.
\input{lhs/Ast.lhs}
\end{document} \end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment