Sophie

Sophie

distrib > Fedora > 19 > i386 > by-pkgid > 6141746cd5048a6ddf1cf3194274ce61 > files > 796

ghc-Agda-devel-2.3.2.1-5.fc19.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Agda.Syntax.Parser.LookAhead</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Agda-Syntax-Parser-LookAhead.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Agda-Syntax-Parser-LookAhead.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">Agda-2.3.2.1: A dependently typed functional programming language and proof assistant</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Agda.Syntax.Parser.LookAhead</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The LookAhead monad
</a></li><li><a href="#g:2">Operations
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>When lexing by hands (for instance string literals) we need to do some
    looking ahead. The <code><a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a></code> monad keeps track of the position we are
    currently looking at, and provides facilities to synchronise the look-ahead
    position with the actual position of the <code><a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a></code> monad (see <code><a href="Agda-Syntax-Parser-LookAhead.html#v:sync">sync</a></code> and
    <code><a href="Agda-Syntax-Parser-LookAhead.html#v:rollback">rollback</a></code>).
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span>  <a href="#t:LookAhead">LookAhead</a> a</li><li class="src short"><a href="#v:runLookAhead">runLookAhead</a> ::  (<span class="keyword">forall</span> b.  <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> b) -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a> a</li><li class="src short"><a href="#v:getInput">getInput</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="Agda-Syntax-Parser-Alex.html#t:AlexInput">AlexInput</a></li><li class="src short"><a href="#v:setInput">setInput</a> :: <a href="Agda-Syntax-Parser-Alex.html#t:AlexInput">AlexInput</a> -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:liftP">liftP</a> ::  <a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a</li><li class="src short"><a href="#v:nextChar">nextChar</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:eatNextChar">eatNextChar</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:sync">sync</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:rollback">rollback</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:match">match</a> ::  [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a>, <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a)] -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a</li><li class="src short"><a href="#v:match-39-">match'</a> ::  <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a> -&gt; [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a>, <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a)] -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a</li></ul></div><div id="interface"><h1 id="g:1">The LookAhead monad
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:LookAhead" class="def">LookAhead</a> a <a href="src/Agda-Syntax-Parser-LookAhead.html#LookAhead" class="link">Source</a></p><div class="doc"><p>The LookAhead monad is basically a state monad keeping with an extra
    <code><a href="Agda-Syntax-Parser-Alex.html#t:AlexInput">AlexInput</a></code>, wrapped around the <code><a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a></code> monad.
</p></div><div class="subs instances"><p id="control.i:LookAhead" class="caption collapser" onclick="toggleSection('i:LookAhead')">Instances</p><div id="section.i:LookAhead" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Control-Monad.html#t:Monad">Monad</a> <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:runLookAhead" class="def">runLookAhead</a> ::  (<span class="keyword">forall</span> b.  <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> b) -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a> a<a href="src/Agda-Syntax-Parser-LookAhead.html#runLookAhead" class="link">Source</a></p><div class="doc"><p>Run a <code><a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a></code> computation. The first argument is the error function.
</p></div></div><h1 id="g:2">Operations
</h1><div class="top"><p class="src"><a name="v:getInput" class="def">getInput</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="Agda-Syntax-Parser-Alex.html#t:AlexInput">AlexInput</a><a href="src/Agda-Syntax-Parser-LookAhead.html#getInput" class="link">Source</a></p><div class="doc"><p>Get the current look-ahead position.
</p></div></div><div class="top"><p class="src"><a name="v:setInput" class="def">setInput</a> :: <a href="Agda-Syntax-Parser-Alex.html#t:AlexInput">AlexInput</a> -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Agda-Syntax-Parser-LookAhead.html#setInput" class="link">Source</a></p><div class="doc"><p>Set the look-ahead position.
</p></div></div><div class="top"><p class="src"><a name="v:liftP" class="def">liftP</a> ::  <a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a<a href="src/Agda-Syntax-Parser-LookAhead.html#liftP" class="link">Source</a></p><div class="doc"><p>Lift a computation in the <code><a href="Agda-Syntax-Parser-Monad.html#t:Parser">Parser</a></code> monad to the <code><a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a></code> monad.
</p></div></div><div class="top"><p class="src"><a name="v:nextChar" class="def">nextChar</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a><a href="src/Agda-Syntax-Parser-LookAhead.html#nextChar" class="link">Source</a></p><div class="doc"><p>Look at the next character. Fails if there are no more characters.
</p></div></div><div class="top"><p class="src"><a name="v:eatNextChar" class="def">eatNextChar</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a><a href="src/Agda-Syntax-Parser-LookAhead.html#eatNextChar" class="link">Source</a></p><div class="doc"><p>Consume the next character. Does <code><a href="Agda-Syntax-Parser-LookAhead.html#v:nextChar">nextChar</a></code> followed by <code><a href="Agda-Syntax-Parser-LookAhead.html#v:sync">sync</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:sync" class="def">sync</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Agda-Syntax-Parser-LookAhead.html#sync" class="link">Source</a></p><div class="doc"><p>Consume all the characters up to the current look-ahead position.
</p></div></div><div class="top"><p class="src"><a name="v:rollback" class="def">rollback</a> :: <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Agda-Syntax-Parser-LookAhead.html#rollback" class="link">Source</a></p><div class="doc"><p>Undo look-ahead. Restores the input from the <code><a href="Agda-Syntax-Parser-Monad.html#t:ParseState">ParseState</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:match" class="def">match</a> ::  [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a>, <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a)] -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a<a href="src/Agda-Syntax-Parser-LookAhead.html#match" class="link">Source</a></p><div class="doc"><p>Do a case on the current input string. If any of the given strings match we
    move past it and execute the corresponding action. If no string matches, we
    execute a default action, advancing the input one character. This function
    only affects the look-ahead position.
</p></div></div><div class="top"><p class="src"><a name="v:match-39-" class="def">match'</a> ::  <a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-Char.html#t:Char">Char</a> -&gt; [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.1.0/Data-String.html#t:String">String</a>, <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a)] -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a -&gt; <a href="Agda-Syntax-Parser-LookAhead.html#t:LookAhead">LookAhead</a> a<a href="src/Agda-Syntax-Parser-LookAhead.html#match%27" class="link">Source</a></p><div class="doc"><p>Same as <code><a href="Agda-Syntax-Parser-LookAhead.html#v:match">match</a></code> but takes the initial character from the first argument
    instead of reading it from the input.  Consequently, in the default case
    the input is not advanced.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>