polyparse 1.3 → 1.4
raw patch · 78 files changed
+660/−23921 lines, 78 filesdep +bytestring
Dependencies added: bytestring
Files
- Build.bat +0/−98
- COPYRIGHT +2/−2
- LICENCE-LGPL +0/−507
- Makefile +0/−106
- README +0/−61
- configure +0/−320
- docs/changelog.html +0/−96
- docs/haddock/Text-Parse.html +0/−1172
- docs/haddock/Text-ParserCombinators-HuttonMeijer.html +0/−1572
- docs/haddock/Text-ParserCombinators-HuttonMeijerWallace.html +0/−1352
- docs/haddock/Text-ParserCombinators-Poly-Base.html +0/−1140
- docs/haddock/Text-ParserCombinators-Poly-Lazy.html +0/−608
- docs/haddock/Text-ParserCombinators-Poly-NoLeak-Lazy.html +0/−461
- docs/haddock/Text-ParserCombinators-Poly-NoLeak-Plain.html +0/−461
- docs/haddock/Text-ParserCombinators-Poly-NoLeak-State.html +0/−600
- docs/haddock/Text-ParserCombinators-Poly-NoLeak-StateLazy.html +0/−644
- docs/haddock/Text-ParserCombinators-Poly-Plain.html +0/−608
- docs/haddock/Text-ParserCombinators-Poly-State.html +0/−747
- docs/haddock/Text-ParserCombinators-Poly-StateLazy.html +0/−791
- docs/haddock/Text-ParserCombinators-Poly.html +0/−100
- docs/haddock/Text-ParserCombinators-PolyLazy.html +0/−1448
- docs/haddock/Text-ParserCombinators-PolyState.html +0/−1517
- docs/haddock/Text-ParserCombinators-PolyStateLazy.html +0/−1581
- docs/haddock/doc-index-43.html +0/−150
- docs/haddock/doc-index-A.html +0/−162
- docs/haddock/doc-index-B.html +0/−166
- docs/haddock/doc-index-C.html +0/−278
- docs/haddock/doc-index-D.html +0/−146
- docs/haddock/doc-index-E.html +0/−162
- docs/haddock/doc-index-F.html +0/−190
- docs/haddock/doc-index-I.html +0/−198
- docs/haddock/doc-index-J.html +0/−138
- docs/haddock/doc-index-L.html +0/−146
- docs/haddock/doc-index-M.html +0/−206
- docs/haddock/doc-index-N.html +0/−190
- docs/haddock/doc-index-O.html +0/−190
- docs/haddock/doc-index-P.html +0/−374
- docs/haddock/doc-index-R.html +0/−246
- docs/haddock/doc-index-S.html +0/−382
- docs/haddock/doc-index-T.html +0/−162
- docs/haddock/doc-index-U.html +0/−138
- docs/haddock/doc-index-W.html +0/−138
- docs/haddock/doc-index.html +0/−124
- docs/haddock/haddock.css +0/−260
- docs/haddock/haddock.js +0/−15
- docs/haddock/haskell_icon.gif binary
- docs/haddock/index.html +0/−185
- docs/haddock/minus.gif binary
- docs/haddock/plus.gif binary
- docs/haddock/src/Text/Parse.html +0/−387
- docs/haddock/src/Text/ParserCombinators/HuttonMeijer.html +0/−228
- docs/haddock/src/Text/ParserCombinators/HuttonMeijerWallace.html +0/−307
- docs/haddock/src/Text/ParserCombinators/Poly.html +0/−15
- docs/haddock/src/Text/ParserCombinators/Poly/Base.html +0/−205
- docs/haddock/src/Text/ParserCombinators/Poly/Lazy.html +0/−139
- docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/Lazy.html +0/−130
- docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/Plain.html +0/−109
- docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/State.html +0/−126
- docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html +0/−176
- docs/haddock/src/Text/ParserCombinators/Poly/Plain.html +0/−117
- docs/haddock/src/Text/ParserCombinators/Poly/State.html +0/−135
- docs/haddock/src/Text/ParserCombinators/Poly/StateLazy.html +0/−185
- docs/haddock/src/Text/ParserCombinators/PolyLazy.html +0/−279
- docs/haddock/src/Text/ParserCombinators/PolyState.html +0/−261
- docs/haddock/src/Text/ParserCombinators/PolyStateLazy.html +0/−294
- docs/index.html +0/−317
- polyparse.cabal +24/−16
- script/echo.c +0/−20
- src/Makefile +0/−86
- src/Text/Parse.hs +87/−34
- src/Text/Parse/ByteString.hs +407/−0
- src/Text/ParserCombinators/Poly/Base.hs +1/−1
- src/Text/ParserCombinators/Poly/ByteString.hs +114/−0
- src/Text/ParserCombinators/Poly/Lazy.hs +6/−0
- src/Text/ParserCombinators/Poly/Plain.hs +6/−0
- src/Text/ParserCombinators/Poly/State.hs +7/−0
- src/Text/ParserCombinators/Poly/StateLazy.hs +6/−0
- src/pkg.conf +0/−16
− Build.bat
@@ -1,98 +0,0 @@-REM -- Build polyparse package using GHC -REM -REM Usage: (case-sensitive) -REM Build compile and install the polyparse library GHC package -REM Build Remove remove the polyparse GHC library package - -rem -- Change the following variables (upto and including SRC) -rem -- to suit the local system environment -- - -rem GHC version -set GHCVER=6.6 - -rem GHC installation directory: -set GHCDIR=C:\DEV\ghc\ghc-%GHCVER% - -rem Programs needed to build polyparse: -rem -rem NOTE: install MinGW linked from <http://www.mingw.org/> -rem for a copy of 'ar.exe' -rem -set GHC=C:\DEV\ghc\ghc-%GHCVER%\bin\ghc.exe -set GHCPKG=C:\DEV\ghc\ghc-%GHCVER%\bin\ghc-pkg.exe -set AR=C:\DEV\MinGW\bin\ar.exe -set LD=C:\DEV\ghc\ghc-%GHCVER%\gcc-lib\ld.exe - -rem Source directory for polyparse: -set SRC=C:\DEV\Haskell\lib\polyparse-1.1\src - -rem Two very long lines (500-600 chars) follow here. -rem They should not need changing. -set SRCS=Text/ParserCombinators/Poly.hs Text/ParserCombinators/PolyState.hs Text/ParserCombinators/TextParser.hs Text/ParserCombinators/PolyLazy.hs Text/ParserCombinators/PolyStateLazy.hs Text/ParserCombinators/Poly/Base.hs Text/ParserCombinators/Poly/Plain.hs Text/ParserCombinators/Poly/State.hs Text/ParserCombinators/Poly/Lazy.hs Text/ParserCombinators/Poly/StateLazy.hs Text/ParserCombinators/Poly/NoLeak/Plain.hs Text/ParserCombinators/Poly/NoLeak/State.hs Text/ParserCombinators/Poly/NoLeak/Lazy.hs Text/ParserCombinators/Poly/NoLeak/StateLazy.hs -set OBJS=Text/ParserCombinators/Poly.o Text/ParserCombinators/PolyState.o Text/ParserCombinators/TextParser.o Text/ParserCombinators/PolyLazy.o Text/ParserCombinators/PolyStateLazy.o Text/ParserCombinators/Poly/Base.o Text/ParserCombinators/Poly/Plain.o Text/ParserCombinators/Poly/State.o Text/ParserCombinators/Poly/Lazy.o Text/ParserCombinators/Poly/StateLazy.o Text/ParserCombinators/Poly/NoLeak/Plain.o Text/ParserCombinators/Poly/NoLeak/State.o Text/ParserCombinators/Poly/NoLeak/Lazy.o Text/ParserCombinators/Poly/NoLeak/StateLazy.o - - -rem -- Get on with the real work -- - -if "%1"=="Remove" goto Remove - -rem -- Compile sources and create library archive -if "%GHCVER%"=="6.4" COPY polyparse.cabal %SRC%\pkg.conf -if "%GHCVER%"=="6.4.1" COPY polyparse.cabal %SRC%\pkg.conf -if "%GHCVER%"=="6.4.2" COPY polyparse.cabal %SRC%\pkg.conf -if "%GHCVER%"=="6.6" COPY polyparse.cabal %SRC%\pkg.conf -if "%GHCVER%"=="6.6.1" COPY polyparse.cabal %SRC%\pkg.conf -if "%GHCVER%"=="6.6.2" COPY polyparse.cabal %SRC%\pkg.conf -cd %SRC% -%GHC% --make -cpp -i. -package-name polyparse-1.1 %SRCS% -%AR% r libHSpolyparse.a %OBJS% - -rem -- Create library file for GHCi -%LD% -r --whole-archive -o HSpolyparse.o libHSpolyparse.a - -rem -- Install the library archive(s) where GHC can find them -COPY libHSpolyparse.a %GHCDIR% -COPY HSpolyparse.o %GHCDIR% - -rem -- Install the interface files where GHC can find them -rem /L - list only, /Y - overrite without confirmation -rem /S - copy subdirectories, /T - create directories only -rem /F - display full filenames while copying -XCOPY /S /F *.hi %GHCDIR%\imports - -rem -- Finally, register the package with GHC -if "%GHCVER%"=="6.2" goto OldRegister -if "%GHCVER%"=="6.2.1" goto OldRegister -if "%GHCVER%"=="6.2.2" goto OldRegister -if "%GHCVER%"=="6.4" goto NewRegister -if "%GHCVER%"=="6.4.1" goto NewRegister -if "%GHCVER%"=="6.4.2" goto NewRegister -if "%GHCVER%"=="6.6" goto NewRegister -if "%GHCVER%"=="6.6.1" goto NewRegister -if "%GHCVER%"=="6.6.2" goto NewRegister - -goto Exit - -rem -- old-style package registration -:OldRegister -%GHCPKG% --add-package -i pkg.conf -goto Exit - -rem -- new-style package registration -:NewRegister -ECHO import-dirs: %GHCDIR%\imports >>pkg.conf -ECHO library-dirs: %GHCDIR% >>pkg.conf -ECHO depends: base, haskell98 >>pkg.conf -ECHO hs-libraries: HSpolyparse >>pkg.conf -%GHCPKG% register pkg.conf -goto Exit - -rem -- Remove GHC package for polyparse -- -:Remove -%GHCPKG% --remove-package polyparse-1.1 - -goto Exit - -rem -- All done -- - -:Exit
COPYRIGHT view
@@ -4,9 +4,9 @@ (c) copyright 1996 Graham Hutton and Erik Meijer with modifications (c) copyright 1998-2000 Malcolm Wallace-The modules Text.ParserCombinators.Poly* and Text.Parse+The modules Text.ParserCombinators.Poly* and Text.Parse and Text.Parse.* are- (c) copyright 2006-2007 Malcolm Wallace+ (c) copyright 2006-2009 Malcolm Wallace These modules are licensed under the terms of the GNU Lesser General Public Licence (LGPL), which can be found in the file called
− LICENCE-LGPL
@@ -1,507 +0,0 @@- GNU LESSER GENERAL PUBLIC LICENSE- Version 2.1, February 1999-- Copyright (C) 1991, 1999 Free Software Foundation, Inc.- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA- Everyone is permitted to copy and distribute verbatim copies- of this license document, but changing it is not allowed.--[This is the first released version of the Lesser GPL. It also counts- as the successor of the GNU Library Public License, version 2, hence- the version number 2.1.]-- Preamble-- The licenses for most software are designed to take away your-freedom to share and change it. By contrast, the GNU General Public-Licenses are intended to guarantee your freedom to share and change-free software--to make sure the software is free for all its users.-- This license, the Lesser General Public License, applies to some-specially designated software packages--typically libraries--of the-Free Software Foundation and other authors who decide to use it. You-can use it too, but we suggest you first think carefully about whether-this license or the ordinary General Public License is the better-strategy to use in any particular case, based on the explanations-below.-- When we speak of free software, we are referring to freedom of use,-not price. Our General Public Licenses are designed to make sure that-you have the freedom to distribute copies of free software (and charge-for this service if you wish); that you receive source code or can get-it if you want it; that you can change the software and use pieces of-it in new free programs; and that you are informed that you can do-these things.-- To protect your rights, we need to make restrictions that forbid-distributors to deny you these rights or to ask you to surrender these-rights. These restrictions translate to certain responsibilities for-you if you distribute copies of the library or if you modify it.-- For example, if you distribute copies of the library, whether gratis-or for a fee, you must give the recipients all the rights that we gave-you. You must make sure that they, too, receive or can get the source-code. If you link other code with the library, you must provide-complete object files to the recipients, so that they can relink them-with the library after making changes to the library and recompiling-it. And you must show them these terms so they know their rights.-- We protect your rights with a two-step method: (1) we copyright the-library, and (2) we offer you this license, which gives you legal-permission to copy, distribute and/or modify the library.-- To protect each distributor, we want to make it very clear that-there is no warranty for the free library. Also, if the library is-modified by someone else and passed on, the recipients should know-that what they have is not the original version, so that the original-author's reputation will not be affected by problems that might be-introduced by others.-- Finally, software patents pose a constant threat to the existence of-any free program. We wish to make sure that a company cannot-effectively restrict the users of a free program by obtaining a-restrictive license from a patent holder. Therefore, we insist that-any patent license obtained for a version of the library must be-consistent with the full freedom of use specified in this license.-- Most GNU software, including some libraries, is covered by the-ordinary GNU General Public License. This license, the GNU Lesser-General Public License, applies to certain designated libraries, and-is quite different from the ordinary General Public License. We use-this license for certain libraries in order to permit linking those-libraries into non-free programs.-- When a program is linked with a library, whether statically or using-a shared library, the combination of the two is legally speaking a-combined work, a derivative of the original library. The ordinary-General Public License therefore permits such linking only if the-entire combination fits its criteria of freedom. The Lesser General-Public License permits more lax criteria for linking other code with-the library.-- We call this license the "Lesser" General Public License because it-does Less to protect the user's freedom than the ordinary General-Public License. It also provides other free software developers Less-of an advantage over competing non-free programs. These disadvantages-are the reason we use the ordinary General Public License for many-libraries. However, the Lesser license provides advantages in certain-special circumstances.-- For example, on rare occasions, there may be a special need to-encourage the widest possible use of a certain library, so that it-becomes a de-facto standard. To achieve this, non-free programs must-be allowed to use the library. A more frequent case is that a free-library does the same job as widely used non-free libraries. In this-case, there is little to gain by limiting the free library to free-software only, so we use the Lesser General Public License.-- In other cases, permission to use a particular library in non-free-programs enables a greater number of people to use a large body of-free software. For example, permission to use the GNU C Library in-non-free programs enables many more people to use the whole GNU-operating system, as well as its variant, the GNU/Linux operating-system.-- Although the Lesser General Public License is Less protective of the-users' freedom, it does ensure that the user of a program that is-linked with the Library has the freedom and the wherewithal to run-that program using a modified version of the Library.-- The precise terms and conditions for copying, distribution and-modification follow. Pay close attention to the difference between a-"work based on the library" and a "work that uses the library". The-former contains code derived from the library, whereas the latter must-be combined with the library in order to run.--- GNU LESSER GENERAL PUBLIC LICENSE- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION-- 0. This License Agreement applies to any software library or other-program which contains a notice placed by the copyright holder or-other authorized party saying it may be distributed under the terms of-this Lesser General Public License (also called "this License").-Each licensee is addressed as "you".-- A "library" means a collection of software functions and/or data-prepared so as to be conveniently linked with application programs-(which use some of those functions and data) to form executables.-- The "Library", below, refers to any such software library or work-which has been distributed under these terms. A "work based on the-Library" means either the Library or any derivative work under-copyright law: that is to say, a work containing the Library or a-portion of it, either verbatim or with modifications and/or translated-straightforwardly into another language. (Hereinafter, translation is-included without limitation in the term "modification".)-- "Source code" for a work means the preferred form of the work for-making modifications to it. For a library, complete source code means-all the source code for all modules it contains, plus any associated-interface definition files, plus the scripts used to control-compilation and installation of the library.-- Activities other than copying, distribution and modification are not-covered by this License; they are outside its scope. The act of-running a program using the Library is not restricted, and output from-such a program is covered only if its contents constitute a work based-on the Library (independent of the use of the Library in a tool for-writing it). Whether that is true depends on what the Library does-and what the program that uses the Library does.-- 1. You may copy and distribute verbatim copies of the Library's-complete source code as you receive it, in any medium, provided that-you conspicuously and appropriately publish on each copy an-appropriate copyright notice and disclaimer of warranty; keep intact-all the notices that refer to this License and to the absence of any-warranty; and distribute a copy of this License along with the-Library.-- You may charge a fee for the physical act of transferring a copy,-and you may at your option offer warranty protection in exchange for a-fee.-- 2. You may modify your copy or copies of the Library or any portion-of it, thus forming a work based on the Library, and copy and-distribute such modifications or work under the terms of Section 1-above, provided that you also meet all of these conditions:-- a) The modified work must itself be a software library.-- b) You must cause the files modified to carry prominent notices- stating that you changed the files and the date of any change.-- c) You must cause the whole of the work to be licensed at no- charge to all third parties under the terms of this License.-- d) If a facility in the modified Library refers to a function or a- table of data to be supplied by an application program that uses- the facility, other than as an argument passed when the facility- is invoked, then you must make a good faith effort to ensure that,- in the event an application does not supply such function or- table, the facility still operates, and performs whatever part of- its purpose remains meaningful.-- (For example, a function in a library to compute square roots has- a purpose that is entirely well-defined independent of the- application. Therefore, Subsection 2d requires that any- application-supplied function or table used by this function must- be optional: if the application does not supply it, the square- root function must still compute square roots.)--These requirements apply to the modified work as a whole. If-identifiable sections of that work are not derived from the Library,-and can be reasonably considered independent and separate works in-themselves, then this License, and its terms, do not apply to those-sections when you distribute them as separate works. But when you-distribute the same sections as part of a whole which is a work based-on the Library, the distribution of the whole must be on the terms of-this License, whose permissions for other licensees extend to the-entire whole, and thus to each and every part regardless of who wrote-it.--Thus, it is not the intent of this section to claim rights or contest-your rights to work written entirely by you; rather, the intent is to-exercise the right to control the distribution of derivative or-collective works based on the Library.--In addition, mere aggregation of another work not based on the Library-with the Library (or with a work based on the Library) on a volume of-a storage or distribution medium does not bring the other work under-the scope of this License.-- 3. You may opt to apply the terms of the ordinary GNU General Public-License instead of this License to a given copy of the Library. To do-this, you must alter all the notices that refer to this License, so-that they refer to the ordinary GNU General Public License, version 2,-instead of to this License. (If a newer version than version 2 of the-ordinary GNU General Public License has appeared, then you can specify-that version instead if you wish.) Do not make any other change in-these notices.-- Once this change is made in a given copy, it is irreversible for-that copy, so the ordinary GNU General Public License applies to all-subsequent copies and derivative works made from that copy.-- This option is useful when you wish to copy part of the code of-the Library into a program that is not a library.-- 4. You may copy and distribute the Library (or a portion or-derivative of it, under Section 2) in object code or executable form-under the terms of Sections 1 and 2 above provided that you accompany-it with the complete corresponding machine-readable source code, which-must be distributed under the terms of Sections 1 and 2 above on a-medium customarily used for software interchange.-- If distribution of object code is made by offering access to copy-from a designated place, then offering equivalent access to copy the-source code from the same place satisfies the requirement to-distribute the source code, even though third parties are not-compelled to copy the source along with the object code.-- 5. A program that contains no derivative of any portion of the-Library, but is designed to work with the Library by being compiled or-linked with it, is called a "work that uses the Library". Such a-work, in isolation, is not a derivative work of the Library, and-therefore falls outside the scope of this License.-- However, linking a "work that uses the Library" with the Library-creates an executable that is a derivative of the Library (because it-contains portions of the Library), rather than a "work that uses the-library". The executable is therefore covered by this License.-Section 6 states terms for distribution of such executables.-- When a "work that uses the Library" uses material from a header file-that is part of the Library, the object code for the work may be a-derivative work of the Library even though the source code is not.-Whether this is true is especially significant if the work can be-linked without the Library, or if the work is itself a library. The-threshold for this to be true is not precisely defined by law.-- If such an object file uses only numerical parameters, data-structure layouts and accessors, and small macros and small inline-functions (ten lines or less in length), then the use of the object-file is unrestricted, regardless of whether it is legally a derivative-work. (Executables containing this object code plus portions of the-Library will still fall under Section 6.)-- Otherwise, if the work is a derivative of the Library, you may-distribute the object code for the work under the terms of Section 6.-Any executables containing that work also fall under Section 6,-whether or not they are linked directly with the Library itself.-- 6. As an exception to the Sections above, you may also combine or-link a "work that uses the Library" with the Library to produce a-work containing portions of the Library, and distribute that work-under terms of your choice, provided that the terms permit-modification of the work for the customer's own use and reverse-engineering for debugging such modifications.-- You must give prominent notice with each copy of the work that the-Library is used in it and that the Library and its use are covered by-this License. You must supply a copy of this License. If the work-during execution displays copyright notices, you must include the-copyright notice for the Library among them, as well as a reference-directing the user to the copy of this License. Also, you must do one-of these things:-- a) Accompany the work with the complete corresponding- machine-readable source code for the Library including whatever- changes were used in the work (which must be distributed under- Sections 1 and 2 above); and, if the work is an executable linked- with the Library, with the complete machine-readable "work that- uses the Library", as object code and/or source code, so that the- user can modify the Library and then relink to produce a modified- executable containing the modified Library. (It is understood- that the user who changes the contents of definitions files in the- Library will not necessarily be able to recompile the application- to use the modified definitions.)-- b) Use a suitable shared library mechanism for linking with the- Library. A suitable mechanism is one that (1) uses at run time a- copy of the library already present on the user's computer system,- rather than copying library functions into the executable, and (2)- will operate properly with a modified version of the library, if- the user installs one, as long as the modified version is- interface-compatible with the version that the work was made with.-- c) Accompany the work with a written offer, valid for at least- three years, to give the same user the materials specified in- Subsection 6a, above, for a charge no more than the cost of- performing this distribution.-- d) If distribution of the work is made by offering access to copy- from a designated place, offer equivalent access to copy the above- specified materials from the same place.-- e) Verify that the user has already received a copy of these- materials or that you have already sent this user a copy.-- For an executable, the required form of the "work that uses the-Library" must include any data and utility programs needed for-reproducing the executable from it. However, as a special exception,-the materials to be distributed need not include anything that is-normally distributed (in either source or binary form) with the major-components (compiler, kernel, and so on) of the operating system on-which the executable runs, unless that component itself accompanies-the executable.-- It may happen that this requirement contradicts the license-restrictions of other proprietary libraries that do not normally-accompany the operating system. Such a contradiction means you cannot-use both them and the Library together in an executable that you-distribute.-- 7. You may place library facilities that are a work based on the-Library side-by-side in a single library together with other library-facilities not covered by this License, and distribute such a combined-library, provided that the separate distribution of the work based on-the Library and of the other library facilities is otherwise-permitted, and provided that you do these two things:-- a) Accompany the combined library with a copy of the same work- based on the Library, uncombined with any other library- facilities. This must be distributed under the terms of the- Sections above.-- b) Give prominent notice with the combined library of the fact- that part of it is a work based on the Library, and explaining- where to find the accompanying uncombined form of the same work.-- 8. You may not copy, modify, sublicense, link with, or distribute-the Library except as expressly provided under this License. Any-attempt otherwise to copy, modify, sublicense, link with, or-distribute the Library is void, and will automatically terminate your-rights under this License. However, parties who have received copies,-or rights, from you under this License will not have their licenses-terminated so long as such parties remain in full compliance.-- 9. You are not required to accept this License, since you have not-signed it. However, nothing else grants you permission to modify or-distribute the Library or its derivative works. These actions are-prohibited by law if you do not accept this License. Therefore, by-modifying or distributing the Library (or any work based on the-Library), you indicate your acceptance of this License to do so, and-all its terms and conditions for copying, distributing or modifying-the Library or works based on it.-- 10. Each time you redistribute the Library (or any work based on the-Library), the recipient automatically receives a license from the-original licensor to copy, distribute, link with or modify the Library-subject to these terms and conditions. You may not impose any further-restrictions on the recipients' exercise of the rights granted herein.-You are not responsible for enforcing compliance by third parties with-this License.-- 11. If, as a consequence of a court judgment or allegation of patent-infringement or for any other reason (not limited to patent issues),-conditions are imposed on you (whether by court order, agreement or-otherwise) that contradict the conditions of this License, they do not-excuse you from the conditions of this License. If you cannot-distribute so as to satisfy simultaneously your obligations under this-License and any other pertinent obligations, then as a consequence you-may not distribute the Library at all. For example, if a patent-license would not permit royalty-free redistribution of the Library by-all those who receive copies directly or indirectly through you, then-the only way you could satisfy both it and this License would be to-refrain entirely from distribution of the Library.--If any portion of this section is held invalid or unenforceable under-any particular circumstance, the balance of the section is intended to-apply, and the section as a whole is intended to apply in other-circumstances.--It is not the purpose of this section to induce you to infringe any-patents or other property right claims or to contest validity of any-such claims; this section has the sole purpose of protecting the-integrity of the free software distribution system which is-implemented by public license practices. Many people have made-generous contributions to the wide range of software distributed-through that system in reliance on consistent application of that-system; it is up to the author/donor to decide if he or she is willing-to distribute software through any other system and a licensee cannot-impose that choice.--This section is intended to make thoroughly clear what is believed to-be a consequence of the rest of this License.-- 12. If the distribution and/or use of the Library is restricted in-certain countries either by patents or by copyrighted interfaces, the-original copyright holder who places the Library under this License-may add an explicit geographical distribution limitation excluding those-countries, so that distribution is permitted only in or among-countries not thus excluded. In such case, this License incorporates-the limitation as if written in the body of this License.-- 13. The Free Software Foundation may publish revised and/or new-versions of the Lesser General Public License from time to time.-Such new versions will be similar in spirit to the present version,-but may differ in detail to address new problems or concerns.--Each version is given a distinguishing version number. If the Library-specifies a version number of this License which applies to it and-"any later version", you have the option of following the terms and-conditions either of that version or of any later version published by-the Free Software Foundation. If the Library does not specify a-license version number, you may choose any version ever published by-the Free Software Foundation.-- 14. If you wish to incorporate parts of the Library into other free-programs whose distribution conditions are incompatible with these,-write to the author to ask for permission. For software which is-copyrighted by the Free Software Foundation, write to the Free-Software Foundation; we sometimes make exceptions for this. Our-decision will be guided by the two goals of preserving the free status-of all derivatives of our free software and of promoting the sharing-and reuse of software generally.-- NO WARRANTY-- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.-- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH-DAMAGES.-- END OF TERMS AND CONDITIONS--- How to Apply These Terms to Your New Libraries-- If you develop a new library, and you want it to be of the greatest-possible use to the public, we recommend making it free software that-everyone can redistribute and change. You can do so by permitting-redistribution under these terms (or, alternatively, under the terms of the-ordinary General Public License).-- To apply these terms, attach the following notices to the library. It is-safest to attach them to the start of each source file to most effectively-convey the exclusion of warranty; and each file should have at least the-"copyright" line and a pointer to where the full notice is found.-- <one line to give the library's name and a brief idea of what it does.>- Copyright (C) <year> <name of author>-- This library is free software; you can redistribute it and/or- modify it under the terms of the GNU Lesser General Public- License as published by the Free Software Foundation; either- version 2.1 of the License, or (at your option) any later version.-- This library is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU- Lesser General Public License for more details.-- You should have received a copy of the GNU Lesser General Public- License along with this library; if not, write to the Free Software- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--Also add information on how to contact you by electronic and paper mail.--You should also get your employer (if you work as a programmer) or your-school, if any, to sign a "copyright disclaimer" for the library, if-necessary. Here is a sample; alter the names:-- Yoyodyne, Inc., hereby disclaims all copyright interest in the- library `Frob' (a library for tweaking knobs) written by James Random Hacker.-- <signature of Ty Coon>, 1 April 1990- Ty Coon, President of Vice--That's all there is to it!-
− Makefile
@@ -1,106 +0,0 @@-SOFTWARE = polyparse-VERSION = 1.3--CPP = cpp -traditional-#CPP = cpphs --text # useful e.g. on MacOS X--DIRS = Text Text/ParserCombinators Text/ParserCombinators/Poly--SRCS = \- src/Text/ParserCombinators/HuttonMeijer.hs \- src/Text/ParserCombinators/HuttonMeijerWallace.hs \- src/Text/ParserCombinators/Poly.hs \- src/Text/ParserCombinators/Poly/Base.hs \- src/Text/ParserCombinators/Poly/Plain.hs \- src/Text/ParserCombinators/Poly/Lazy.hs \- src/Text/ParserCombinators/Poly/State.hs \- src/Text/ParserCombinators/Poly/StateLazy.hs \- src/Text/Parse.hs--TOOLSRCS = \--AUX = configure Makefile src/Makefile src/pkg.conf docs/* examples \- README LICENCE* COPYRIGHT script/echo.c Build.bat \- *.cabal Setup.hs-ALLFILES = $(SRCS) $(TOOLSRCS) $(AUX)--# These files in CVS are NOT included in the src distribution.-NOT = Makefile.inc Makefile.nhc98 src/Makefile.inc src/Makefile.nhc98--.PHONY: all libs tools haddock install register--COMPILERS = $(shell cat obj/compilers)-LIBS = $(patsubst %, libs-%, $(COMPILERS))-TOOLS = $(patsubst %, tools-%, $(COMPILERS))-INSTALL = $(patsubst %, install-%, $(COMPILERS))-FILESONLY = $(patsubst %, install-filesonly-%, $(COMPILERS))--all: $(LIBS) $(TOOLS)-libs: $(LIBS)-tools: $(TOOLS)-install: $(INSTALL)-install-filesonly: $(FILESONLY)-libs-ghc:- cd obj/ghc; $(MAKE) HC=$(shell cat obj/ghccmd) libs-libs-nhc98:- cd obj/nhc98; $(MAKE) HC=nhc98 libs-libs-hugs:- @echo "No building required for Hugs version of $(SOFTWARE) libs."-tools-ghc:- cd obj/ghc; $(MAKE) HC=$(shell cat obj/ghccmd) toolset-tools-nhc98:- cd obj/nhc98; $(MAKE) HC=nhc98 toolset-tools-hugs:- @echo "No building required for Hugs version of $(SOFTWARE) tools."-install-ghc:- cd obj/ghc; $(MAKE) HC=$(shell cat obj/ghccmd) install-ghc-install-nhc98:- cd obj/nhc98; $(MAKE) HC=nhc98 install-nhc98-install-hugs:- hugs-package src- cd obj/hugs; $(MAKE) install-tools-hugs-install-filesonly-ghc:- cd obj/ghc; $(MAKE) HC=$(shell cat obj/ghccmd) install-filesonly-ghc-install-filesonly-nhc98:- cd obj/nhc98; $(MAKE) HC=nhc98 install-filesonly-nhc98-install-filesonly-hugs: install-hugs-haddock:- mkdir -p docs/haddock- for dir in $(DIRS); \- do mkdir -p docs/haddock/src/$$dir; \- done- for file in $(SRCS); \- do $(CPP) -D__NHC__ $$file >$$file.uncpp; \- HsColour -anchor -html $$file >docs/haddock/`dirname $$file`/`basename $$file .hs`.html; \- done- haddock --html --title=$(SOFTWARE) --odir=docs/haddock \- --package=$(SOFTWARE) \- --source-module="src/%{MODULE/.//}.html" \- --source-entity="src/%{MODULE/.//}.html#%{NAME}" \- $(patsubst %, %.uncpp, $(SRCS))- rm -f $(patsubst %, %.uncpp, $(SRCS))--# packaging a distribution--srcDist: $(ALLFILES) haddock- rm -f $(SOFTWARE)-$(VERSION).tar $(SOFTWARE)-$(VERSION).tar.gz- mkdir $(SOFTWARE)-$(VERSION)- tar cf - $(ALLFILES) | ( cd $(SOFTWARE)-$(VERSION); tar xf - )- tar cf $(SOFTWARE)-$(VERSION).tar $(SOFTWARE)-$(VERSION)- rm -rf $(SOFTWARE)-$(VERSION)- gzip $(SOFTWARE)-$(VERSION).tar--zipDist: $(ALLFILES) haddock- rm -f $(SOFTWARE)-$(VERSION).zip- mkdir $(SOFTWARE)-$(VERSION)- tar cf - $(ALLFILES) | ( cd $(SOFTWARE)-$(VERSION); tar xf - )- zip -r $(SOFTWARE)-$(VERSION).zip $(SOFTWARE)-$(VERSION)- rm -rf $(SOFTWARE)-$(VERSION)---# clear up rubbish-clean:- rm -rf obj/ghc obj/nhc98 obj/hugs- cd examples; rm -f *.hi *.o-realclean: clean- rm -rf obj
− README
@@ -1,61 +0,0 @@- polyparse - a collection of alternative parser combinator libraries- ---------------------------------------------------------------------Installation instructions:-We currently support nhc98, ghc, and Hugs. The automatic configuration-detects which compilers/interpreters you have, and prepares a build-tree for each. Installation may require write-permission on the system-directories of the compiler/interpreter. The libraries and interfaces-can then be used as "-package polyparse" (for ghc/nhc98 - no extra options-required for Hugs).-- sh configure- make- make install--Options to configure are:- --buildwith=... e.g. ghc-6.6, to build for a specific compiler- --prefix=... e.g. /usr/local, to change installation location--Complaints to: :-)- Malcolm.Wallace@cs.york.ac.uk--P.S.- For those building on Windows /without/ Cygwin, you can avoid the need- for configure/make steps by simply running the minimal build script in- Build.bat- You will need to edit it for the location of your compiler etc.-------What this package contains:-- docs/ Some rudimentary HTML documentation about the libraries.- docs/haddock/ Haddock-generated API documentation.- examples/ Some small examples of how the libraries are used.-- src/Text- Parse A replacement for the Prelude Read class.- src/Text/ParserCombinators- HuttonMeijer Early parser combinators from 1996.- HuttonMeijerWallace Extended for arbitrary token type + running- state + error msgs.- Poly Space-efficient combinators that allow arbitrary- token type.- PolyState arbitrary token type + running state.- PolyLazy arbitrary token type + lazy return of results.- PolyStateLazy arbitrary token type + running state + lazy results.- src/Text/ParserCombinators/Poly- Base A class-based interface to more specific parser types.- Plain The instance for simple polymorphic parsers.- Lazy The instance for lazy polymorphic parsers.- State The instance for strict polymorphic parsers with state.- StateLazy The instance for lazy polymorphic parsers with state.- Stream An experimental instance for stream-based parsers.- src/Text/ParserCombinators/Poly/NoLeak- An experimental attempt to plug more space leaks.- Plain The instance for simple non-leaking parsers.- Lazy The instance for lazy non-leaking parsers.- State The instance for strict non-leaking parsers with state.- StateLazy The instance for lazy non-leaking parsers with state.------
− configure
@@ -1,320 +0,0 @@-#!/bin/sh-# configure -- prepare to compile/install the polyparse package-# modified from the HaXml configure script: January 2007-# author: Malcolm.Wallace@cs.york.ac.uk, August 2002--SOFTWARE="polyparse"-VERSION="1.0"--if [ -f obj/prefix ]-then INSTALLDIR=`cat obj/prefix`-else INSTALLDIR=-fi--# We need a working `echo' command: at least Solaris2.6 may not have it.-CCC=${CC-gcc}-case `echo -n hello | wc -c | ( read n ; echo $n )` in- 5) ;;- *) echo "The builtin 'echo' command doesn't do '-n' - emulating it."- $CCC -o script/echo script/echo.c- echo () { $PWD/script/echo "$@"; } ;;-esac--# We need a working `which' command: CYGWIN at least doesn't have it,-# and some installed 'which's behave badly, e.g. Solaris, OSF/1.-which () {- ( for path in `echo \"$PATH\" | sed -e 's/:/\" \"/g'`- do- thefile=`echo $path | tr -d "\""`/$1- if [ -f "$thefile" -a -x "$thefile" ]- then echo $thefile- exit 0- fi- done; exit 1 )-}--DARWIN=false-CYGWIN=false-MINGW=false-SUNOS=false-case `uname -s` in- CYGWIN*) CYGWIN=true;;- MINGW*) MINGW=true ;;- Darwin*) DARWIN=true ;;- SunOS*) SUNOS=true ;;-esac--# Process command-line arguments-while [ "$1" != "" ]-do- case $1 in- --buildwith=*) BUILDWITH=`echo "$1" | cut -c13-` ;;- --buildopts=*) BUILDOPTS=$BUILDOPTS" "`echo "$1" | cut -c13-` ;;- --prefix=*) INSTALLDIR=`echo "$1" | cut -c10-` ;;- --help|-h)- echo "`basename $0` options: [default in brackets]"- echo " --buildwith=(ghc|hugs|nhc98) Build $SOFTWARE for the given compiler [detected]"- echo " --buildopts=flags Give extra flags needed by your build compiler [none]"- echo " --prefix=dir Installed files go under dir [compiler-specific]"- exit 0 ;;- --version|-v) echo "$SOFTWARE: $VERSION"- exit 0 ;;- *) echo "`basename $0`: unrecognised option $1"- echo ' (use --help for option information)'- exit 1 ;;- esac- shift-done--echo "Looking for Haskell compilers:"-# Assume that we start out with a blank config.-HMAKEKNOWN=-GHCKNOWN=-NHCKNOWN=-HUGSKNOWN=-HMAKENUM=0-GHCNUM=0-NHCNUM=0-HUGSNUM=0--echo -n " Looking for hmake... "-if which hmake >/dev/null 2>&1-then- HMAKEKNOWN=`which hmake`- HMAKEVERSION=`${HMAKEKNOWN} --version | head -1 | cut -d' ' -f2`- HMAKENUM=`echo $HMAKEVERSION | tr "v." " " | ( read x y z; echo $x$y )`-fi-if [ "$HMAKEKNOWN" != "" ]-then echo "found ${HMAKEVERSION}"-else echo "(not found)"-fi--echo -n " Looking for ghc... "-if which ghc >/dev/null 2>&1-then- GHCKNOWN=`which ghc`- GHCVERSION=`${GHCKNOWN} --version 2>&1 | sed 's/^.*version[ ]*\([0-9.]*\).*/\1/'`- GHCNUM=`echo $GHCVERSION | tr "v." " " | ( read x y z; echo $x$y; )`- if [ "$GHCNUM" -lt "100" ]- then GHCNUM=${GHCNUM}0- fi-fi-if [ "$GHCKNOWN" = "" ]-then echo "(not found)"-else echo "found ${GHCVERSION}"- if [ "$GHCNUM" -lt "602" ]- then echo " Warning: $SOFTWARE needs ghc-6.2 or later. Ignoring ghc."- GHCKNOWN=- else GHCLIBDIR=`${GHCKNOWN} -v 2>&1 | grep ' package config file: ' | head -1 | sed 's/.* package config file: //'`- if $CYGWIN; then GHCLIBDIR=`cygpath -u $GHCLIBDIR`; fi- if $MINGW; then GHCLIBDIR=`echo $GHCLIBDIR | tr '\\\\' '/'`; fi- GHCLIBDIR=`dirname $GHCLIBDIR`- GHCINCDIR=$GHCLIBDIR/imports- fi-fi--# There may be another version of ghc to look for.-if [ -n "$BUILDWITH" ]-then-if [ "`basename $BUILDWITH | cut -c1-3`" = "ghc" ]-then- VER=`basename $BUILDWITH | cut -c5-`- if [ -n "$VER" -a "$VER" != "$GHCVERSION" ]- then- echo -n " Looking for $BUILDWITH... "- if which $BUILDWITH >/dev/null 2>&1- then- GHC2KNOWN=`which $BUILDWITH`- GHC2VERSION=`${GHC2KNOWN} --version 2>&1 | sed 's/^.*version[ ]*\([0-9.]*\).*/\1/'`- GHC2NUM=`echo $GHC2VERSION | tr "." " " | ( read x y z; echo $x$y; )`- if [ "$GHC2NUM" -lt "100" ]- then GHC2NUM=${GHC2NUM}0- fi- fi- if [ "$GHC2KNOWN" = "" ]- then echo "(not found)"- else echo "found ${GHC2VERSION}"- if [ "$GHC2NUM" -lt "602" ]- then echo " Warning: $SOFTWARE needs ghc-6.2 or later. Ignoring."- GHC2KNOWN=- else GHCKNOWN="$GHC2KNOWN"- GHCVERSION="$GHC2VERSION"- GHCNUM="$GHC2NUM"- GHCLIBDIR=`${GHCKNOWN} -v 2>&1 | grep ' package config file: ' | head -1 | sed 's/.* package config file: //'`- if $CYGWIN; then GHCLIBDIR=`cygpath -u $GHCLIBDIR`; fi- if $MINGW; then GHCLIBDIR=`echo $GHCLIBDIR | tr '\\\\' '/'`; fi- GHCLIBDIR=`dirname $GHCLIBDIR`- GHCINCDIR=$GHCLIBDIR/imports- fi- fi- fi-fi-fi--echo -n " Looking for nhc98... "-if which nhc98 >/dev/null 2>&1-then- NHCKNOWN=`which nhc98`- NHCVERSION=`${NHCKNOWN} --version | head -1 | cut -d' ' -f2`- NHCNUM=`echo $NHCVERSION | tr "v." " " | ( read x y z; echo $x$y )`-fi-if [ "$NHCKNOWN" = "" ]-then echo "(not found)"-else echo "found ${NHCVERSION}"- if [ "$HMAKENUM" -lt "306" ]- then echo " Warning: building with nhc98 needs hmake-3.06 or later."- echo " Available from: http://www.haskell.org/hmake/"- fi- if [ "$NHCNUM" -lt "116" ]- then echo " Warning: $SOFTWARE needs nhc98-1.16 or later. Ignoring nhc98."- NHCKNOWN=- else NHCLIBDIR=`grep '^NHC98LIBDIR' $NHCKNOWN | cut -c27- | cut -d'}' -f1 | head -1`- NHCINCDIR=`grep '^NHC98INCDIR' $NHCKNOWN | cut -c27- | cut -d'}' -f1 | head -1`- fi-fi--month() {- read mon yr;- case $mon in- Jan*) echo 01;;- Feb*) echo 02;;- Mar*) echo 03;;- Apr*) echo 04;;- May) echo 05;;- Jun*) echo 06;;- Jul*) echo 07;;- Aug*) echo 08;;- Sep*) echo 09;;- Oct*) echo 10;;- Nov*) echo 11;;- Dec*) echo 12;;- *) echo 00;;- esac;-}--echo -n " Looking for hugs... "-if which hugs >/dev/null 2>&1-then- HUGSKNOWN=`which hugs`- HUGSVERSION=`echo :q | $HUGSKNOWN 2>/dev/null | grep Version | cut -c18-32`- HUGSNUM=`echo $HUGSVERSION | cut -d' ' -f2`- HUGSNUM=$HUGSNUM`echo $HUGSVERSION | month`-fi-if [ "$HUGSKNOWN" = "" ]-then echo "(not found)"-else echo "found ${HUGSVERSION}"- if [ "$HUGSNUM" -lt "200309" ]- then echo " Warning: $SOFTWARE configuration only supports Hugs >= Sept 2003."- HUGSKNOWN=- fi-fi--if [ ! -z "$BUILDWITH" ]-then- echo " You want to build for only... $BUILDWITH"- if [ "`echo $BUILDWITH | cut -c1-3`" = "ghc" ]- then- if [ -z "$GHCKNOWN" ]- then echo ' *** Did not find ghc - cannot continue.'- exit 1- else NHCKNOWN=- HUGSKNOWN=- fi- else if [ "$BUILDWITH" = "nhc98" ]- then- if [ -z "$NHCKNOWN" ]- then echo ' *** Did not find nhc98 - cannot continue.'- exit 1- else GHCKNOWN=- HUGSKNOWN=- fi- else if [ "`echo $BUILDWITH | cut -c1-4`" = "hugs" ]- then- if [ -z "$HUGSKNOWN" ]- then echo ' *** Did not find hugs - cannot continue.'- exit 1- else GHCKNOWN=- NHCKNOWN=- fi- else echo ' *** I do not recognise this compiler:' $BUILDWITH- exit 1- fi;fi;fi;-fi--echo " Files ultimately install in:" # details generated below-echo " (re-run ./configure --prefix=... if this wasn't your intention)"--if [ "$INSTALLDIR" != "" ]-then- GHCLIBDIR=$INSTALLDIR/$SOFTWARE-$VERSION/ghc-$GHCVERSION/lib- GHCINCDIR=$INSTALLDIR/$SOFTWARE-$VERSION/ghc-$GHCVERSION/imports-fi--# Prepare to build.-if [ ! -d obj ]-then mkdir obj-fi-if [ -f obj/compilers ]-then rm obj/compilers-fi-if [ "$HUGSKNOWN" != "" ]-then- echo hugs >>obj/compilers- if [ ! -d obj/hugs ]- then mkdir obj/hugs- fi- cp -Rp src/Makefile obj/hugs-fi-if [ "$GHCKNOWN" != "" ]-then- echo ghc >>obj/compilers- if [ ! -d obj/ghc ]- then mkdir obj/ghc- fi- echo $GHCLIBDIR >obj/ghc/ghclibdir- echo $GHCINCDIR >obj/ghc/ghcincdir- echo " $GHCLIBDIR" # report location to tty- echo " $GHCINCDIR" # report location to tty- if $CYGWIN || $MINGW- then cygpath -w ${GHCLIBDIR} >obj/ghc/ghclibdirraw- cygpath -w ${GHCINCDIR}/ >obj/ghc/ghcincdirraw- else echo ${GHCLIBDIR} >obj/ghc/ghclibdirraw- echo ${GHCINCDIR}/ >obj/ghc/ghcincdirraw- fi- if ghc-pkg-$GHCVERSION -l >/dev/null- then echo ghc-pkg-$GHCVERSION >obj/ghc/ghcpkgcmd- else echo ghc-pkg >obj/ghc/ghcpkgcmd- fi- echo ${BUILDWITH-ghc} >obj/ghccmd- cp -Rp src/Text src/Makefile src/pkg.conf obj/ghc- if [ "$GHCNUM" -ge "504" ]- then echo "-package base" >obj/ghc/ghcpkgs- else echo "" >obj/ghc/ghcpkgs- fi-fi-if [ "$NHCKNOWN" != "" ]-then- echo nhc98 >>obj/compilers- if [ ! -d obj/nhc98 ]- then mkdir obj/nhc98- fi- echo $NHCLIBDIR >obj/nhc98/nhc98libdir- echo $NHCINCDIR >obj/nhc98/nhc98incdir- echo " $NHCLIBDIR" # report location to tty- echo " $NHCINCDIR" # report location to tty- cp -Rp src/Text src/Makefile obj/nhc98- if [ "$NHCNUM" -ge "116" ]- then echo "-package base" >obj/nhc98/nhc98pkgs- else echo "" >obj/nhc98/nhc98pkgs- fi-fi--echo $INSTALLDIR >obj/prefix-if $CYGWIN || $MINGW ; then echo .exe >obj/exe; else touch obj/exe; fi-if $CYGWIN || $MINGW ; then echo main.exe >obj/out; else echo a.out >obj/out; fi-if $DARWIN ; then echo "-all_load -x"; else echo --whole-archive; fi >obj/ldopt-if $SUNOS ; then echo "-z allextract" >obj/ldopt; fi---echo "Ready to build. Type 'make' then (as root) 'make install'."-exit 0
− docs/changelog.html
@@ -1,96 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-<html>-<head>-<title>- polyparse change log-</title>-</head>--<body bgcolor='#ffffff'>--<center>-<h1>polyparse change log</h1>-</center>-<hr>--<h3>Changes in polyparse-1.2</h3>-<p>-<ul>-<li>Bugfix: Text.Parse.parseFloat now accepts ordinary floating point- notation, in addition to scientific (exponent) notation.-</ul>--<h3>Changes in polyparse-1.2</h3>-<p>-<ul>-<li>Improves the Text.Parse implementation significantly. Where- previously all the parsers for builtin basic datatype (Int,Float,Char)- were just thin wrappers over the H'98 Read instances, now they are all- proper parsers, therefore they should (a) be faster; (b) give better- error messages.-<li>Reduced the number of implementation variations to choose from.- In particular, NoLeak has become the default implementation, and- the previous default has been dropped (because it space-leaks).-<!---<li>[desired] The class interface providing common operations across all- implementations, now need be no slower than the previous- cut-n-pasted interface, due to compiler specialisation of all the- instances.-<li>[desired] New combinators for parsing infix structures, with- associativity and precedence information.-<li>[desired] Multiple layers of bracketing can be parsed in linear time,- rather than the previous exponential solution.--->-</ul>--<h3>Changes in polyparse-1.1</h3>-<p>-<ul>-<li>Much improved the laziness of the PolyLazy combinators.-<li>Addition of a class-based interface to the Poly libraries, to- reduce code duplication amongst the variations, and to allow for- more experimentation with different implementations.-<li>Several new experimental implementations of the interface.-</ul>--<h3>Changes in polyparse-1.0</h3>-<p>-<ul>-<li>Version number change from 1.00 to 1.0, for silly cabal/hackage.-<li>Minor fix to parsing strings in Text.Parse.-</ul>--<h3>Changes in polyparse-1.00</h3>-<p>-<ul>-<li>No changes, but released separately from HaXml-</ul>--<h3>Changes in HaXml-1.16</h3>-<p>-<ul>-<li> New: lazier parsers- <ul>- <li> <tt>Text.XML.HaXml.ParseLazy</tt>- <li> <tt>Text.XML.HaXml.Html.ParseLazy</tt>- <li> <tt>Text.ParserCombinators.PolyLazy</tt>- <li> <tt>Text.ParserCombinators.PolyStateLazy</tt>- </ul>-</ul>--<h3>Changes in HaXml-1.15</h3>-<p>-<ul>-<li> New: DrIFT has now been fully updated to- produce instances of Text.ParserCombinators.TextParser.Parse.-<li> New: the parser combinator library Poly has been split into two- variations, Poly and PolyState. They have almost the same API,- only the latter includes a running state where the former does not.-<li> The TextParser library (a replacement for the Haskell'98 Read class)- has also been improved with more new combinators. Really, these- parser combinator experiments do not belong in HaXml, and will- eventually be split out into a separate package.-</ul>--</body>-</html>
− docs/haddock/Text-Parse.html
@@ -1,1172 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.Parse</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/Parse.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.Parse</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parse class is a replacement for the standard Read class. -</A-></DT-><DD-><DL-><DT-><A HREF="#2"->Combinators specific to string input, lexed haskell-style-</A-></DT-><DT-><A HREF="#3"->Parsers for literal numerics and characters-</A-></DT-><DT-><A HREF="#4"->Re-export all the more general combinators from Poly too-</A-></DT-></DL-></DD-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->type</SPAN-> <A HREF="#t%3ATextParser"->TextParser</A-> a = <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> Char a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->class</SPAN-> <A HREF="#t%3AParse"->Parse</A-> a <SPAN CLASS="keyword"->where</SPAN-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><A HREF="#v%3Aparse"->parse</A-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparsePrec"->parsePrec</A-> :: Int -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseList"->parseList</A-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> [a]</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseByRead"->parseByRead</A-> :: Read a => String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aword"->word</A-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AisWord"->isWord</A-> :: String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoptionalParens"->optionalParens</A-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aparens"->parens</A-> :: Bool -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Afield"->field</A-> :: <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a => String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aconstructors"->constructors</A-> :: [(String, <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a)] -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aenumeration"->enumeration</A-> :: Show a => String -> [a] -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseSigned"->parseSigned</A-> :: Real a => <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseInt"->parseInt</A-> :: Integral a => String -> a -> (Char -> Bool) -> (Char -> Int) -> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseDec"->parseDec</A-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseOct"->parseOct</A-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseHex"->parseHex</A-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseFloat"->parseFloat</A-> :: RealFrac a => <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AparseLitChar"->parseLitChar</A-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly.html"->Text.ParserCombinators.Poly</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parse class is a replacement for the standard Read class. -</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="doc"->The Parse class is a replacement for the standard Read class. It is a- specialisation of the (poly) Parser monad for String input.- There are instances defined for all Prelude types.- For user-defined types, you can write your own instance, or use- DrIFT to generate them automatically, e.g. {-! derive : Parse !-}-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->type</SPAN-> <A NAME="t%3ATextParser"-></A-><B->TextParser</B-> a = <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> Char a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#TextParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->A synonym for Parser Char, i.e. string input (no state)-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->class</SPAN-> <A NAME="t%3AParse"-></A-><B->Parse</B-> a <SPAN CLASS="keyword"->where</SPAN-></TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#Parse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->The class <TT->Parse</TT-> is a replacement for <TT->Read</TT->, operating over String input.- Essentially, it permits better error messages for why something failed to- parse. It is rather important that <TT->parse</TT-> can read back exactly what- is generated by the corresponding instance of <TT->show</TT->. To apply a parser- to some text, use <TT->runParser</TT->.-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="section4"->Methods</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aparse"-></A-><B->parse</B-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->A straightforward parser for an item. (A minimal definition of- a class instance requires either |parse| or |parsePrec|.)-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparsePrec"-></A-><B->parsePrec</B-> :: Int -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parsePrec"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->A straightforward parser for an item, given the precedence of- any surrounding expression. (Precedence determines whether- parentheses are mandatory or optional.)-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseList"-></A-><B->parseList</B-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseList"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parsing a list of items by default accepts the [] and comma syntax,- except when the list is really a character string using "".-</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parse')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parse" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Bool</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Char</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Double</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Float</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Int</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Integer</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> Ordering</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> ()</TD-></TR-><TR-><TD CLASS="decl"->(<A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a, <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> b) => <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> (a, b)</TD-></TR-><TR-><TD CLASS="decl"->(<A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a, <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> b, <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> c) => <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> (a, b, c)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a => <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> (Maybe a)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a => <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> [a]</TD-></TR-><TR-><TD CLASS="decl"->(<A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a, <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> b) => <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> (Either a b)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseByRead"-></A-><B->parseByRead</B-> :: Read a => String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseByRead"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->If there already exists a Read instance for a type, then we can make- a Parser for it, but with only poor error-reporting. The string argument- is the expected type or value (for error-reporting only).-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->Combinators specific to string input, lexed haskell-style-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aword"-></A-><B->word</B-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#word"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One lexical chunk (Haskell-style lexing).-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AisWord"-></A-><B->isWord</B-> :: String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#isWord"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Ensure that the next input word is the given string. (Note the input- is lexed as haskell, so wordbreaks at spaces, symbols, etc.)-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoptionalParens"-></A-><B->optionalParens</B-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#optionalParens"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Allow true string parens around an item.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aparens"-></A-><B->parens</B-> :: Bool -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parens"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Allow nested parens around an item (one set required when Bool is True).-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Afield"-></A-><B->field</B-> :: <A HREF="Text-Parse.html#t%3AParse"->Parse</A-> a => String -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#field"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deal with named field syntax. The string argument is the field name,- and the parser returns the value of the field.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aconstructors"-></A-><B->constructors</B-> :: [(String, <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a)] -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#constructors"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse one of a bunch of alternative constructors. In the list argument,- the first element of the pair is the constructor name, and- the second is the parser for the rest of the value. The first matching- parse is returned.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aenumeration"-></A-><B->enumeration</B-> :: Show a => String -> [a] -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#enumeration"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse one of the given nullary constructors (an enumeration).- The string argument is the name of the type, and the list argument- should contain all of the possible enumeration values.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->Parsers for literal numerics and characters-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseSigned"-></A-><B->parseSigned</B-> :: Real a => <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseSigned"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseInt"-></A-><B->parseInt</B-> :: Integral a => String -> a -> (Char -> Bool) -> (Char -> Int) -> a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseInt"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseDec"-></A-><B->parseDec</B-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseDec"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseOct"-></A-><B->parseOct</B-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseOct"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseHex"-></A-><B->parseHex</B-> :: Integral a => a -> <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseHex"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseFloat"-></A-><B->parseFloat</B-> :: RealFrac a => <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseFloat"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AparseLitChar"-></A-><B->parseLitChar</B-> :: <A HREF="Text-Parse.html#t%3ATextParser"->TextParser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/Parse.html#parseLitChar"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->Re-export all the more general combinators from Poly too-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly.html"->Text.ParserCombinators.Poly</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-HuttonMeijer.html
@@ -1,1572 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.HuttonMeijer</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.HuttonMeijer</FONT-></TD-><TD ALIGN="right"-><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="infohead"->Portability</TD-><TD CLASS="infoval"->All-- A LIBRARY OF MONADIC PARSER COMBINATORS- - 29th July 1996- - Graham Hutton Erik Meijer- University of Nottingham University of Utrecht</TD-></TR-><TR-><TD CLASS="infohead"->Stability</TD-><TD CLASS="infoval"->Stable</TD-></TR-><TR-><TD CLASS="infohead"->Maintainer</TD-><TD CLASS="infoval"->Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Description</TD-></TR-><TR-><TD CLASS="doc"-><P->This Haskell script defines a library of parser combinators, and is- taken from sections 1-6 of our article <A HREF="Monadic Parser Combinators.html"->Monadic Parser Combinators</A->.- Some changes to the library have been made in the move from Gofer- to Haskell:-</P-><UL-><LI-> Do notation is used in place of monad comprehension notation;-</LI-><LI-> The parser datatype is defined using <A HREF="newtype.html"->newtype</A->, to avoid the overhead- of tagging and untagging parsers with the P constructor.-</LI-></UL-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> a = <A HREF="#v%3AP"->P</A-> ([Token] -> [(a, [Token])])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aitem"->item</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Token</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Afirst"->first</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Apapply"->papply</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> [Token] -> [(a, [Token])]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3A%2B%2B%2B"->(+++)</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asat"->sat</A-> :: (Token -> Bool) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Token</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asepby"->sepby</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asepby1"->sepby1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainl"->chainl</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainl1"->chainl1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainr"->chainr</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainr1"->chainr1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aops"->ops</A-> :: [(<A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> c -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achar"->char</A-> :: Char -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Adigit"->digit</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Alower"->lower</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aupper"->upper</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aletter"->letter</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aalphanum"->alphanum</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Astring"->string</A-> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aident"->ident</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anat"->nat</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aint"->int</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aspaces"->spaces</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Acomment"->comment</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Ajunk"->junk</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Askip"->skip</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Atoken"->token</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anatural"->natural</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Ainteger"->integer</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asymbol"->symbol</A-> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aidentifier"->identifier</A-> :: [String] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Documentation</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->The parser monad-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([Token] -> [(a, [Token])])</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-></TD-></TR-><TR-><TD CLASS="decl"->Monad <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-></TD-></TR-><TR-><TD CLASS="decl"->MonadPlus <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-></TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aitem"-></A-><B->item</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Token</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#item"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Afirst"-></A-><B->first</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#first"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Apapply"-></A-><B->papply</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> [Token] -> [(a, [Token])]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#papply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3A%2B%2B%2B"-></A-><B->(+++)</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#%2B%2B%2B"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asat"-></A-><B->sat</B-> :: (Token -> Bool) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Token</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#sat"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asepby"-></A-><B->sepby</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#sepby"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asepby1"-></A-><B->sepby1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#sepby1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainl"-></A-><B->chainl</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#chainl"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainl1"-></A-><B->chainl1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#chainl1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainr"-></A-><B->chainr</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#chainr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainr1"-></A-><B->chainr1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#chainr1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aops"-></A-><B->ops</B-> :: [(<A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#ops"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> c -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achar"-></A-><B->char</B-> :: Char -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#char"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Adigit"-></A-><B->digit</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#digit"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Alower"-></A-><B->lower</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#lower"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aupper"-></A-><B->upper</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#upper"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aletter"-></A-><B->letter</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#letter"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aalphanum"-></A-><B->alphanum</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Char</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#alphanum"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Astring"-></A-><B->string</B-> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#string"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aident"-></A-><B->ident</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#ident"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anat"-></A-><B->nat</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#nat"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aint"-></A-><B->int</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#int"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aspaces"-></A-><B->spaces</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#spaces"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Acomment"-></A-><B->comment</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#comment"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Ajunk"-></A-><B->junk</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#junk"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Askip"-></A-><B->skip</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#skip"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Atoken"-></A-><B->token</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#token"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anatural"-></A-><B->natural</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#natural"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Ainteger"-></A-><B->integer</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> Int</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#integer"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asymbol"-></A-><B->symbol</B-> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#symbol"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aidentifier"-></A-><B->identifier</B-> :: [String] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Parser</A-> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijer.html#identifier"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-HuttonMeijerWallace.html
@@ -1,1352 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.HuttonMeijerWallace</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.HuttonMeijerWallace</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The parser monad-</A-></DT-><DT-><A HREF="#2"->Primitive parser combinators-</A-></DT-><DT-><A HREF="#3"->Derived combinators-</A-></DT-><DT-><A HREF="#4"->Error handling-</A-></DT-><DT-><A HREF="#5"->State handling-</A-></DT-><DT-><A HREF="#6"->Re-parsing-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Description</TD-></TR-><TR-><TD CLASS="doc"->This library of monadic parser combinators is based on the ones- defined by Graham Hutton and Erik Meijer. It has been extended by- Malcolm Wallace to use an abstract token type (no longer just a- string) as input, and to incorporate state in the monad, useful- for symbol tables, macros, and so on. Basic facilities for error- reporting have also been added, and later extended by Graham Klyne- to return the errors through an <TT->Either</TT-> type, rather than just- calling <TT->error</TT->.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t e a = <A HREF="#v%3AP"->P</A-> (s -> [Either e t] -> ParseResult s t e a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aitem"->item</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aeof"->eof</A-> :: Show p => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Apapply"->papply</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t String a -> s -> [Either String t] -> [(a, s, [Either String t])]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Apapply%27"->papply'</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> s -> [Either e t] -> Either e [(a, s, [Either e t])]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3A%2B%2B%2B"->(+++)</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Atok"->tok</A-> :: Eq t => t -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anottok"->nottok</A-> :: Eq t => [t] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asepby"->sepby</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asepby1"->sepby1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainl"->chainl</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainl1"->chainl1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainr"->chainr</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Achainr1"->chainr1</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aops"->ops</A-> :: [(<A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: (Show p, Show t) => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e c -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AtoEOF"->toEOF</A-> :: Show p => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aelserror"->elserror</A-> :: (Show p, Show t) => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a -> String -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Astupd"->stupd</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Astquery"->stquery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Astget"->stget</A-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [Either e t] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e ()</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The parser monad-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [Either e t] -> ParseResult s t e a)</TD-><TD CLASS="rdoc"->The parser type is parametrised on the types of the state <TT->s</TT->,- the input tokens <TT->t</TT->, error-type <TT->e</TT->, and the result value <TT->a</TT->.- The state and remaining input are threaded through the monad.-</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e)</TD-></TR-><TR-><TD CLASS="decl"->MonadPlus (<A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="2"->Primitive parser combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aitem"-></A-><B->item</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#item"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the first remaining token.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aeof"-></A-><B->eof</B-> :: Show p => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#eof"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Fail if end of input is not reached-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Apapply"-></A-><B->papply</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t String a -> s -> [Either String t] -> [(a, s, [Either String t])]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#papply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply the parser to some real input, given an initial state value.- If the parser fails, raise error to halt the program.- (This is the original exported behaviour - to allow the caller to- deal with the error differently, see <TT->papply'</TT->.)-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Apapply%27"-></A-><B->papply'</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> s -> [Either e t] -> Either e [(a, s, [Either e t])]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#papply%27"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply the parser to some real input, given an initial state value.- If the parser fails, return a diagnostic message to the caller.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="3"->Derived combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3A%2B%2B%2B"-></A-><B->(+++)</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#%2B%2B%2B"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->A choice between parsers. Keep only the first success.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Atok"-></A-><B->tok</B-> :: Eq t => t -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#tok"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the first token if it equals the argument.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anottok"-></A-><B->nottok</B-> :: Eq t => [t] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#nottok"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the first token if it does not equal the argument.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver zero or more values of <TT->a</TT->.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver one or more values of <TT->a</TT->.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asepby"-></A-><B->sepby</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#sepby"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver zero or more values of <TT->a</TT-> separated by <TT->b</TT->'s.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asepby1"-></A-><B->sepby1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#sepby1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver one or more values of <TT->a</TT-> separated by <TT->b</TT->'s.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainl"-></A-><B->chainl</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#chainl"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainl1"-></A-><B->chainl1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#chainl1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainr"-></A-><B->chainr</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#chainr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Achainr1"-></A-><B->chainr1</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#chainr1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aops"-></A-><B->ops</B-> :: [(<A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#ops"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: (Show p, Show t) => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e b -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e c -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) e b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AtoEOF"-></A-><B->toEOF</B-> :: Show p => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#toEOF"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Accept a complete parse of the input only, no partial parses.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="4"->Error handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aelserror"-></A-><B->elserror</B-> :: (Show p, Show t) => <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a -> String -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s (p, t) String a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#elserror"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->If the parser fails, generate an error message.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="5"->State handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Astupd"-></A-><B->stupd</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#stupd"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Astquery"-></A-><B->stquery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#stquery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Astget"-></A-><B->stget</B-> :: <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#stget"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="6"->Re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [Either e t] -> <A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Parser</A-> s t e ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/HuttonMeijerWallace.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->This is useful for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-Base.html
@@ -1,1140 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.Base</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.Base</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The PolyParse class-</A-></DT-><DT-><A HREF="#2"->Combinators general to all parser types.-</A-></DT-><DD-><DL-><DT-><A HREF="#3"->Simple combinators-</A-></DT-><DT-><A HREF="#4"->Error-handling-</A-></DT-><DT-><A HREF="#5"->Choices-</A-></DT-><DT-><A HREF="#6"->Sequences-</A-></DT-></DL-></DD-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->class</SPAN-> (Functor p, Monad p) => <A HREF="#t%3APolyParse"->PolyParse</A-> p <SPAN CLASS="keyword"->where</SPAN-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><A HREF="#v%3Acommit"->commit</A-> :: p a -> p a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErr"->adjustErr</A-> :: p a -> (String -> String) -> p a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AonFail"->onFail</A-> :: p a -> p a -> p a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf%27"->oneOf'</A-> :: [(String, p a)] -> p a</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aapply"->apply</A-> :: p (a -> b) -> p a -> p b</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Adiscard"->discard</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p b -> p a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AfailBad"->failBad</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => String -> p a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErrBad"->adjustErrBad</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> (String -> String) -> p a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aindent"->indent</A-> :: Int -> String -> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf"->oneOf</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => [p a] -> p a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aoptional"->optional</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p (Maybe a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aexactly"->exactly</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => Int -> p a -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy"->sepBy</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p sep -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy1"->sepBy1</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p sep -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AbracketSep"->bracketSep</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p bra -> p sep -> p ket -> p a -> p [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p bra -> p ket -> p a -> p a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p z -> p [a]</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The PolyParse class-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->class</SPAN-> (Functor p, Monad p) => <A NAME="t%3APolyParse"-></A-><B->PolyParse</B-> p <SPAN CLASS="keyword"->where</SPAN-></TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#PolyParse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"-><P->The <TT->PolyParse</TT-> class is an abstraction over all the current- concrete representations of monadic parser combinators in this- package. The common feature is two-level error-handling.- Some primitives must be implemented specific to each parser type- (e.g. depending on whether the parser has a running state, or- whether it is lazy). But given those primitives, large numbers of- combinators do not depend any further on the internal structure of- the particular parser.-</P-><P->There are two additional basic combinators that we expect to be implemented- afresh for every concrete type, but which (for technical reasons)- cannot be class methods. They are <TT->next</TT-> and <TT->satisfy</TT->.-</P-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="section4"->Methods</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Acommit"-></A-><B->commit</B-> :: p a -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#commit"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Commit is a way of raising the severity of any errors found within- its argument. Used in the middle of a parser definition, it means that- any operations prior to commitment fail softly, but after commitment,- they fail hard.-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErr"-></A-><B->adjustErr</B-> :: p a -> (String -> String) -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#adjustErr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AadjustErr"->adjustErr</A-></TT-> f</TT-> applies the transformation <TT->f</TT-> to any error message- generated in <TT->p</TT->, having no effect if <TT->p</TT-> succeeds.-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AonFail"-></A-><B->onFail</B-> :: p a -> p a -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#onFail"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AonFail"->onFail</A-></TT-> q</TT-> means parse p, unless p fails, in which case- parse q instead.- Can be chained together to give multiple attempts to parse something.- (Note that q could itself be a failing parser, e.g. to change the error- message from that defined in p to something different.)- However, a severe failure in p cannot be ignored.-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf%27"-></A-><B->oneOf'</B-> :: [(String, p a)] -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#oneOf%27"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative that succeeds, but if none succeed,- report only the severe errors, and if none of those, then report- all the soft errors.-</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aapply"-></A-><B->apply</B-> :: p (a -> b) -> p a -> p b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#apply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parsed function to a parsed value.- Rather like ordinary function application lifted into parsers.-</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:PolyParse')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:PolyParse" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> []</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="2"->Combinators general to all parser types.-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->Simple combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Adiscard"-></A-><B->discard</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p b -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#discard"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->x <TT-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Adiscard"->discard</A-></TT-> y</TT-> parses both x and y, but discards the result of y.- Rather like <TT->const</TT-> lifted into parsers.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->Error-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AfailBad"-></A-><B->failBad</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => String -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#failBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->When a simple fail is not strong enough, use failBad for emphasis.- An emphasised (severe) error cannot be overridden by choice- operators.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErrBad"-></A-><B->adjustErrBad</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> (String -> String) -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#adjustErrBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->adjustErrBad</TT-> is just like <TT->adjustErr</TT-> except it also raises the- severity of the error.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aindent"-></A-><B->indent</B-> :: Int -> String -> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#indent"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Helper for formatting error messages: indents all lines by a fixed amount.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="5"->Choices-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf"-></A-><B->oneOf</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => [p a] -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#oneOf"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative in the list that succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aoptional"-></A-><B->optional</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p (Maybe a)</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#optional"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Aoptional"->optional</A-></TT-> indicates whether the parser succeeded through the Maybe type.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="6"->Sequences-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aexactly"-></A-><B->exactly</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => Int -> p a -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#exactly"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'exactly n p' parses precisely n items, using the parser p, in sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'many p' parses a list of elements with individual parser p.- Cannot fail, since an empty list is a valid return value.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy"-></A-><B->sepBy</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p sep -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#sepBy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy1"-></A-><B->sepBy1</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p sep -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#sepBy1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AbracketSep"-></A-><B->bracketSep</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p bra -> p sep -> p ket -> p a -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#bracketSep"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items, discarding the start, end, and separator- items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p bra -> p ket -> p a -> p a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a bracketed item, discarding the brackets.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> p => p a -> p z -> p [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Base.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'manyFinally e t' parses a possibly-empty sequence of e's,- terminated by a t. The final t is discarded. Any parse failures- could be due either to a badly-formed terminator or a badly-formed- element, so it raises both possible errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-Lazy.html
@@ -1,608 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.Lazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.Lazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#4"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> t a = <A HREF="#v%3AP"->P</A-> ([t] -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Result</A-> [t] a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->data</SPAN-> <A HREF="#t%3AResult"->Result</A-> z a</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"->= <A HREF="#v%3ASuccess"->Success</A-> z a</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3AFailure"->Failure</A-> z String</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3ACommitted"->Committed</A-> (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Result</A-> z a)</TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([t] -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Result</A-> [t] a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->data</SPAN-> <A NAME="t%3AResult"-></A-><B->Result</B-> z a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#Result"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->A return type like Either, that distinguishes not only between- right and wrong answers, but also has gradations of wrongness.- This should only be used for writing very primitive- parsers - really it is an internal detail of the library.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3ASuccess"-></A-><B->Success</B-> z a</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3AFailure"-></A-><B->Failure</B-> z String</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3ACommitted"-></A-><B->Committed</B-> (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Result</A-> z a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Result')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Result" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Result</A-> z)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Parser</A-> t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Lazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="4"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-NoLeak-Lazy.html
@@ -1,461 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.NoLeak.Lazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.NoLeak.Lazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#4"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> t a = <A HREF="#v%3AP"->P</A-> ([t] -> Result [t] a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([t] -> Result [t] a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Lazy.html#t%3AParser"->Parser</A-> t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Lazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="4"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-NoLeak-Plain.html
@@ -1,461 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.NoLeak.Plain</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.NoLeak.Plain</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#4"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> t a = <A HREF="#v%3AP"->P</A-> ([t] -> Result [t] a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t a -> [t] -> (Either String a, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([t] -> Result [t] a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t a -> [t] -> (Either String a, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-Plain.html#t%3AParser"->Parser</A-> t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/Plain.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="4"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-NoLeak-State.html
@@ -1,600 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.NoLeak.State</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.NoLeak.State</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->State-handling-</A-></DT-><DT-><A HREF="#4"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#5"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> Result [t] s a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> Result [t] s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-State.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/State.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="5"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-NoLeak-StateLazy.html
@@ -1,644 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.NoLeak.StateLazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.NoLeak.StateLazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->State-handling-</A-></DT-><DT-><A HREF="#4"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#5"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> Result [t] s a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> Result [t] s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-NoLeak-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="5"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-Plain.html
@@ -1,608 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.Plain</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.Plain</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#4"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> t a = <A HREF="#v%3AP"->P</A-> ([t] -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Result</A-> [t] a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->data</SPAN-> <A HREF="#t%3AResult"->Result</A-> z a</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"->= <A HREF="#v%3ASuccess"->Success</A-> z a</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3AFailure"->Failure</A-> z String</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3ACommitted"->Committed</A-> (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Result</A-> z a)</TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t a -> [t] -> (Either String a, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([t] -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Result</A-> [t] a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->data</SPAN-> <A NAME="t%3AResult"-></A-><B->Result</B-> z a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#Result"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->A return type like Either, that distinguishes not only between- right and wrong answers, but also has commitment, so that a failure- cannot be undone. This should only be used for writing very primitive- parsers - really it is an internal detail of the library.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3ASuccess"-></A-><B->Success</B-> z a</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3AFailure"-></A-><B->Failure</B-> z String</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3ACommitted"-></A-><B->Committed</B-> (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Result</A-> z a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Result')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Result" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Result</A-> z)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t a -> [t] -> (Either String a, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Parser</A-> t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/Plain.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="4"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-State.html
@@ -1,747 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.State</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.State</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->State-handling-</A-></DT-><DT-><A HREF="#4"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#5"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Result</A-> [t] s a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->data</SPAN-> <A HREF="#t%3AResult"->Result</A-> z s a</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"->= <A HREF="#v%3ASuccess"->Success</A-> z s a</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3AFailure"->Failure</A-> z s String</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3ACommitted"->Committed</A-> (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Result</A-> z s a)</TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Result</A-> [t] s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->data</SPAN-> <A NAME="t%3AResult"-></A-><B->Result</B-> z s a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#Result"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->A return type like Either, that distinguishes not only between- right and wrong answers, but also has gradations of wrongness.- This should only be used for writing very primitive- parsers - really it is an internal detail of the library.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3ASuccess"-></A-><B->Success</B-> z s a</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3AFailure"-></A-><B->Failure</B-> z s String</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3ACommitted"-></A-><B->Committed</B-> (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Result</A-> z s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Result')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Result" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Result</A-> z s)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/State.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="5"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly-StateLazy.html
@@ -1,791 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly.StateLazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly.StateLazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DD-><DL-><DT-><A HREF="#2"->basic parsers-</A-></DT-><DT-><A HREF="#3"->State-handling-</A-></DT-><DT-><A HREF="#4"->re-parsing-</A-></DT-></DL-></DD-><DT-><A HREF="#5"->Re-export all more general combinators-</A-></DT-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Result</A-> [t] s a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->data</SPAN-> <A HREF="#t%3AResult"->Result</A-> z s a</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"->= <A HREF="#v%3ASuccess"->Success</A-> z s a</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3AFailure"->Failure</A-> z s String</TD-></TR-><TR-><TD CLASS="decl"->| <A HREF="#v%3ACommitted"->Committed</A-> (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Result</A-> z s a)</TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->This <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyState- instead)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Result</A-> [t] s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->PolyParse</A-> (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->data</SPAN-> <A NAME="t%3AResult"-></A-><B->Result</B-> z s a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#Result"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->A return type like Either, that distinguishes not only between- right and wrong answers, but also has gradations of wrongness.- This should only be used for writing very primitive- parsers - really it is an internal detail of the library.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3ASuccess"-></A-><B->Success</B-> z s a</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3AFailure"-></A-><B->Failure</B-> z s String</TD-><TD CLASS="rdoc"-></TD-></TR-><TR-><TD CLASS="arg"-><A NAME="v%3ACommitted"-></A-><B->Committed</B-> (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Result</A-> z s a)</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Result')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Result" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Result</A-> z s)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="2"->basic parsers-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/Poly/StateLazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="5"->Re-export all more general combinators-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-Poly.html
@@ -1,100 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.Poly</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/Poly.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.Poly</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Documentation</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="decl"->module <A HREF="Text-ParserCombinators-Poly-Plain.html"->Text.ParserCombinators.Poly.Plain</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-PolyLazy.html
@@ -1,1448 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.PolyLazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.PolyLazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype.-</A-></DT-><DT-><A HREF="#2"->Combinators:-</A-></DT-><DD-><DL-><DT-><A HREF="#3"->Primitives-</A-></DT-><DT-><A HREF="#4"->Error-handling-</A-></DT-><DT-><A HREF="#5"->Choices-</A-></DT-><DT-><A HREF="#6"->Sequences-</A-></DT-><DT-><A HREF="#7"->Re-parsing-</A-></DT-></DL-></DD-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> t a = <A HREF="#v%3AP"->P</A-> ([t] -> (Either String a, [t]))</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AfailBad"->failBad</A-> :: String -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Acommit"->commit</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aapply"->apply</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t (a -> b) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Adiscard"->discard</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t b -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErr"->adjustErr</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErrBad"->adjustErrBad</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aindent"->indent</A-> :: Int -> String -> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AonFail"->onFail</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf"->oneOf</A-> :: [<A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf%27"->oneOf'</A-> :: [(String, <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a)] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aoptional"->optional</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t (Maybe a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aexactly"->exactly</A-> :: Int -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy"->sepBy</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy1"->sepBy1</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AbracketSep"->bracketSep</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t bra -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ket -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t bra -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ket -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t z -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ()</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype.-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="doc"->When applied, these parsers do not return explicit failure.- An exception is- raised instead. This allows partial results to be returned- before a full parse is complete.- One of the key ways to ensure that your parser is properly lazy,- is to parse the initial portion of text returning a function, then- use the <TT->apply</TT-> combinator to build the final value.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->The <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting. It can be used for arbitrary token types, not just- String input. (If you require a running state, use module PolyStateLazy- instead.)-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> ([t] -> (Either String a, [t]))</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> [t] -> (a, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an input token sequence. The parser cannot return- an error value explicitly, so errors raise an exception. Thus, results- can be partial (lazily constructed, but containing undefined).-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AfailBad"-></A-><B->failBad</B-> :: String -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#failBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Simple failure can be corrected, but when a simple fail is not strong- enough, use failBad for emphasis. It guarantees parsing will- terminate with an exception.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Acommit"-></A-><B->commit</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#commit"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Commit is a way of raising the severity of any errors found within- its argument. Used in the middle of a parser definition, it means that- any operations prior to commitment fail softly, but after commitment,- they fail hard.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="2"->Combinators:-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->Primitives-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token satifying a predicate-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aapply"-></A-><B->apply</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t (a -> b) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#apply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parsed function to a parsed value-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Adiscard"-></A-><B->discard</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t b -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#discard"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->x <TT-><A HREF="Text-ParserCombinators-PolyLazy.html#v%3Adiscard"->discard</A-></TT-> y</TT-> parses both x and y, but discards the result of y-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->Error-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErr"-></A-><B->adjustErr</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#adjustErr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyLazy.html#v%3AadjustErr"->adjustErr</A-></TT-> f</TT-> applies the transformation <TT->f</TT-> to any error message- generated in <TT->p</TT->, having no effect if <TT->p</TT-> succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErrBad"-></A-><B->adjustErrBad</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#adjustErrBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->adjustErrBad</TT-> is just like <TT->adjustErr</TT-> except it also raises the- severity of the error.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aindent"-></A-><B->indent</B-> :: Int -> String -> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#indent"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Helper for formatting error messages: indents all lines by a fixed amount.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="5"->Choices-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AonFail"-></A-><B->onFail</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#onFail"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyLazy.html#v%3AonFail"->onFail</A-></TT-> q</TT-> means parse p unless p fails in which case parse q instead.- Can be chained together to give multiple attempts to parse something.- (Note that q could itself be a failing parser, e.g. to change the error- message from that defined in p to something different.)- However, a *severe* failure in p cannot be ignored.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf"-></A-><B->oneOf</B-> :: [<A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#oneOf"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative in the list that succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf%27"-></A-><B->oneOf'</B-> :: [(String, <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a)] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#oneOf%27"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative that succeeds, but if none succeed,- report only the severe errors, and if none of those, then report- all the soft errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aoptional"-></A-><B->optional</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t (Maybe a)</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#optional"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT-><A HREF="Text-ParserCombinators-PolyLazy.html#v%3Aoptional"->optional</A-></TT-> indicates whether the parser succeeded through the Maybe type.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="6"->Sequences-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aexactly"-></A-><B->exactly</B-> :: Int -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#exactly"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'exactly n p' parses a precise number of items, n, using the parser- p, in sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'many p' parses a list of elements with individual parser p.- Cannot fail, since an empty list is a valid return value.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy"-></A-><B->sepBy</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#sepBy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy1"-></A-><B->sepBy1</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#sepBy1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AbracketSep"-></A-><B->bracketSep</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t bra -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t sep -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ket -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#bracketSep"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items, discarding the start, end, and separator- items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t bra -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ket -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a bracketed item, discarding the brackets.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t a -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t z -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'manyFinally e t' parses a possibly-empty sequence of e's,- terminated by a t. Any parse failures could be due either to- a badly-formed terminator or a badly-formed element, so raise- both possible errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="7"->Re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-PolyLazy.html#t%3AParser"->Parser</A-> t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyLazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-PolyState.html
@@ -1,1517 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.PolyState</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/PolyState.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.PolyState</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype-</A-></DT-><DT-><A HREF="#2"->Combinators:-</A-></DT-><DD-><DL-><DT-><A HREF="#3"->Primitives-</A-></DT-><DT-><A HREF="#4"->Error-handling-</A-></DT-><DT-><A HREF="#5"->Choices-</A-></DT-><DT-><A HREF="#6"->Sequences-</A-></DT-><DT-><A HREF="#7"->State-handling-</A-></DT-><DT-><A HREF="#8"->Re-parsing-</A-></DT-></DL-></DD-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> (EitherE String a, s, [t]))</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AfailBad"->failBad</A-> :: String -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Acommit"->commit</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aapply"->apply</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t (a -> b) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Adiscard"->discard</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t b -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErr"->adjustErr</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErrBad"->adjustErrBad</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aindent"->indent</A-> :: Int -> String -> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AonFail"->onFail</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf"->oneOf</A-> :: [<A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf%27"->oneOf'</A-> :: [(String, <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a)] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aexactly"->exactly</A-> :: Int -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy"->sepBy</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy1"->sepBy1</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AbracketSep"->bracketSep</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->The <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting and a running state. It can be used for arbitrary token- types, not just String input.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> (EitherE String a, s, [t]))</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (Either String a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an initial state and input token sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AfailBad"-></A-><B->failBad</B-> :: String -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#failBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->When a simple fail is not strong enough, use failBad for emphasis.- An emphasised (severe) error can propagate out through choice operators.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Acommit"-></A-><B->commit</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#commit"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Commit is a way of raising the severity of any errors found within- its argument. Used in the middle of a parser definition, it means that- any operations prior to commitment fail softly, but after commitment,- they fail hard.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="2"->Combinators:-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->Primitives-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token satifying a predicate-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aapply"-></A-><B->apply</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t (a -> b) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#apply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parsed function to a parsed value-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Adiscard"-></A-><B->discard</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t b -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#discard"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->x <TT-><A HREF="Text-ParserCombinators-PolyState.html#v%3Adiscard"->discard</A-></TT-> y</TT-> parses both x and y, but discards the result of y-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->Error-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErr"-></A-><B->adjustErr</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#adjustErr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyState.html#v%3AadjustErr"->adjustErr</A-></TT-> f</TT-> applies the transformation <TT->f</TT-> to any error message- generated in <TT->p</TT->, having no effect if <TT->p</TT-> succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErrBad"-></A-><B->adjustErrBad</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#adjustErrBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->adjustErrBad</TT-> is just like <TT->adjustErr</TT-> except it also raises the- severity of the error.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aindent"-></A-><B->indent</B-> :: Int -> String -> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#indent"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Helper for formatting error messages: indents all lines by a fixed amount.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="5"->Choices-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AonFail"-></A-><B->onFail</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#onFail"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyState.html#v%3AonFail"->onFail</A-></TT-> q</TT-> means parse p unless p fails in which case parse q instead.- Can be chained together to give multiple attempts to parse something.- (Note that q could itself be a failing parser, e.g. to change the error- message from that defined in p to something different.)- However, a severe failure in p cannot be ignored.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf"-></A-><B->oneOf</B-> :: [<A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#oneOf"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative in the list that succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf%27"-></A-><B->oneOf'</B-> :: [(String, <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a)] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#oneOf%27"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative that succeeds, but if none succeed,- report only the severe errors, and if none of those, then report- all the soft errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="6"->Sequences-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aexactly"-></A-><B->exactly</B-> :: Int -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#exactly"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'exactly n p' parses a precise number of items, n, using the parser- p, in sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'many p' parses a list of elements with individual parser p.- Cannot fail, since an empty list is a valid return value.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy"-></A-><B->sepBy</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#sepBy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy1"-></A-><B->sepBy1</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#sepBy1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AbracketSep"-></A-><B->bracketSep</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#bracketSep"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items, discarding the start, end, and separator- items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a bracketed item, discarding the brackets.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'manyFinally e t' parses a possibly-empty sequence of e's,- terminated by a t. Any parse failures could be due either to- a badly-formed terminator or a badly-formed element, so raise- both possible errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="7"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="8"->Re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-PolyState.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyState.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/Text-ParserCombinators-PolyStateLazy.html
@@ -1,1581 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->Text.ParserCombinators.PolyStateLazy</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html"->Source code</A-></TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="modulebar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><FONT SIZE="6"->Text.ParserCombinators.PolyStateLazy</FONT-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="section4"-><B->Contents</B-></TD-></TR-><TR-><TD-><DL-><DT-><A HREF="#1"->The Parser datatype.-</A-></DT-><DT-><A HREF="#2"->Combinators:-</A-></DT-><DD-><DL-><DT-><A HREF="#3"->Primitives-</A-></DT-><DT-><A HREF="#4"->Error-handling-</A-></DT-><DT-><A HREF="#5"->Choices-</A-></DT-><DT-><A HREF="#6"->Sequences-</A-></DT-><DT-><A HREF="#7"->State-handling-</A-></DT-><DT-><A HREF="#8"->Re-parsing-</A-></DT-></DL-></DD-></DL-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"->Synopsis</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="decl"-><SPAN CLASS="keyword"->newtype</SPAN-> <A HREF="#t%3AParser"->Parser</A-> s t a = <A HREF="#v%3AP"->P</A-> (s -> [t] -> (Either String a, s, [t]))</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3ArunParser"->runParser</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AfailBad"->failBad</A-> :: String -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Acommit"->commit</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Anext"->next</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Asatisfy"->satisfy</A-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t t</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aapply"->apply</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t (a -> b) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t b</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Adiscard"->discard</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t b -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErr"->adjustErr</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AadjustErrBad"->adjustErrBad</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aindent"->indent</A-> :: Int -> String -> String</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AonFail"->onFail</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf"->oneOf</A-> :: [<A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AoneOf%27"->oneOf'</A-> :: [(String, <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a)] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aoptional"->optional</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t (Maybe a)</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Aexactly"->exactly</A-> :: Int -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany"->many</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Amany1"->many1</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy"->sepBy</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AsepBy1"->sepBy1</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AbracketSep"->bracketSep</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Abracket"->bracket</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AmanyFinally"->manyFinally</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstUpdate"->stUpdate</A-> :: (s -> s) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstQuery"->stQuery</A-> :: (s -> a) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3AstGet"->stGet</A-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t s</TD-></TR-><TR-><TD CLASS="s8"-></TD-></TR-><TR-><TD CLASS="decl"-><A HREF="#v%3Areparse"->reparse</A-> :: [t] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="1"->The Parser datatype.-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="doc"->Parsers do not return explicit failure. An exception is raised- instead. This allows partial results to be returned before a- full parse is complete.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><SPAN CLASS="keyword"->newtype</SPAN-> <A NAME="t%3AParser"-></A-><B->Parser</B-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#Parser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="ndoc"->The <TT->Parser</TT-> datatype is a fairly generic parsing monad with error- reporting and a running state. It can be used for arbitrary token- types, not just String input.-</TD-></TR-><TR-><TD CLASS="section4"->Constructors</TD-></TR-><TR-><TD CLASS="body"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="arg"-><A NAME="v%3AP"-></A-><B->P</B-> (s -> [t] -> (Either String a, s, [t]))</TD-><TD CLASS="rdoc"-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section4"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"-> Instances</TD-></TR-><TR-><TD CLASS="body"-><DIV ID="i:Parser" STYLE="display:block;"-><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"-><TR-><TD CLASS="decl"->Functor (<A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-><TR-><TD CLASS="decl"->Monad (<A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t)</TD-></TR-></TABLE-></DIV-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3ArunParser"-></A-><B->runParser</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> s -> [t] -> (a, s, [t])</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#runParser"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parser to an initial state and input token sequence.- The parser cannot return an error value explicitly, so errors- raise an exception. Thus, results can be partial (lazily constructed,- but containing undefined).-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AfailBad"-></A-><B->failBad</B-> :: String -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#failBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Simple failure can be corrected, but when a simple fail is not strong- enough, use failBad for emphasis. It guarantees parsing will terminate- with an exception.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Acommit"-></A-><B->commit</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#commit"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Commit is a way of raising the severity of any errors found within- its argument. Used in the middle of a parser definition, it means that- any operations prior to commitment fail softly, but after commitment,- they fail hard.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section1"-><A NAME="2"->Combinators:-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="3"->Primitives-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Anext"-></A-><B->next</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#next"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Asatisfy"-></A-><B->satisfy</B-> :: (t -> Bool) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t t</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#satisfy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->One token satifying a predicate-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aapply"-></A-><B->apply</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t (a -> b) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t b</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#apply"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Apply a parsed function to a parsed value-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Adiscard"-></A-><B->discard</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t b -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#discard"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->x <TT-><A HREF="Text-ParserCombinators-PolyStateLazy.html#v%3Adiscard"->discard</A-></TT-> y</TT-> parses both x and y, but discards the result of y-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="4"->Error-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErr"-></A-><B->adjustErr</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#adjustErr"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyStateLazy.html#v%3AadjustErr"->adjustErr</A-></TT-> f</TT-> applies the transformation <TT->f</TT-> to any error message- generated in <TT->p</TT->, having no effect if <TT->p</TT-> succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AadjustErrBad"-></A-><B->adjustErrBad</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> (String -> String) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#adjustErrBad"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->adjustErrBad</TT-> is just like <TT->adjustErr</TT-> except it also raises the- severity of the error.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aindent"-></A-><B->indent</B-> :: Int -> String -> String</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#indent"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Helper for formatting error messages: indents all lines by a fixed amount.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="5"->Choices-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AonFail"-></A-><B->onFail</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#onFail"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT->p <TT-><A HREF="Text-ParserCombinators-PolyStateLazy.html#v%3AonFail"->onFail</A-></TT-> q</TT-> means parse p unless p fails in which case parse q instead.- Can be chained together to give multiple attempts to parse something.- (Note that q could itself be a failing parser, e.g. to change the error- message from that defined in p to something different.)- However, a *severe* failure in p cannot be ignored.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf"-></A-><B->oneOf</B-> :: [<A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#oneOf"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative in the list that succeeds.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AoneOf%27"-></A-><B->oneOf'</B-> :: [(String, <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a)] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#oneOf%27"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse the first alternative that succeeds, but if none succeed,- report only the severe errors, and if none of those, then report- all the soft errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aoptional"-></A-><B->optional</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t (Maybe a)</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#optional"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"-><TT-><A HREF="Text-ParserCombinators-PolyStateLazy.html#v%3Aoptional"->optional</A-></TT-> indicates whether the parser succeeded through the Maybe type.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="6"->Sequences-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Aexactly"-></A-><B->exactly</B-> :: Int -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#exactly"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'exactly n p' parses a precise number of items, n, using the parser- p, in sequence.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany"-></A-><B->many</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#many"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'many p' parses a list of elements with individual parser p.- Cannot fail, since an empty list is a valid return value.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Amany1"-></A-><B->many1</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#many1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy"-></A-><B->sepBy</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#sepBy"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AsepBy1"-></A-><B->sepBy1</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#sepBy1"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a non-empty list of items separated by discarded junk.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AbracketSep"-></A-><B->bracketSep</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t sep -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#bracketSep"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a list of items, discarding the start, end, and separator- items.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Abracket"-></A-><B->bracket</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t bra -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ket -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#bracket"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Parse a bracketed item, discarding the brackets.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AmanyFinally"-></A-><B->manyFinally</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t z -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t [a]</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#manyFinally"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->'manyFinally e t' parses a possibly-empty sequence of e's,- terminated by a t. Any parse failures could be due either to- a badly-formed terminator or a badly-formed element, so raise- both possible errors.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="7"->State-handling-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstUpdate"-></A-><B->stUpdate</B-> :: (s -> s) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#stUpdate"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Update the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstQuery"-></A-><B->stQuery</B-> :: (s -> a) -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t a</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#stQuery"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Query the internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3AstGet"-></A-><B->stGet</B-> :: <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t s</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#stGet"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Deliver the entire internal state.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="section2"-><A NAME="8"->Re-parsing-</A-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="topdecl"-><TABLE CLASS="declbar"-><TR-><TD CLASS="declname"-><A NAME="v%3Areparse"-></A-><B->reparse</B-> :: [t] -> <A HREF="Text-ParserCombinators-PolyStateLazy.html#t%3AParser"->Parser</A-> s t ()</TD-><TD CLASS="declbut"-><A HREF="src/Text/ParserCombinators/PolyStateLazy.html#reparse"->Source</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="doc"->Push some tokens back onto the front of the input stream and reparse.- This is useful e.g. for recursively expanding macros. When the- user-parser recognises a macro use, it can lookup the macro- expansion from the parse state, lex it, and then stuff the- lexed expansion back down into the parser.-</TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-43.html
@@ -1,150 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (+)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->+++</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3A%2B%2B%2B"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3A%2B%2B%2B"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-A.html
@@ -1,162 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (A)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->adjustErr</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AadjustErr"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->adjustErrBad</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AadjustErrBad"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->alphanum</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aalphanum"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->apply</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Aapply"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-B.html
@@ -1,166 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (B)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->bracket</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Abracket"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Abracket"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Abracket"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->bracketSep</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AbracketSep"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-C.html
@@ -1,278 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (C)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->Committed</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3ACommitted"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3ACommitted"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3ACommitted"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3ACommitted"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->chainl</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainl"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Achainl"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->chainl1</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainl1"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Achainl1"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->chainr</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainr"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Achainr"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->chainr1</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainr1"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Achainr1"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->char</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achar"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->comment</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Acomment"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->commit</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Acommit"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->constructors</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Aconstructors"->Text.Parse</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-D.html
@@ -1,146 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (D)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->digit</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Adigit"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->discard</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Adiscard"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-E.html
@@ -1,162 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (E)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->elserror</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Aelserror"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->enumeration</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Aenumeration"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->eof</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Aeof"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->exactly</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Aexactly"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-F.html
@@ -1,190 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (F)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->Failure</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3AFailure"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3AFailure"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3AFailure"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AFailure"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->failBad</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AfailBad"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->field</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Afield"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->first</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Afirst"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-I.html
@@ -1,198 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (I)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->ident</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aident"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->identifier</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aidentifier"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->indent</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Aindent"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->int</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aint"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->integer</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Ainteger"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->isWord</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AisWord"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->item</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aitem"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Aitem"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-J.html
@@ -1,138 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (J)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->junk</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Ajunk"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-L.html
@@ -1,146 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (L)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->letter</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aletter"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->lower</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Alower"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-M.html
@@ -1,206 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (M)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->many</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Amany"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Amany"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Amany"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->many1</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Amany1"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Amany1"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Amany1"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->manyFinally</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AmanyFinally"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AmanyFinally"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-N.html
@@ -1,190 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (N)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->nat</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Anat"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->natural</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Anatural"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->next</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3Anext"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3Anext"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3Anext"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3Anext"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->nottok</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Anottok"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-O.html
@@ -1,190 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (O)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->onFail</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AonFail"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->oneOf</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AoneOf"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->oneOf'</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AoneOf%27"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->ops</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aops"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Aops"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->optional</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3Aoptional"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->optionalParens</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AoptionalParens"->Text.Parse</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-P.html
@@ -1,374 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (P)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->P</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3AP"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3AP"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3AP"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3AP"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->5 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3AP"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->6 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AP"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->Parse</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#t%3AParse"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->Parser</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#t%3AParser"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AParser"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AParser"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->5 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#t%3AParser"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->6 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AParser"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->PolyParse</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#t%3APolyParse"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->papply</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Apapply"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Apapply"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->papply'</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Apapply%27"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parens</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Aparens"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parse</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Aparse"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseByRead</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseByRead"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseDec</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseDec"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseFloat</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseFloat"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseHex</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseHex"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseInt</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseInt"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseList</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseList"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseLitChar</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseLitChar"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseOct</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseOct"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parsePrec</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparsePrec"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->parseSigned</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3AparseSigned"->Text.Parse</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-R.html
@@ -1,246 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (R)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->Result</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#t%3AResult"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#t%3AResult"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#t%3AResult"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Type/Class)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#t%3AResult"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->reparse</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Areparse"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3Areparse"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3Areparse"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->4 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3Areparse"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->5 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3Areparse"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->runParser</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3ArunParser"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3ArunParser"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3ArunParser"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3ArunParser"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-S.html
@@ -1,382 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (S)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry" COLSPAN="2"->Success</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3ASuccess"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3ASuccess"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3ASuccess"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Data Constructor)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3ASuccess"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->sat</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asat"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->satisfy</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Lazy.html#v%3Asatisfy"->Text.ParserCombinators.Poly.Lazy</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Plain.html#v%3Asatisfy"->Text.ParserCombinators.Poly.Plain</A->, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexannot"->3 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3Asatisfy"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->4 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3Asatisfy"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->sepBy</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AsepBy"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry"->sepBy1</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-Base.html#v%3AsepBy1"->Text.ParserCombinators.Poly.Base</A->, Text.ParserCombinators.Poly.Lazy, Text.ParserCombinators.Poly.Plain, Text.ParserCombinators.Poly.State, Text.ParserCombinators.Poly.StateLazy, Text.ParserCombinators.Poly, Text.Parse</TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->sepby</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asepby"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Asepby"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->sepby1</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asepby1"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Asepby1"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->skip</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Askip"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->spaces</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aspaces"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->stGet</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3AstGet"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AstGet"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->stQuery</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3AstQuery"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AstQuery"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry" COLSPAN="2"->stUpdate</TD-></TR-><TR-><TD CLASS="indexannot"->1 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-State.html#v%3AstUpdate"->Text.ParserCombinators.Poly.State</A-></TD-></TR-><TR-><TD CLASS="indexannot"->2 (Function)</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html#v%3AstUpdate"->Text.ParserCombinators.Poly.StateLazy</A-></TD-></TR-><TR-><TD CLASS="indexentry"->stget</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Astget"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->stquery</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Astquery"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->string</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Astring"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-><TR-><TD CLASS="indexentry"->stupd</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Astupd"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->symbol</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asymbol"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-T.html
@@ -1,162 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (T)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->TextParser</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#t%3ATextParser"->Text.Parse</A-></TD-></TR-><TR-><TD CLASS="indexentry"->toEOF</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3AtoEOF"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->tok</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html#v%3Atok"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-></TR-><TR-><TD CLASS="indexentry"->token</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Atoken"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-U.html
@@ -1,138 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (U)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->upper</TD-><TD CLASS="indexlinks"-><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aupper"->Text.ParserCombinators.HuttonMeijer</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index-W.html
@@ -1,138 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index (W)</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD CLASS="indexentry"->word</TD-><TD CLASS="indexlinks"-><A HREF="Text-Parse.html#v%3Aword"->Text.Parse</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/doc-index.html
@@ -1,124 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse (Index)</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Index</TD-></TR-><TR-><TD-><TABLE CELLPADDING="0" CELLSPACING="5"-><TR-><TD-><A HREF="doc-index-A.html"->A</A-></TD-><TD-><A HREF="doc-index-B.html"->B</A-></TD-><TD-><A HREF="doc-index-C.html"->C</A-></TD-><TD-><A HREF="doc-index-D.html"->D</A-></TD-><TD-><A HREF="doc-index-E.html"->E</A-></TD-><TD-><A HREF="doc-index-F.html"->F</A-></TD-><TD-><A HREF="doc-index-I.html"->I</A-></TD-><TD-><A HREF="doc-index-J.html"->J</A-></TD-><TD-><A HREF="doc-index-L.html"->L</A-></TD-><TD-><A HREF="doc-index-M.html"->M</A-></TD-><TD-><A HREF="doc-index-N.html"->N</A-></TD-><TD-><A HREF="doc-index-O.html"->O</A-></TD-><TD-><A HREF="doc-index-P.html"->P</A-></TD-><TD-><A HREF="doc-index-R.html"->R</A-></TD-><TD-><A HREF="doc-index-S.html"->S</A-></TD-><TD-><A HREF="doc-index-T.html"->T</A-></TD-><TD-><A HREF="doc-index-U.html"->U</A-></TD-><TD-><A HREF="doc-index-W.html"->W</A-></TD-><TD-><A HREF="doc-index-43.html"->+</A-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/haddock.css
@@ -1,260 +0,0 @@-/* -------- Global things --------- */--BODY { - background-color: #ffffff;- color: #000000;- font-family: sans-serif;- } --A:link { color: #0000e0; text-decoration: none }-A:visited { color: #0000a0; text-decoration: none }-A:hover { background-color: #e0e0ff; text-decoration: none }--TABLE.vanilla {- width: 100%;- border-width: 0px;- /* I can't seem to specify cellspacing or cellpadding properly using CSS... */-}--TABLE.vanilla2 {- border-width: 0px;-}--/* <TT> font is a little too small in MSIE */-TT { font-size: 100%; }-PRE { font-size: 100%; }--LI P { margin: 0pt } --TD {- border-width: 0px;-}--TABLE.narrow {- border-width: 0px;-}--TD.s8 { height: 8px; }-TD.s15 { height: 15px; }--SPAN.keyword { text-decoration: underline; }--/* Resize the buttom image to match the text size */-IMG.coll { width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em }--/* --------- Contents page ---------- */--DIV.node {- padding-left: 3em;-}--DIV.cnode {- padding-left: 1.75em;-}--SPAN.pkg {- position: absolute;- left: 50em;-}--/* --------- Documentation elements ---------- */--TD.children {- padding-left: 25px;- }--TD.synopsis {- padding: 2px;- background-color: #f0f0f0;- font-family: monospace- }--TD.decl { - padding: 2px;- background-color: #f0f0f0; - font-family: monospace;- vertical-align: top;- }--TD.topdecl {- padding: 2px;- background-color: #f0f0f0;- font-family: monospace;- vertical-align: top;-}--TABLE.declbar {- border-spacing: 0px;- }--TD.declname {- width: 100%;- }--TD.declbut {- padding-left: 5px;- padding-right: 5px;- border-left-width: 1px;- border-left-color: #000099;- border-left-style: solid;- white-space: nowrap;- font-size: small;- }--/* - arg is just like decl, except that wrapping is not allowed. It is- used for function and constructor arguments which have a text box- to the right, where if wrapping is allowed the text box squashes up- the declaration by wrapping it.-*/-TD.arg { - padding: 2px;- background-color: #f0f0f0; - font-family: monospace;- vertical-align: top;- white-space: nowrap;- }--TD.recfield { padding-left: 20px }--TD.doc { - padding-top: 2px;- padding-left: 10px;- }--TD.ndoc { - padding: 2px;- }--TD.rdoc { - padding: 2px;- padding-left: 10px;- width: 100%;- }--TD.body { - padding-left: 10px- }--TD.pkg {- width: 100%;- padding-left: 10px-}--TD.indexentry {- vertical-align: top;- padding-right: 10px- }--TD.indexannot {- vertical-align: top;- padding-left: 20px;- white-space: nowrap- }--TD.indexlinks {- width: 100%- }--/* ------- Section Headings ------- */--TD.section1 {- padding-top: 15px;- font-weight: bold;- font-size: 150%- }--TD.section2 {- padding-top: 10px;- font-weight: bold;- font-size: 130%- }--TD.section3 {- padding-top: 5px;- font-weight: bold;- font-size: 110%- }--TD.section4 {- font-weight: bold;- font-size: 100%- }--/* -------------- The title bar at the top of the page */--TD.infohead {- color: #ffffff;- font-weight: bold;- padding-right: 10px;- text-align: left;-}--TD.infoval {- color: #ffffff;- padding-right: 10px;- text-align: left;-}--TD.topbar {- background-color: #000099;- padding: 5px;-}--TD.title {- color: #ffffff;- padding-left: 10px;- width: 100%- }--TD.topbut {- padding-left: 5px;- padding-right: 5px;- border-left-width: 1px;- border-left-color: #ffffff;- border-left-style: solid;- white-space: nowrap;- }--TD.topbut A:link {- color: #ffffff- }--TD.topbut A:visited {- color: #ffff00- }--TD.topbut A:hover {- background-color: #6060ff;- }--TD.topbut:hover {- background-color: #6060ff- }--TD.modulebar { - background-color: #0077dd;- padding: 5px;- border-top-width: 1px;- border-top-color: #ffffff;- border-top-style: solid;- }--/* --------- The page footer --------- */--TD.botbar {- background-color: #000099;- color: #ffffff;- padding: 5px- }-TD.botbar A:link {- color: #ffffff;- text-decoration: underline- }-TD.botbar A:visited {- color: #ffff00- }-TD.botbar A:hover {- background-color: #6060ff- }-
− docs/haddock/haddock.js
@@ -1,15 +0,0 @@-// Haddock JavaScript utilities-function toggle(button,id)-{- var n = document.getElementById(id).style;- if (n.display == "none")- {- button.src = "minus.gif";- n.display = "block";- }- else- {- button.src = "plus.gif";- n.display = "none";- }-}
− docs/haddock/haskell_icon.gif
binary file changed (911 → absent bytes)
− docs/haddock/index.html
@@ -1,185 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">-<!--Rendered using the Haskell Html Library v0.2-->-<HTML-><HEAD-><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"-><TITLE->polyparse</TITLE-><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"-><SCRIPT SRC="haddock.js" TYPE="text/javascript"-></SCRIPT-></HEAD-><BODY-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD CLASS="topbar"-><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"-><TR-><TD-><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "-></TD-><TD CLASS="title"->polyparse</TD-><TD CLASS="topbut"-><A HREF="index.html"->Contents</A-></TD-><TD CLASS="topbut"-><A HREF="doc-index.html"->Index</A-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="section1"->Modules</TD-></TR-><TR-><TD-><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0"-><TR-><TD STYLE="width: 50em"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:0')" ALT="show/hide"->Text</TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"-><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:0" STYLE="display:block;"-><TR-><TD STYLE="padding-left: 1.25em;width: 48em"-><A HREF="Text-Parse.html"->Text.Parse</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="width: 48em"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:1')" ALT="show/hide"->ParserCombinators</TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"-><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:1" STYLE="display:block;"-><TR-><TD STYLE="padding-left: 1.25em;width: 46em"-><A HREF="Text-ParserCombinators-HuttonMeijer.html"->Text.ParserCombinators.HuttonMeijer</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding-left: 1.25em;width: 46em"-><A HREF="Text-ParserCombinators-HuttonMeijerWallace.html"->Text.ParserCombinators.HuttonMeijerWallace</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="width: 46em"-><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:2')" ALT="show/hide"-><A HREF="Text-ParserCombinators-Poly.html"->Text.ParserCombinators.Poly</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"-><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:2" STYLE="display:block;"-><TR-><TD STYLE="padding-left: 1.25em;width: 44em"-><A HREF="Text-ParserCombinators-Poly-Base.html"->Text.ParserCombinators.Poly.Base</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding-left: 1.25em;width: 44em"-><A HREF="Text-ParserCombinators-Poly-Lazy.html"->Text.ParserCombinators.Poly.Lazy</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding-left: 1.25em;width: 44em"-><A HREF="Text-ParserCombinators-Poly-Plain.html"->Text.ParserCombinators.Poly.Plain</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding-left: 1.25em;width: 44em"-><A HREF="Text-ParserCombinators-Poly-State.html"->Text.ParserCombinators.Poly.State</A-></TD-><TD-></TD-><TD-></TD-></TR-><TR-><TD STYLE="padding-left: 1.25em;width: 44em"-><A HREF="Text-ParserCombinators-Poly-StateLazy.html"->Text.ParserCombinators.Poly.StateLazy</A-></TD-><TD-></TD-><TD-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-></TABLE-></TD-></TR-><TR-><TD CLASS="s15"-></TD-></TR-><TR-><TD CLASS="botbar"->Produced by <A HREF="http://www.haskell.org/haddock/"->Haddock</A-> version 0.8</TD-></TR-></TABLE-></BODY-></HTML->
− docs/haddock/minus.gif
binary file changed (56 → absent bytes)
− docs/haddock/plus.gif
binary file changed (59 → absent bytes)
− docs/haddock/src/Text/Parse.html
@@ -1,387 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/Parse.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>Parse-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parse class is a replacement for the standard Read class. </font>-<a name="line-3"></a> <font color=Blue>-- $parser</font>-<a name="line-4"></a> TextParser <font color=Blue>-- synonym for Parser Char, i.e. string input, no state</font>-<a name="line-5"></a> <font color=Cyan>,</font> Parse<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- instances: (), (a,b), (a,b,c), Maybe a, Either a, [a],</font>-<a name="line-6"></a> <font color=Blue>-- Int, Integer, Float, Double, Char, Bool</font>-<a name="line-7"></a> <font color=Cyan>,</font> parseByRead <font color=Blue>-- :: Read a => String -> TextParser a</font>-<a name="line-8"></a> <font color=Blue>-- ** Combinators specific to string input, lexed haskell-style</font>-<a name="line-9"></a> <font color=Cyan>,</font> word <font color=Blue>-- :: TextParser String</font>-<a name="line-10"></a> <font color=Cyan>,</font> isWord <font color=Blue>-- :: String -> TextParser ()</font>-<a name="line-11"></a> <font color=Cyan>,</font> optionalParens <font color=Blue>-- :: TextParser a -> TextParser a</font>-<a name="line-12"></a> <font color=Cyan>,</font> parens <font color=Blue>-- :: Bool -> TextParser a -> TextParser a</font>-<a name="line-13"></a> <font color=Cyan>,</font> field <font color=Blue>-- :: Parse a => String -> TextParser a</font>-<a name="line-14"></a> <font color=Cyan>,</font> constructors<font color=Blue>-- :: [(String,TextParser a)] -> TextParser a</font>-<a name="line-15"></a> <font color=Cyan>,</font> enumeration <font color=Blue>-- :: Show a => String -> [a] -> TextParser a</font>-<a name="line-16"></a> <font color=Blue>-- ** Parsers for literal numerics and characters</font>-<a name="line-17"></a> <font color=Cyan>,</font> parseSigned-<a name="line-18"></a> <font color=Cyan>,</font> parseInt-<a name="line-19"></a> <font color=Cyan>,</font> parseDec-<a name="line-20"></a> <font color=Cyan>,</font> parseOct-<a name="line-21"></a> <font color=Cyan>,</font> parseHex-<a name="line-22"></a> <font color=Cyan>,</font> parseFloat-<a name="line-23"></a> <font color=Cyan>,</font> parseLitChar-<a name="line-24"></a> <font color=Blue>-- ** Re-export all the more general combinators from Poly too</font>-<a name="line-25"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly-<a name="line-26"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-27"></a>-<a name="line-28"></a><font color=Green><u>import</u></font> Char <font color=Cyan>(</font>isSpace<font color=Cyan>,</font>toLower<font color=Cyan>,</font>isUpper<font color=Cyan>,</font>isDigit<font color=Cyan>,</font>isOctDigit<font color=Cyan>,</font>isHexDigit<font color=Cyan>,</font>digitToInt-<a name="line-29"></a> <font color=Cyan>,</font>ord<font color=Cyan>,</font>chr<font color=Cyan>)</font>-<a name="line-30"></a><font color=Green><u>import</u></font> List <font color=Cyan>(</font>intersperse<font color=Cyan>)</font>-<a name="line-31"></a><font color=Green><u>import</u></font> Ratio-<a name="line-32"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly-<a name="line-33"></a>-<a name="line-34"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-35"></a><font color=Blue>-- $parser</font>-<a name="line-36"></a><font color=Blue>-- The Parse class is a replacement for the standard Read class. It is a</font>-<a name="line-37"></a><font color=Blue>-- specialisation of the (poly) Parser monad for String input.</font>-<a name="line-38"></a><font color=Blue>-- There are instances defined for all Prelude types.</font>-<a name="line-39"></a><font color=Blue>-- For user-defined types, you can write your own instance, or use</font>-<a name="line-40"></a><font color=Blue>-- DrIFT to generate them automatically, e.g. {-! derive : Parse !-}</font>-<a name="line-41"></a>-<a name="line-42"></a><a name="TextParser"></a><font color=Blue>-- | A synonym for Parser Char, i.e. string input (no state)</font>-<a name="line-43"></a><a name="TextParser"></a><font color=Green><u>type</u></font> TextParser a <font color=Red>=</font> Parser Char a-<a name="line-44"></a>-<a name="line-45"></a><a name="Parse"></a><font color=Blue>-- | The class @Parse@ is a replacement for @Read@, operating over String input.</font>-<a name="line-46"></a><a name="Parse"></a><font color=Blue>-- Essentially, it permits better error messages for why something failed to</font>-<a name="line-47"></a><a name="Parse"></a><font color=Blue>-- parse. It is rather important that @parse@ can read back exactly what</font>-<a name="line-48"></a><a name="Parse"></a><font color=Blue>-- is generated by the corresponding instance of @show@. To apply a parser</font>-<a name="line-49"></a><a name="Parse"></a><font color=Blue>-- to some text, use @runParser@.</font>-<a name="line-50"></a><a name="Parse"></a><font color=Green><u>class</u></font> Parse a <font color=Green><u>where</u></font>-<a name="line-51"></a> <font color=Blue>-- | A straightforward parser for an item. (A minimal definition of</font>-<a name="line-52"></a> <font color=Blue>-- a class instance requires either |parse| or |parsePrec|.)</font>-<a name="line-53"></a> parse <font color=Red>::</font> TextParser a-<a name="line-54"></a> parse <font color=Red>=</font> parsePrec <font color=Magenta>0</font>-<a name="line-55"></a> <font color=Blue>-- | A straightforward parser for an item, given the precedence of</font>-<a name="line-56"></a> <font color=Blue>-- any surrounding expression. (Precedence determines whether</font>-<a name="line-57"></a> <font color=Blue>-- parentheses are mandatory or optional.)</font>-<a name="line-58"></a> parsePrec <font color=Red>::</font> Int <font color=Red>-></font> TextParser a-<a name="line-59"></a> parsePrec <font color=Green><u>_</u></font> <font color=Red>=</font> parens False parse-<a name="line-60"></a> <font color=Blue>-- | Parsing a list of items by default accepts the [] and comma syntax,</font>-<a name="line-61"></a> <font color=Blue>-- except when the list is really a character string using \"\".</font>-<a name="line-62"></a> parseList <font color=Red>::</font> TextParser <font color=Red>[</font>a<font color=Red>]</font> <font color=Blue>-- only to distinguish [] and ""</font>-<a name="line-63"></a> parseList <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Magenta>"[]"</font><font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="line-64"></a> <font color=Cyan>`onFail`</font>-<a name="line-65"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Magenta>"["</font><font color=Cyan>;</font> isWord <font color=Magenta>"]"</font><font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="line-66"></a> <font color=Cyan>`onFail`</font>-<a name="line-67"></a> bracketSep <font color=Cyan>(</font>isWord <font color=Magenta>"["</font><font color=Cyan>)</font> <font color=Cyan>(</font>isWord <font color=Magenta>","</font><font color=Cyan>)</font> <font color=Cyan>(</font>isWord <font color=Magenta>"]"</font><font color=Cyan>)</font> parse-<a name="line-68"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Expected a list, but\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-69"></a>-<a name="line-70"></a><a name="parseByRead"></a><font color=Blue>-- | If there already exists a Read instance for a type, then we can make</font>-<a name="line-71"></a><font color=Blue>-- a Parser for it, but with only poor error-reporting. The string argument</font>-<a name="line-72"></a><font color=Blue>-- is the expected type or value (for error-reporting only).</font>-<a name="line-73"></a><font color=Blue>parseByRead</font> <font color=Red>::</font> Read a <font color=Red>=></font> String <font color=Red>-></font> TextParser a-<a name="line-74"></a><font color=Blue>parseByRead</font> name <font color=Red>=</font>-<a name="line-75"></a> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> <font color=Green><u>case</u></font> reads s <font color=Green><u>of</u></font>-<a name="line-76"></a> [] <font color=Red>-></font> Failure s <font color=Cyan>(</font><font color=Magenta>"no parse, expected a "</font><font color=Cyan>++</font>name<font color=Cyan>)</font>-<a name="line-77"></a> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font>s'<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Success s' a-<a name="line-78"></a> <font color=Green><u>_</u></font> <font color=Red>-></font> Failure s <font color=Cyan>(</font><font color=Magenta>"ambiguous parse, expected a "</font><font color=Cyan>++</font>name<font color=Cyan>)</font>-<a name="line-79"></a> <font color=Cyan>)</font>-<a name="line-80"></a>-<a name="line-81"></a><a name="word"></a><font color=Blue>-- | One lexical chunk (Haskell-style lexing).</font>-<a name="line-82"></a><font color=Blue>word</font> <font color=Red>::</font> TextParser String-<a name="line-83"></a><font color=Blue>word</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> <font color=Green><u>case</u></font> lex s <font color=Green><u>of</u></font>-<a name="line-84"></a> [] <font color=Red>-></font> Failure s <font color=Cyan>(</font><font color=Magenta>"no input? (impossible)"</font><font color=Cyan>)</font>-<a name="line-85"></a> <font color=Red>[</font><font color=Cyan>(</font><font color=Magenta>""</font><font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Failure <font color=Magenta>""</font> <font color=Cyan>(</font><font color=Magenta>"no input?"</font><font color=Cyan>)</font>-<a name="line-86"></a> <font color=Red>[</font><font color=Cyan>(</font><font color=Magenta>""</font><font color=Cyan>,</font>s'<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Failure s <font color=Cyan>(</font><font color=Magenta>"lexing failed?"</font><font color=Cyan>)</font>-<a name="line-87"></a> <font color=Cyan>(</font><font color=Cyan>(</font>x<font color=Cyan>,</font>s'<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> Success s' x-<a name="line-88"></a> <font color=Cyan>)</font>-<a name="line-89"></a>-<a name="line-90"></a><a name="isWord"></a><font color=Blue>-- | Ensure that the next input word is the given string. (Note the input</font>-<a name="line-91"></a><font color=Blue>-- is lexed as haskell, so wordbreaks at spaces, symbols, etc.)</font>-<a name="line-92"></a><font color=Blue>isWord</font> <font color=Red>::</font> String <font color=Red>-></font> TextParser String-<a name="line-93"></a><font color=Blue>isWord</font> w <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> w' <font color=Red><-</font> word-<a name="line-94"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> w'<font color=Cyan>==</font>w <font color=Green><u>then</u></font> return w <font color=Green><u>else</u></font> fail <font color=Cyan>(</font><font color=Magenta>"expected "</font><font color=Cyan>++</font>w<font color=Cyan>++</font><font color=Magenta>" got "</font><font color=Cyan>++</font>w'<font color=Cyan>)</font>-<a name="line-95"></a> <font color=Cyan>}</font>-<a name="line-96"></a>-<a name="line-97"></a><a name="optionalParens"></a><font color=Blue>-- | Allow true string parens around an item.</font>-<a name="line-98"></a><font color=Blue>optionalParens</font> <font color=Red>::</font> TextParser a <font color=Red>-></font> TextParser a-<a name="line-99"></a><font color=Blue>optionalParens</font> p <font color=Red>=</font> bracket <font color=Cyan>(</font>isWord <font color=Magenta>"("</font><font color=Cyan>)</font> <font color=Cyan>(</font>isWord <font color=Magenta>")"</font><font color=Cyan>)</font> p <font color=Cyan>`onFail`</font> p-<a name="line-100"></a>-<a name="line-101"></a><a name="parens"></a><font color=Blue>-- | Allow nested parens around an item (one set required when Bool is True).</font>-<a name="line-102"></a><font color=Blue>parens</font> <font color=Red>::</font> Bool <font color=Red>-></font> TextParser a <font color=Red>-></font> TextParser a-<a name="line-103"></a><font color=Blue>parens</font> True p <font color=Red>=</font> bracket <font color=Cyan>(</font>isWord <font color=Magenta>"("</font><font color=Cyan>)</font> <font color=Cyan>(</font>isWord <font color=Magenta>")"</font><font color=Cyan>)</font> <font color=Cyan>(</font>parens False p<font color=Cyan>)</font>-<a name="line-104"></a><font color=Blue>parens</font> False p <font color=Red>=</font> parens True p <font color=Cyan>`onFail`</font> p-<a name="line-105"></a>-<a name="line-106"></a><a name="field"></a><font color=Blue>-- | Deal with named field syntax. The string argument is the field name,</font>-<a name="line-107"></a><font color=Blue>-- and the parser returns the value of the field.</font>-<a name="line-108"></a><font color=Blue>field</font> <font color=Red>::</font> Parse a <font color=Red>=></font> String <font color=Red>-></font> TextParser a-<a name="line-109"></a><font color=Blue>field</font> name <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord name<font color=Cyan>;</font> commit <font color=Cyan>$</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Magenta>"="</font><font color=Cyan>;</font> parse <font color=Cyan>}</font> <font color=Cyan>}</font>-<a name="line-110"></a>-<a name="line-111"></a><a name="constructors"></a><font color=Blue>-- | Parse one of a bunch of alternative constructors. In the list argument,</font>-<a name="line-112"></a><font color=Blue>-- the first element of the pair is the constructor name, and</font>-<a name="line-113"></a><font color=Blue>-- the second is the parser for the rest of the value. The first matching</font>-<a name="line-114"></a><font color=Blue>-- parse is returned.</font>-<a name="line-115"></a><font color=Blue>constructors</font> <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>TextParser a<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> TextParser a-<a name="line-116"></a><font color=Blue>constructors</font> cs <font color=Red>=</font> oneOf' <font color=Cyan>(</font>map cons cs<font color=Cyan>)</font>-<a name="line-117"></a> <font color=Green><u>where</u></font> cons <font color=Cyan>(</font>name<font color=Cyan>,</font>p<font color=Cyan>)</font> <font color=Red>=</font>-<a name="line-118"></a> <font color=Cyan>(</font> name-<a name="line-119"></a> <font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord name-<a name="line-120"></a> <font color=Cyan>;</font> p <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"got constructor, but within "</font>-<a name="line-121"></a> <font color=Cyan>++</font>name<font color=Cyan>++</font><font color=Magenta>",\n"</font><font color=Cyan>)</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-122"></a> <font color=Cyan>}</font>-<a name="line-123"></a> <font color=Cyan>)</font>-<a name="line-124"></a>-<a name="line-125"></a><font color=Blue>{--<a name="line-126"></a>-- | Parse an infix constructor.-<a name="line-127"></a>infixConstructor :: (Parse a, Parse b) =>-<a name="line-128"></a> String -> Int -> (a->b->c) -> Int -> TextParser c-<a name="line-129"></a>infixConstructor name prec cons = \d->-<a name="line-130"></a> parens (prec<d) (do a <- parsePrec (prec+1)-<a name="line-131"></a> isWord name `adjustErr`-<a name="line-132"></a> (++("expected infix constructor "++name))-<a name="line-133"></a> b <- parsePrec (prec+1)-<a name="line-134"></a> return (cons a b) )-<a name="line-135"></a>-<a name="line-136"></a>--infixLeftAssoc :: (Parse a, Parse b) =>-<a name="line-137"></a>-- String -> Int -> (a->b->a) -> Int -> TextParser a-<a name="line-138"></a>--infixLeftAssoc name prec cons = \d->-<a name="line-139"></a>-- parens (prec<d) (do a <- -<a name="line-140"></a>-}</font>-<a name="line-141"></a>-<a name="line-142"></a><a name="enumeration"></a><font color=Blue>-- | Parse one of the given nullary constructors (an enumeration).</font>-<a name="line-143"></a><font color=Blue>-- The string argument is the name of the type, and the list argument</font>-<a name="line-144"></a><font color=Blue>-- should contain all of the possible enumeration values.</font>-<a name="line-145"></a><font color=Blue>enumeration</font> <font color=Red>::</font> <font color=Cyan>(</font>Show a<font color=Cyan>)</font> <font color=Red>=></font> String <font color=Red>-></font> <font color=Red>[</font>a<font color=Red>]</font> <font color=Red>-></font> TextParser a-<a name="line-146"></a><font color=Blue>enumeration</font> typ cs <font color=Red>=</font> oneOf <font color=Cyan>(</font>map <font color=Cyan>(</font><font color=Red>\</font>c<font color=Red>-></font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Cyan>(</font>show c<font color=Cyan>)</font><font color=Cyan>;</font> return c <font color=Cyan>}</font><font color=Cyan>)</font> cs<font color=Cyan>)</font>-<a name="line-147"></a> <font color=Cyan>`adjustErr`</font>-<a name="line-148"></a> <font color=Cyan>(</font><font color=Cyan>++</font><font color=Cyan>(</font><font color=Magenta>"\n expected "</font><font color=Cyan>++</font>typ<font color=Cyan>++</font><font color=Magenta>" value ("</font><font color=Cyan>++</font>e<font color=Cyan>++</font><font color=Magenta>")"</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-149"></a> <font color=Green><u>where</u></font> e <font color=Red>=</font> concat <font color=Cyan>(</font>intersperse <font color=Magenta>", "</font> <font color=Cyan>(</font>map show <font color=Cyan>(</font>init cs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-150"></a> <font color=Cyan>++</font> <font color=Magenta>", or "</font> <font color=Cyan>++</font> show <font color=Cyan>(</font>last cs<font color=Cyan>)</font>-<a name="line-151"></a>-<a name="line-152"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-153"></a><font color=Blue>-- Instances for all the Standard Prelude types.</font>-<a name="line-154"></a>-<a name="line-155"></a><a name="parseSigned"></a><font color=Blue>-- Numeric types</font>-<a name="line-156"></a><font color=Blue>parseSigned</font> <font color=Red>::</font> Real a <font color=Red>=></font> TextParser a <font color=Red>-></font> TextParser a-<a name="line-157"></a><font color=Blue>parseSigned</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'-'</font> <font color=Red><-</font> next<font color=Cyan>;</font> commit <font color=Cyan>(</font>fmap negate p<font color=Cyan>)</font>-<a name="line-158"></a> <font color=Cyan>`onFail`</font>-<a name="line-159"></a> <font color=Green><u>do</u></font> p-<a name="line-160"></a>-<a name="line-161"></a><a name="parseInt"></a><font color=Blue>parseInt</font> <font color=Red>::</font> <font color=Cyan>(</font>Integral a<font color=Cyan>)</font> <font color=Red>=></font> String <font color=Red>-></font>-<a name="line-162"></a> a <font color=Red>-></font> <font color=Cyan>(</font>Char <font color=Red>-></font> Bool<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Char <font color=Red>-></font> Int<font color=Cyan>)</font> <font color=Red>-></font>-<a name="line-163"></a> a <font color=Red>-></font> TextParser a-<a name="line-164"></a><font color=Blue>parseInt</font> base radix isDigit digitToInt n <font color=Red>=</font> go n-<a name="line-165"></a> <font color=Green><u>where</u></font> go acc <font color=Red>=</font> <font color=Green><u>do</u></font> cs <font color=Red><-</font> many1 <font color=Cyan>(</font>satisfy isDigit<font color=Cyan>)</font>-<a name="line-166"></a> return <font color=Cyan>(</font>foldl1 <font color=Cyan>(</font><font color=Red>\</font>n d<font color=Red>-></font> n<font color=Cyan>*</font>radix<font color=Cyan>+</font>d<font color=Cyan>)</font>-<a name="line-167"></a> <font color=Cyan>(</font>map <font color=Cyan>(</font>fromIntegral<font color=Cyan>.</font>digitToInt<font color=Cyan>)</font> cs<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-168"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>++</font><font color=Cyan>(</font><font color=Magenta>"\nexpected one or more "</font><font color=Cyan>++</font>base<font color=Cyan>++</font><font color=Magenta>" digits"</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-169"></a><a name="parseDec"></a><font color=Blue>parseDec</font><font color=Cyan>,</font> parseOct<font color=Cyan>,</font> parseHex <font color=Red>::</font> <font color=Cyan>(</font>Integral a<font color=Cyan>)</font> <font color=Red>=></font> a <font color=Red>-></font> TextParser a-<a name="line-170"></a><font color=Blue>parseDec</font> <font color=Red>=</font> parseInt <font color=Magenta>"decimal"</font> <font color=Magenta>10</font> Char<font color=Cyan>.</font>isDigit Char<font color=Cyan>.</font>digitToInt-<a name="line-171"></a><a name="parseOct"></a><font color=Blue>parseOct</font> <font color=Red>=</font> parseInt <font color=Magenta>"octal"</font> <font color=Magenta>8</font> Char<font color=Cyan>.</font>isOctDigit Char<font color=Cyan>.</font>digitToInt-<a name="line-172"></a><a name="parseHex"></a><font color=Blue>parseHex</font> <font color=Red>=</font> parseInt <font color=Magenta>"hex"</font> <font color=Magenta>16</font> Char<font color=Cyan>.</font>isHexDigit Char<font color=Cyan>.</font>digitToInt-<a name="line-173"></a>-<a name="line-174"></a><a name="parseFloat"></a><font color=Blue>parseFloat</font> <font color=Red>::</font> <font color=Cyan>(</font>RealFrac a<font color=Cyan>)</font> <font color=Red>=></font> TextParser a-<a name="line-175"></a><font color=Blue>parseFloat</font> <font color=Red>=</font> <font color=Green><u>do</u></font> ds <font color=Red><-</font> many1 <font color=Cyan>(</font>satisfy isDigit<font color=Cyan>)</font>-<a name="line-176"></a> frac <font color=Red><-</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Magenta>'.'</font> <font color=Red><-</font> next-<a name="line-177"></a> many <font color=Cyan>(</font>satisfy isDigit<font color=Cyan>)</font>-<a name="line-178"></a> <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Cyan>++</font><font color=Magenta>"expected digit after ."</font><font color=Cyan>)</font>-<a name="line-179"></a> <font color=Cyan>`onFail`</font> return [] <font color=Cyan>)</font>-<a name="line-180"></a> exp <font color=Red><-</font> <font color=Green><u>if</u></font> null frac <font color=Green><u>then</u></font> exponent-<a name="line-181"></a> <font color=Green><u>else</u></font> exponent <font color=Cyan>`onFail`</font> return <font color=Magenta>0</font>-<a name="line-182"></a> <font color=Cyan>(</font> return <font color=Cyan>.</font> fromRational <font color=Cyan>.</font> <font color=Cyan>(</font><font color=Cyan>*</font> <font color=Cyan>(</font><font color=Magenta>10</font><font color=Cyan>^^</font><font color=Cyan>(</font>exp <font color=Blue>-</font> length frac<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-183"></a> <font color=Cyan>.</font> <font color=Cyan>(</font><font color=Cyan>%</font><font color=Magenta>1</font><font color=Cyan>)</font> <font color=Cyan>.</font> <font color=Cyan>(</font><font color=Red>\</font> <font color=Cyan>(</font>Right x<font color=Cyan>)</font><font color=Red>-></font>x<font color=Cyan>)</font> <font color=Cyan>.</font> fst-<a name="line-184"></a> <font color=Cyan>.</font> runParser <font color=Cyan>(</font>parseDec <font color=Magenta>0</font><font color=Cyan>)</font> <font color=Cyan>)</font> <font color=Cyan>(</font>ds<font color=Cyan>++</font>frac<font color=Cyan>)</font>-<a name="line-185"></a> <font color=Cyan>`onFail`</font>-<a name="line-186"></a> <font color=Green><u>do</u></font> w <font color=Red><-</font> many <font color=Cyan>(</font>satisfy <font color=Cyan>(</font>not<font color=Cyan>.</font>isSpace<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-187"></a> <font color=Green><u>case</u></font> map toLower w <font color=Green><u>of</u></font>-<a name="line-188"></a> <font color=Magenta>"nan"</font> <font color=Red>-></font> return <font color=Cyan>(</font><font color=Magenta>0</font><font color=Cyan>/</font><font color=Magenta>0</font><font color=Cyan>)</font>-<a name="line-189"></a> <font color=Magenta>"infinity"</font> <font color=Red>-></font> return <font color=Cyan>(</font><font color=Magenta>1</font><font color=Cyan>/</font><font color=Magenta>0</font><font color=Cyan>)</font>-<a name="line-190"></a> <font color=Green><u>_</u></font> <font color=Red>-></font> fail <font color=Magenta>"expected a floating point number"</font>-<a name="line-191"></a> <font color=Green><u>where</u></font> exponent <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'e'</font> <font color=Red><-</font> fmap toLower next-<a name="line-192"></a> commit <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Magenta>'+'</font> <font color=Red><-</font> next<font color=Cyan>;</font> parseDec <font color=Magenta>0</font>-<a name="line-193"></a> <font color=Cyan>`onFail`</font>-<a name="line-194"></a> parseSigned <font color=Cyan>(</font>parseDec <font color=Magenta>0</font><font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="line-195"></a>-<a name="line-196"></a><a name="parseLitChar"></a><font color=Blue>parseLitChar</font> <font color=Red>::</font> TextParser Char-<a name="line-197"></a><font color=Blue>parseLitChar</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'\''</font> <font color=Red><-</font> next <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>++</font><font color=Magenta>"expected a literal char"</font><font color=Cyan>)</font>-<a name="line-198"></a> c <font color=Red><-</font> next-<a name="line-199"></a> char <font color=Red><-</font> <font color=Green><u>case</u></font> c <font color=Green><u>of</u></font>-<a name="line-200"></a> <font color=Magenta>'\\'</font> <font color=Red>-></font> next <font color=Cyan>>>=</font> escape-<a name="line-201"></a> <font color=Magenta>'\''</font> <font color=Red>-></font> fail <font color=Magenta>"expected a literal char, got ''"</font>-<a name="line-202"></a> <font color=Green><u>_</u></font> <font color=Red>-></font> return c-<a name="line-203"></a> <font color=Magenta>'\''</font> <font color=Red><-</font> next <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Cyan>++</font><font color=Magenta>"literal char has no final '"</font><font color=Cyan>)</font>-<a name="line-204"></a> return char-<a name="line-205"></a> <font color=Green><u>where</u></font>-<a name="line-206"></a> escape <font color=Magenta>'a'</font> <font color=Red>=</font> return <font color=Magenta>'\a'</font>-<a name="line-207"></a> escape <font color=Magenta>'b'</font> <font color=Red>=</font> return <font color=Magenta>'\b'</font>-<a name="line-208"></a> escape <font color=Magenta>'f'</font> <font color=Red>=</font> return <font color=Magenta>'\f'</font>-<a name="line-209"></a> escape <font color=Magenta>'n'</font> <font color=Red>=</font> return <font color=Magenta>'\n'</font>-<a name="line-210"></a> escape <font color=Magenta>'r'</font> <font color=Red>=</font> return <font color=Magenta>'\r'</font>-<a name="line-211"></a> escape <font color=Magenta>'t'</font> <font color=Red>=</font> return <font color=Magenta>'\t'</font>-<a name="line-212"></a> escape <font color=Magenta>'v'</font> <font color=Red>=</font> return <font color=Magenta>'\v'</font>-<a name="line-213"></a> escape <font color=Magenta>'\\'</font> <font color=Red>=</font> return <font color=Magenta>'\\'</font>-<a name="line-214"></a> escape <font color=Magenta>'"'</font> <font color=Red>=</font> return <font color=Magenta>'"'</font>-<a name="line-215"></a> escape <font color=Magenta>'\''</font> <font color=Red>=</font> return <font color=Magenta>'\''</font>-<a name="line-216"></a> escape <font color=Magenta>'^'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> ctrl <font color=Red><-</font> next-<a name="line-217"></a> <font color=Green><u>if</u></font> ctrl <font color=Cyan>>=</font> <font color=Magenta>'@'</font> <font color=Cyan>&&</font> ctrl <font color=Cyan><=</font> <font color=Magenta>'_'</font>-<a name="line-218"></a> <font color=Green><u>then</u></font> return <font color=Cyan>(</font>chr <font color=Cyan>(</font>ord ctrl <font color=Blue>-</font> ord <font color=Magenta>'@'</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-219"></a> <font color=Green><u>else</u></font> fail <font color=Cyan>(</font><font color=Magenta>"literal char ctrl-escape malformed: \\^"</font>-<a name="line-220"></a> <font color=Cyan>++</font><font color=Red>[</font>ctrl<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-221"></a> escape d <font color=Red>|</font> isDigit d-<a name="line-222"></a> <font color=Red>=</font> fmap chr <font color=Cyan>$</font> parseDec <font color=Cyan>(</font>Char<font color=Cyan>.</font>digitToInt d<font color=Cyan>)</font>-<a name="line-223"></a> escape <font color=Magenta>'o'</font> <font color=Red>=</font> fmap chr <font color=Cyan>$</font> parseOct <font color=Magenta>0</font>-<a name="line-224"></a> escape <font color=Magenta>'x'</font> <font color=Red>=</font> fmap chr <font color=Cyan>$</font> parseHex <font color=Magenta>0</font>-<a name="line-225"></a> escape c <font color=Red>|</font> isUpper c-<a name="line-226"></a> <font color=Red>=</font> mnemonic c-<a name="line-227"></a> escape c <font color=Red>=</font> fail <font color=Cyan>(</font><font color=Magenta>"unrecognised escape sequence in literal char: \\"</font><font color=Cyan>++</font><font color=Red>[</font>c<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-228"></a>-<a name="line-229"></a> mnemonic <font color=Magenta>'A'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'C'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'K'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\ACK'</font>-<a name="line-230"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\ACK'"</font>-<a name="line-231"></a> mnemonic <font color=Magenta>'B'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'E'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'L'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\BEL'</font>-<a name="line-232"></a> <font color=Cyan>`onFail`</font>-<a name="line-233"></a> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\BS'</font>-<a name="line-234"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\BEL' or '\\BS'"</font>-<a name="line-235"></a> mnemonic <font color=Magenta>'C'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'R'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\CR'</font>-<a name="line-236"></a> <font color=Cyan>`onFail`</font>-<a name="line-237"></a> <font color=Green><u>do</u></font> <font color=Magenta>'A'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'N'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\CAN'</font>-<a name="line-238"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\CR' or '\\CAN'"</font>-<a name="line-239"></a> mnemonic <font color=Magenta>'D'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'E'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'L'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DEL'</font>-<a name="line-240"></a> <font color=Cyan>`onFail`</font>-<a name="line-241"></a> <font color=Green><u>do</u></font> <font color=Magenta>'L'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'E'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DLE'</font>-<a name="line-242"></a> <font color=Cyan>`onFail`</font>-<a name="line-243"></a> <font color=Green><u>do</u></font> <font color=Magenta>'C'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Cyan>(</font> <font color=Green><u>do</u></font> <font color=Magenta>'1'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DC1'</font>-<a name="line-244"></a> <font color=Cyan>`onFail`</font>-<a name="line-245"></a> <font color=Green><u>do</u></font> <font color=Magenta>'2'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DC2'</font>-<a name="line-246"></a> <font color=Cyan>`onFail`</font>-<a name="line-247"></a> <font color=Green><u>do</u></font> <font color=Magenta>'3'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DC3'</font>-<a name="line-248"></a> <font color=Cyan>`onFail`</font>-<a name="line-249"></a> <font color=Green><u>do</u></font> <font color=Magenta>'4'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\DC4'</font> <font color=Cyan>)</font>-<a name="line-250"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\DEL' or '\\DLE' or '\\DC[1..4]'"</font>-<a name="line-251"></a> mnemonic <font color=Magenta>'E'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'X'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\ETX'</font>-<a name="line-252"></a> <font color=Cyan>`onFail`</font>-<a name="line-253"></a> <font color=Green><u>do</u></font> <font color=Magenta>'O'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\EOT'</font>-<a name="line-254"></a> <font color=Cyan>`onFail`</font>-<a name="line-255"></a> <font color=Green><u>do</u></font> <font color=Magenta>'N'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'Q'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\ENQ'</font>-<a name="line-256"></a> <font color=Cyan>`onFail`</font>-<a name="line-257"></a> <font color=Green><u>do</u></font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'B'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\ETB'</font>-<a name="line-258"></a> <font color=Cyan>`onFail`</font>-<a name="line-259"></a> <font color=Green><u>do</u></font> <font color=Magenta>'M'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\EM'</font>-<a name="line-260"></a> <font color=Cyan>`onFail`</font>-<a name="line-261"></a> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'C'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\ESC'</font>-<a name="line-262"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"one of '\\ETX' '\\EOT' '\\ENQ' '\\ETB' '\\EM' or '\\ESC'"</font>-<a name="line-263"></a> mnemonic <font color=Magenta>'F'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'F'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\FF'</font>-<a name="line-264"></a> <font color=Cyan>`onFail`</font>-<a name="line-265"></a> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\FS'</font>-<a name="line-266"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\FF' or '\\FS'"</font>-<a name="line-267"></a> mnemonic <font color=Magenta>'G'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\GS'</font>-<a name="line-268"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\GS'"</font>-<a name="line-269"></a> mnemonic <font color=Magenta>'H'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\HT'</font>-<a name="line-270"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\HT'"</font>-<a name="line-271"></a> mnemonic <font color=Magenta>'L'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'F'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\LF'</font>-<a name="line-272"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\LF'"</font>-<a name="line-273"></a> mnemonic <font color=Magenta>'N'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'U'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'L'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\NUL'</font>-<a name="line-274"></a> <font color=Cyan>`onFail`</font>-<a name="line-275"></a> <font color=Green><u>do</u></font> <font color=Magenta>'A'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'K'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\NAK'</font>-<a name="line-276"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\NUL' or '\\NAK'"</font>-<a name="line-277"></a> mnemonic <font color=Magenta>'R'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\RS'</font>-<a name="line-278"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\RS'"</font>-<a name="line-279"></a> mnemonic <font color=Magenta>'S'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'O'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'H'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SOH'</font>-<a name="line-280"></a> <font color=Cyan>`onFail`</font>-<a name="line-281"></a> <font color=Green><u>do</u></font> <font color=Magenta>'O'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SO'</font>-<a name="line-282"></a> <font color=Cyan>`onFail`</font>-<a name="line-283"></a> <font color=Green><u>do</u></font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'X'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\STX'</font>-<a name="line-284"></a> <font color=Cyan>`onFail`</font>-<a name="line-285"></a> <font color=Green><u>do</u></font> <font color=Magenta>'I'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SI'</font>-<a name="line-286"></a> <font color=Cyan>`onFail`</font>-<a name="line-287"></a> <font color=Green><u>do</u></font> <font color=Magenta>'Y'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'N'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SYN'</font>-<a name="line-288"></a> <font color=Cyan>`onFail`</font>-<a name="line-289"></a> <font color=Green><u>do</u></font> <font color=Magenta>'U'</font> <font color=Red><-</font> next<font color=Cyan>;</font> <font color=Magenta>'B'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SUB'</font>-<a name="line-290"></a> <font color=Cyan>`onFail`</font>-<a name="line-291"></a> <font color=Green><u>do</u></font> <font color=Magenta>'P'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\SP'</font>-<a name="line-292"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\SOH' '\\SO' '\\STX' '\\SI' '\\SYN' '\\SUB' or '\\SP'"</font>-<a name="line-293"></a> mnemonic <font color=Magenta>'U'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'S'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\US'</font>-<a name="line-294"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\US'"</font>-<a name="line-295"></a> mnemonic <font color=Magenta>'V'</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Magenta>'T'</font> <font color=Red><-</font> next<font color=Cyan>;</font> return <font color=Magenta>'\VT'</font>-<a name="line-296"></a> <font color=Cyan>`wrap`</font> <font color=Magenta>"'\\VT'"</font>-<a name="line-297"></a> wrap p s <font color=Red>=</font> p <font color=Cyan>`onFail`</font> fail <font color=Cyan>(</font><font color=Magenta>"expected literal char "</font><font color=Cyan>++</font>s<font color=Cyan>)</font>-<a name="line-298"></a>-<a name="line-299"></a><font color=Blue>-- Basic types</font>-<a name="line-300"></a><font color=Green><u>instance</u></font> Parse Int <font color=Green><u>where</u></font>-<a name="line-301"></a> <font color=Blue>-- parse = parseByRead "Int" -- convert from Integer, deals with minInt</font>-<a name="line-302"></a> parse <font color=Red>=</font> fmap fromInteger <font color=Cyan>$</font>-<a name="line-303"></a> <font color=Green><u>do</u></font> many <font color=Cyan>(</font>satisfy isSpace<font color=Cyan>)</font><font color=Cyan>;</font> parseSigned <font color=Cyan>(</font>parseDec <font color=Magenta>0</font><font color=Cyan>)</font>-<a name="line-304"></a><font color=Green><u>instance</u></font> Parse Integer <font color=Green><u>where</u></font>-<a name="line-305"></a> <font color=Blue>-- parse = parseByRead "Integer"</font>-<a name="line-306"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font> many <font color=Cyan>(</font>satisfy isSpace<font color=Cyan>)</font><font color=Cyan>;</font> parseSigned <font color=Cyan>(</font>parseDec <font color=Magenta>0</font><font color=Cyan>)</font>-<a name="line-307"></a><font color=Green><u>instance</u></font> Parse Float <font color=Green><u>where</u></font>-<a name="line-308"></a> <font color=Blue>-- parse = parseByRead "Float"</font>-<a name="line-309"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font> many <font color=Cyan>(</font>satisfy isSpace<font color=Cyan>)</font><font color=Cyan>;</font> parseSigned parseFloat-<a name="line-310"></a><font color=Green><u>instance</u></font> Parse Double <font color=Green><u>where</u></font>-<a name="line-311"></a> <font color=Blue>-- parse = parseByRead "Double"</font>-<a name="line-312"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font> many <font color=Cyan>(</font>satisfy isSpace<font color=Cyan>)</font><font color=Cyan>;</font> parseSigned parseFloat-<a name="line-313"></a><font color=Green><u>instance</u></font> Parse Char <font color=Green><u>where</u></font>-<a name="line-314"></a><font color=Blue>-- parse = parseByRead "Char"</font>-<a name="line-315"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font> many <font color=Cyan>(</font>satisfy isSpace<font color=Cyan>)</font><font color=Cyan>;</font> parseLitChar-<a name="line-316"></a> <font color=Blue>-- parse = do { w <- word; if head w == '\'' then readLitChar (tail w)</font>-<a name="line-317"></a> <font color=Blue>-- else fail "expected a char" }</font>-<a name="line-318"></a> <font color=Blue>-- parseList = bracket (isWord "\"") (satisfy (=='"'))</font>-<a name="line-319"></a> <font color=Blue>-- (many (satisfy (/='"')))</font>-<a name="line-320"></a> <font color=Blue>-- not totally correct for strings...</font>-<a name="line-321"></a> parseList <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> w <font color=Red><-</font> word<font color=Cyan>;</font> <font color=Green><u>if</u></font> head w <font color=Cyan>==</font> <font color=Magenta>'"'</font> <font color=Green><u>then</u></font> return <font color=Cyan>(</font>init <font color=Cyan>(</font>tail w<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-322"></a> <font color=Green><u>else</u></font> fail <font color=Magenta>"not a string"</font> <font color=Cyan>}</font>-<a name="line-323"></a>-<a name="line-324"></a><font color=Green><u>instance</u></font> Parse Bool <font color=Green><u>where</u></font>-<a name="line-325"></a> parse <font color=Red>=</font> enumeration <font color=Magenta>"Bool"</font> <font color=Red>[</font>False<font color=Cyan>,</font>True<font color=Red>]</font>-<a name="line-326"></a>-<a name="line-327"></a><font color=Green><u>instance</u></font> Parse Ordering <font color=Green><u>where</u></font>-<a name="line-328"></a> parse <font color=Red>=</font> enumeration <font color=Magenta>"Ordering"</font> <font color=Red>[</font>LT<font color=Cyan>,</font>EQ<font color=Cyan>,</font>GT<font color=Red>]</font>-<a name="line-329"></a>-<a name="line-330"></a><font color=Blue>-- Structural types</font>-<a name="line-331"></a><font color=Green><u>instance</u></font> Parse () <font color=Green><u>where</u></font>-<a name="line-332"></a> parse <font color=Red>=</font> P p-<a name="line-333"></a> <font color=Green><u>where</u></font> p [] <font color=Red>=</font> Failure [] <font color=Magenta>"no input: expected a ()"</font>-<a name="line-334"></a> p <font color=Cyan>(</font><font color=Magenta>'('</font><font color=Red><b>:</b></font>cs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>case</u></font> dropWhile isSpace cs <font color=Green><u>of</u></font>-<a name="line-335"></a> <font color=Cyan>(</font><font color=Magenta>')'</font><font color=Red><b>:</b></font>s<font color=Cyan>)</font> <font color=Red>-></font> Success s ()-<a name="line-336"></a> <font color=Green><u>_</u></font> <font color=Red>-></font> Failure cs <font color=Magenta>"Expected ) after ("</font>-<a name="line-337"></a> p <font color=Cyan>(</font>c<font color=Red><b>:</b></font>cs<font color=Cyan>)</font> <font color=Red>|</font> isSpace c <font color=Red>=</font> p cs-<a name="line-338"></a> <font color=Red>|</font> otherwise <font color=Red>=</font> Failure <font color=Cyan>(</font>c<font color=Red><b>:</b></font>cs<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>"Expected a (), got "</font><font color=Cyan>++</font>show c<font color=Cyan>)</font>-<a name="line-339"></a>-<a name="line-340"></a><font color=Green><u>instance</u></font> <font color=Cyan>(</font>Parse a<font color=Cyan>,</font> Parse b<font color=Cyan>)</font> <font color=Red>=></font> Parse <font color=Cyan>(</font>a<font color=Cyan>,</font>b<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-341"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font><font color=Cyan>{</font> isWord <font color=Magenta>"("</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Opening a 2-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-342"></a> <font color=Cyan>;</font> x <font color=Red><-</font> parse <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"In 1st item of a 2-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-343"></a> <font color=Cyan>;</font> isWord <font color=Magenta>","</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Separating a 2-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-344"></a> <font color=Cyan>;</font> y <font color=Red><-</font> parse <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"In 2nd item of a 2-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-345"></a> <font color=Cyan>;</font> isWord <font color=Magenta>")"</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Closing a 2-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-346"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Cyan>,</font>y<font color=Cyan>)</font> <font color=Cyan>}</font>-<a name="line-347"></a>-<a name="line-348"></a><font color=Green><u>instance</u></font> <font color=Cyan>(</font>Parse a<font color=Cyan>,</font> Parse b<font color=Cyan>,</font> Parse c<font color=Cyan>)</font> <font color=Red>=></font> Parse <font color=Cyan>(</font>a<font color=Cyan>,</font>b<font color=Cyan>,</font>c<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-349"></a> parse <font color=Red>=</font> <font color=Green><u>do</u></font><font color=Cyan>{</font> isWord <font color=Magenta>"("</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Opening a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-350"></a> <font color=Cyan>;</font> x <font color=Red><-</font> parse <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"In 1st item of a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-351"></a> <font color=Cyan>;</font> isWord <font color=Magenta>","</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Separating(1) a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-352"></a> <font color=Cyan>;</font> y <font color=Red><-</font> parse <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"In 2nd item of a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-353"></a> <font color=Cyan>;</font> isWord <font color=Magenta>","</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Separating(2) a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-354"></a> <font color=Cyan>;</font> z <font color=Red><-</font> parse <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"In 3rd item of a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-355"></a> <font color=Cyan>;</font> isWord <font color=Magenta>")"</font> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Closing a 3-tuple\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-356"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Cyan>,</font>y<font color=Cyan>,</font>z<font color=Cyan>)</font> <font color=Cyan>}</font>-<a name="line-357"></a>-<a name="line-358"></a><font color=Green><u>instance</u></font> Parse a <font color=Red>=></font> Parse <font color=Cyan>(</font>Maybe a<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-359"></a> parsePrec p <font color=Red>=</font>-<a name="line-360"></a> parens False <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Magenta>"Nothing"</font><font color=Cyan>;</font> return Nothing <font color=Cyan>}</font><font color=Cyan>)</font>-<a name="line-361"></a> <font color=Cyan>`onFail`</font>-<a name="line-362"></a> parens <font color=Cyan>(</font>p<font color=Cyan>></font><font color=Magenta>9</font><font color=Cyan>)</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font> isWord <font color=Magenta>"Just"</font>-<a name="line-363"></a> <font color=Cyan>;</font> fmap Just <font color=Cyan>$</font> parsePrec <font color=Magenta>10</font>-<a name="line-364"></a> <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"but within Just, "</font><font color=Cyan>++</font><font color=Cyan>)</font> <font color=Cyan>}</font><font color=Cyan>)</font>-<a name="line-365"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"expected a Maybe (Just or Nothing)\n"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>.</font>indent <font color=Magenta>2</font><font color=Cyan>)</font>-<a name="line-366"></a>-<a name="line-367"></a><font color=Green><u>instance</u></font> <font color=Cyan>(</font>Parse a<font color=Cyan>,</font> Parse b<font color=Cyan>)</font> <font color=Red>=></font> Parse <font color=Cyan>(</font>Either a b<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-368"></a> parsePrec p <font color=Red>=</font>-<a name="line-369"></a> parens <font color=Cyan>(</font>p<font color=Cyan>></font><font color=Magenta>9</font><font color=Cyan>)</font> <font color=Cyan>$</font>-<a name="line-370"></a> constructors <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"Left"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> fmap Left <font color=Cyan>$</font> parsePrec <font color=Magenta>10</font> <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="line-371"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"Right"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> fmap Right <font color=Cyan>$</font> parsePrec <font color=Magenta>10</font> <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="line-372"></a> <font color=Red>]</font>-<a name="line-373"></a>-<a name="line-374"></a><font color=Green><u>instance</u></font> Parse a <font color=Red>=></font> Parse <font color=Red>[</font>a<font color=Red>]</font> <font color=Green><u>where</u></font>-<a name="line-375"></a> parse <font color=Red>=</font> parseList-<a name="line-376"></a>-<a name="line-377"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/HuttonMeijer.html
@@ -1,228 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/HuttonMeijer.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Blue>-----------------------------------------------------------------------------</font>-<a name="line-2"></a><font color=Blue>-- |</font>-<a name="line-3"></a><font color=Blue>-- Module : Text.ParserCombinators.HuttonMeijer</font>-<a name="line-4"></a><font color=Blue>-- Copyright : Graham Hutton (University of Nottingham), Erik Meijer (University of Utrecht)</font>-<a name="line-5"></a><font color=Blue>-- Licence : BSD</font>-<a name="line-6"></a><font color=Blue>-- </font>-<a name="line-7"></a><font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>-<a name="line-8"></a><font color=Blue>-- Stability : Stable</font>-<a name="line-9"></a><font color=Blue>-- Portability : All</font>-<a name="line-10"></a><font color=Blue>--</font>-<a name="line-11"></a><font color=Blue>-- A LIBRARY OF MONADIC PARSER COMBINATORS</font>-<a name="line-12"></a><font color=Blue>-- </font>-<a name="line-13"></a><font color=Blue>-- 29th July 1996</font>-<a name="line-14"></a><font color=Blue>-- </font>-<a name="line-15"></a><font color=Blue>-- Graham Hutton Erik Meijer</font>-<a name="line-16"></a><font color=Blue>-- University of Nottingham University of Utrecht</font>-<a name="line-17"></a><font color=Blue>-- </font>-<a name="line-18"></a><font color=Blue>-- This Haskell script defines a library of parser combinators, and is</font>-<a name="line-19"></a><font color=Blue>-- taken from sections 1-6 of our article "Monadic Parser Combinators".</font>-<a name="line-20"></a><font color=Blue>-- Some changes to the library have been made in the move from Gofer</font>-<a name="line-21"></a><font color=Blue>-- to Haskell:</font>-<a name="line-22"></a><font color=Blue>-- </font>-<a name="line-23"></a><font color=Blue>-- * Do notation is used in place of monad comprehension notation;</font>-<a name="line-24"></a><font color=Blue>-- </font>-<a name="line-25"></a><font color=Blue>-- * The parser datatype is defined using "newtype", to avoid the overhead</font>-<a name="line-26"></a><font color=Blue>-- of tagging and untagging parsers with the P constructor.</font>-<a name="line-27"></a><font color=Blue>-----------------------------------------------------------------------------</font>-<a name="line-28"></a>-<a name="line-29"></a>-<a name="line-30"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>HuttonMeijer-<a name="line-31"></a> <font color=Cyan>(</font>Parser<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> item<font color=Cyan>,</font> first<font color=Cyan>,</font> papply<font color=Cyan>,</font> <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font><font color=Cyan>,</font> sat<font color=Cyan>,</font> <font color=Blue>{-tok,-}</font> many<font color=Cyan>,</font> many1<font color=Cyan>,</font>-<a name="line-32"></a> sepby<font color=Cyan>,</font> sepby1<font color=Cyan>,</font> chainl<font color=Cyan>,</font>-<a name="line-33"></a> chainl1<font color=Cyan>,</font> chainr<font color=Cyan>,</font> chainr1<font color=Cyan>,</font> ops<font color=Cyan>,</font> bracket<font color=Cyan>,</font> char<font color=Cyan>,</font> digit<font color=Cyan>,</font> lower<font color=Cyan>,</font> upper<font color=Cyan>,</font>-<a name="line-34"></a> letter<font color=Cyan>,</font> alphanum<font color=Cyan>,</font> string<font color=Cyan>,</font> ident<font color=Cyan>,</font> nat<font color=Cyan>,</font> int<font color=Cyan>,</font> spaces<font color=Cyan>,</font> comment<font color=Cyan>,</font> junk<font color=Cyan>,</font>-<a name="line-35"></a> skip<font color=Cyan>,</font> token<font color=Cyan>,</font> natural<font color=Cyan>,</font> integer<font color=Cyan>,</font> symbol<font color=Cyan>,</font> identifier<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-36"></a>-<a name="line-37"></a><font color=Green><u>import</u></font> Char-<a name="line-38"></a><font color=Green><u>import</u></font> Monad-<a name="line-39"></a>-<a name="line-40"></a><font color=Green><u>infixr</u></font> <font color=Magenta>5</font> <font color=Cyan>+++</font>-<a name="line-41"></a>-<a name="line-42"></a><a name="Token"></a><font color=Green><u>type</u></font> Token <font color=Red>=</font> Char-<a name="line-43"></a>-<a name="line-44"></a><font color=Blue>---------------------------------------------------------</font>-<a name="line-45"></a><font color=Blue>-- | The parser monad</font>-<a name="line-46"></a>-<a name="line-47"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>Token<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font><font color=Red>[</font>Token<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-48"></a>-<a name="line-49"></a><font color=Green><u>instance</u></font> Functor Parser <font color=Green><u>where</u></font>-<a name="line-50"></a> <font color=Blue>-- map :: (a -> b) -> (Parser a -> Parser b)</font>-<a name="line-51"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>f v<font color=Cyan>,</font> out<font color=Cyan>)</font> <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> p inp<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-52"></a>-<a name="line-53"></a><font color=Green><u>instance</u></font> Monad Parser <font color=Green><u>where</u></font>-<a name="line-54"></a> <font color=Blue>-- return :: a -> Parser a</font>-<a name="line-55"></a> return v <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>v<font color=Cyan>,</font>inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-56"></a>-<a name="line-57"></a> <font color=Blue>-- >>= :: Parser a -> (a -> Parser b) -> Parser b</font>-<a name="line-58"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>>>=</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> concat <font color=Red>[</font>papply <font color=Cyan>(</font>f v<font color=Cyan>)</font> out <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> p inp<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-59"></a>-<a name="line-60"></a> <font color=Blue>-- fail :: String -> Parser a</font>-<a name="line-61"></a> fail <font color=Green><u>_</u></font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font><font color=Green><u>_</u></font> <font color=Red>-></font> []<font color=Cyan>)</font>-<a name="line-62"></a>-<a name="line-63"></a><font color=Green><u>instance</u></font> MonadPlus Parser <font color=Green><u>where</u></font>-<a name="line-64"></a> <font color=Blue>-- mzero :: Parser a</font>-<a name="line-65"></a> mzero <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font><font color=Green><u>_</u></font> <font color=Red>-></font> []<font color=Cyan>)</font>-<a name="line-66"></a>-<a name="line-67"></a> <font color=Blue>-- mplus :: Parser a -> Parser a -> Parser a</font>-<a name="line-68"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`mplus`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Cyan>(</font>p inp <font color=Cyan>++</font> q inp<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-69"></a>-<a name="line-70"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-71"></a><font color=Blue>-- * Other primitive parser combinators</font>-<a name="line-72"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-73"></a>-<a name="line-74"></a><a name="item"></a><font color=Blue>item</font> <font color=Red>::</font> Parser Token-<a name="line-75"></a><font color=Blue>item</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Green><u>case</u></font> inp <font color=Green><u>of</u></font>-<a name="line-76"></a> [] <font color=Red>-></font> []-<a name="line-77"></a> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>x<font color=Cyan>,</font>xs<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-78"></a>-<a name="line-79"></a><a name="first"></a><font color=Blue>first</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a-<a name="line-80"></a><font color=Blue>first</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Green><u>case</u></font> p inp <font color=Green><u>of</u></font>-<a name="line-81"></a> [] <font color=Red>-></font> []-<a name="line-82"></a> <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> <font color=Red>[</font>x<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-83"></a>-<a name="line-84"></a><a name="papply"></a><font color=Blue>papply</font> <font color=Red>::</font> Parser a <font color=Red>-></font> <font color=Red>[</font>Token<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font><font color=Red>[</font>Token<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font>-<a name="line-85"></a><font color=Blue>papply</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> inp <font color=Red>=</font> p inp-<a name="line-86"></a>-<a name="line-87"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-88"></a><font color=Blue>-- * Derived combinators</font>-<a name="line-89"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-90"></a>-<a name="line-91"></a><a name="+++"></a><font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a <font color=Red>-></font> Parser a-<a name="line-92"></a><a name="p"></a><font color=Blue>p</font> <font color=Cyan>+++</font> q <font color=Red>=</font> first <font color=Cyan>(</font>p <font color=Cyan>`mplus`</font> q<font color=Cyan>)</font>-<a name="line-93"></a>-<a name="line-94"></a><a name="sat"></a><font color=Blue>sat</font> <font color=Red>::</font> <font color=Cyan>(</font>Token <font color=Red>-></font> Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser Token-<a name="line-95"></a><font color=Blue>sat</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> item<font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> mzero<font color=Cyan>}</font>-<a name="line-96"></a>-<a name="line-97"></a><font color=Blue>--tok :: Token -> Parser Token</font>-<a name="line-98"></a><font color=Blue>--tok t = do {x <- item; if t==snd x then return t else mzero}</font>-<a name="line-99"></a>-<a name="line-100"></a><a name="many"></a><font color=Blue>many</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-101"></a><font color=Blue>many</font> p <font color=Red>=</font> many1 p <font color=Cyan>+++</font> return []-<a name="line-102"></a><font color=Blue>--many p = force (many1 p +++ return [])</font>-<a name="line-103"></a>-<a name="line-104"></a><a name="many1"></a><font color=Blue>many1</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-105"></a><font color=Blue>many1</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many p<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-106"></a>-<a name="line-107"></a><a name="sepby"></a><font color=Blue>sepby</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-108"></a><a name="sepby"></a><font color=Blue>p</font> <font color=Cyan>`sepby`</font> sep <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`sepby1`</font> sep<font color=Cyan>)</font> <font color=Cyan>+++</font> return []-<a name="line-109"></a>-<a name="line-110"></a><a name="sepby1"></a><font color=Blue>sepby1</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-111"></a><a name="sepby1"></a><font color=Blue>p</font> <font color=Cyan>`sepby1`</font> sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font><font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-112"></a>-<a name="line-113"></a><a name="chainl"></a><font color=Blue>chainl</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> a <font color=Red>-></font> Parser a-<a name="line-114"></a><font color=Blue>chainl</font> p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainl1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v-<a name="line-115"></a>-<a name="line-116"></a><a name="chainl1"></a><font color=Blue>chainl1</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> Parser a-<a name="line-117"></a><a name="chainl1"></a><font color=Blue>p</font> <font color=Cyan>`chainl1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>-<a name="line-118"></a> <font color=Green><u>where</u></font>-<a name="line-119"></a> rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>f <font color=Red><-</font> op<font color=Cyan>;</font> y <font color=Red><-</font> p<font color=Cyan>;</font> rest <font color=Cyan>(</font>f x y<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-120"></a> <font color=Cyan>+++</font> return x-<a name="line-121"></a>-<a name="line-122"></a><a name="chainr"></a><font color=Blue>chainr</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> a <font color=Red>-></font> Parser a-<a name="line-123"></a><font color=Blue>chainr</font> p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainr1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v-<a name="line-124"></a>-<a name="line-125"></a><a name="chainr1"></a><font color=Blue>chainr1</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> Parser a-<a name="line-126"></a><a name="chainr1"></a><font color=Blue>p</font> <font color=Cyan>`chainr1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>-<a name="line-127"></a> <font color=Green><u>where</u></font>-<a name="line-128"></a> rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>f <font color=Red><-</font> op<font color=Cyan>;</font> y <font color=Red><-</font> p <font color=Cyan>`chainr1`</font> op<font color=Cyan>;</font> return <font color=Cyan>(</font>f x y<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-129"></a> <font color=Cyan>+++</font> return x-<a name="line-130"></a>-<a name="line-131"></a><a name="ops"></a><font color=Blue>ops</font> <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>Parser a<font color=Cyan>,</font> b<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser b-<a name="line-132"></a><font color=Blue>ops</font> xs <font color=Red>=</font> foldr1 <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>[</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>p<font color=Cyan>;</font> return op<font color=Cyan>}</font> <font color=Red>|</font> <font color=Cyan>(</font>p<font color=Cyan>,</font>op<font color=Cyan>)</font> <font color=Red><-</font> xs<font color=Red>]</font>-<a name="line-133"></a>-<a name="line-134"></a><a name="bracket"></a><font color=Blue>bracket</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser c <font color=Red>-></font> Parser b-<a name="line-135"></a><font color=Blue>bracket</font> open p close <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>open<font color=Cyan>;</font> x <font color=Red><-</font> p<font color=Cyan>;</font> close<font color=Cyan>;</font> return x<font color=Cyan>}</font>-<a name="line-136"></a>-<a name="line-137"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-138"></a><font color=Blue>-- * Useful parsers</font>-<a name="line-139"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-140"></a>-<a name="line-141"></a><a name="char"></a><font color=Blue>char</font> <font color=Red>::</font> Char <font color=Red>-></font> Parser Char-<a name="line-142"></a><font color=Blue>char</font> x <font color=Red>=</font> sat <font color=Cyan>(</font><font color=Red>\</font>y <font color=Red>-></font> x <font color=Cyan>==</font> y<font color=Cyan>)</font>-<a name="line-143"></a>-<a name="line-144"></a><a name="digit"></a><font color=Blue>digit</font> <font color=Red>::</font> Parser Char-<a name="line-145"></a><font color=Blue>digit</font> <font color=Red>=</font> sat isDigit-<a name="line-146"></a>-<a name="line-147"></a><a name="lower"></a><font color=Blue>lower</font> <font color=Red>::</font> Parser Char-<a name="line-148"></a><font color=Blue>lower</font> <font color=Red>=</font> sat isLower-<a name="line-149"></a>-<a name="line-150"></a><a name="upper"></a><font color=Blue>upper</font> <font color=Red>::</font> Parser Char-<a name="line-151"></a><font color=Blue>upper</font> <font color=Red>=</font> sat isUpper-<a name="line-152"></a>-<a name="line-153"></a><a name="letter"></a><font color=Blue>letter</font> <font color=Red>::</font> Parser Char-<a name="line-154"></a><font color=Blue>letter</font> <font color=Red>=</font> sat isAlpha-<a name="line-155"></a>-<a name="line-156"></a><a name="alphanum"></a><font color=Blue>alphanum</font> <font color=Red>::</font> Parser Char-<a name="line-157"></a><font color=Blue>alphanum</font> <font color=Red>=</font> sat isAlphaNum <font color=Cyan>+++</font> char <font color=Magenta>'_'</font>-<a name="line-158"></a>-<a name="line-159"></a><a name="string"></a><font color=Blue>string</font> <font color=Red>::</font> String <font color=Red>-></font> Parser String-<a name="line-160"></a><font color=Blue>string</font> <font color=Magenta>""</font> <font color=Red>=</font> return <font color=Magenta>""</font>-<a name="line-161"></a><font color=Blue>string</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>char x<font color=Cyan>;</font> string xs<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-162"></a>-<a name="line-163"></a><a name="ident"></a><font color=Blue>ident</font> <font color=Red>::</font> Parser String-<a name="line-164"></a><font color=Blue>ident</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> lower<font color=Cyan>;</font> xs <font color=Red><-</font> many alphanum<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-165"></a>-<a name="line-166"></a><a name="nat"></a><font color=Blue>nat</font> <font color=Red>::</font> Parser Int-<a name="line-167"></a><font color=Blue>nat</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> digit<font color=Cyan>;</font> return <font color=Cyan>(</font>fromEnum x <font color=Blue>-</font> fromEnum <font color=Magenta>'0'</font><font color=Cyan>)</font><font color=Cyan>}</font> <font color=Cyan>`chainl1`</font> return op-<a name="line-168"></a> <font color=Green><u>where</u></font>-<a name="line-169"></a> m <font color=Cyan>`op`</font> n <font color=Red>=</font> <font color=Magenta>10</font><font color=Cyan>*</font>m <font color=Cyan>+</font> n-<a name="line-170"></a>-<a name="line-171"></a><a name="int"></a><font color=Blue>int</font> <font color=Red>::</font> Parser Int-<a name="line-172"></a><font color=Blue>int</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>char <font color=Magenta>'-'</font><font color=Cyan>;</font> n <font color=Red><-</font> nat<font color=Cyan>;</font> return <font color=Cyan>(</font><font color=Blue>-</font>n<font color=Cyan>)</font><font color=Cyan>}</font> <font color=Cyan>+++</font> nat-<a name="line-173"></a>-<a name="line-174"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-175"></a><font color=Blue>-- * Lexical combinators</font>-<a name="line-176"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-177"></a>-<a name="line-178"></a><a name="spaces"></a><font color=Blue>spaces</font> <font color=Red>::</font> Parser ()-<a name="line-179"></a><font color=Blue>spaces</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>many1 <font color=Cyan>(</font>sat isSpace<font color=Cyan>)</font><font color=Cyan>;</font> return ()<font color=Cyan>}</font>-<a name="line-180"></a>-<a name="line-181"></a><a name="comment"></a><font color=Blue>comment</font> <font color=Red>::</font> Parser ()-<a name="line-182"></a><font color=Blue>--comment = do {string "--"; many (sat (\x -> x /= '\n')); return ()}</font>-<a name="line-183"></a><font color=Blue>--comment = do </font>-<a name="line-184"></a><font color=Blue>-- _ <- string "--"</font>-<a name="line-185"></a><font color=Blue>-- _ <- many (sat (\x -> x /= '\n'))</font>-<a name="line-186"></a><font color=Blue>-- return ()</font>-<a name="line-187"></a><font color=Blue>comment</font> <font color=Red>=</font> <font color=Green><u>do</u></font>-<a name="line-188"></a> bracket <font color=Cyan>(</font>string <font color=Magenta>"/*"</font><font color=Cyan>)</font> <font color=Cyan>(</font>many item<font color=Cyan>)</font> <font color=Cyan>(</font>string <font color=Magenta>"*/"</font><font color=Cyan>)</font>-<a name="line-189"></a> return ()-<a name="line-190"></a>-<a name="line-191"></a><a name="junk"></a><font color=Blue>junk</font> <font color=Red>::</font> Parser ()-<a name="line-192"></a><font color=Blue>junk</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>many <font color=Cyan>(</font>spaces <font color=Cyan>+++</font> comment<font color=Cyan>)</font><font color=Cyan>;</font> return ()<font color=Cyan>}</font>-<a name="line-193"></a>-<a name="line-194"></a><a name="skip"></a><font color=Blue>skip</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a-<a name="line-195"></a><font color=Blue>skip</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>junk<font color=Cyan>;</font> p<font color=Cyan>}</font>-<a name="line-196"></a>-<a name="line-197"></a><a name="token"></a><font color=Blue>token</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a-<a name="line-198"></a><font color=Blue>token</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>v <font color=Red><-</font> p<font color=Cyan>;</font> junk<font color=Cyan>;</font> return v<font color=Cyan>}</font>-<a name="line-199"></a>-<a name="line-200"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-201"></a><font color=Blue>-- * Token parsers</font>-<a name="line-202"></a><font color=Blue>-- ------------------------------------------------------------</font>-<a name="line-203"></a>-<a name="line-204"></a><a name="natural"></a><font color=Blue>natural</font> <font color=Red>::</font> Parser Int-<a name="line-205"></a><font color=Blue>natural</font> <font color=Red>=</font> token nat-<a name="line-206"></a>-<a name="line-207"></a><a name="integer"></a><font color=Blue>integer</font> <font color=Red>::</font> Parser Int-<a name="line-208"></a><font color=Blue>integer</font> <font color=Red>=</font> token int-<a name="line-209"></a>-<a name="line-210"></a><a name="symbol"></a><font color=Blue>symbol</font> <font color=Red>::</font> String <font color=Red>-></font> Parser String-<a name="line-211"></a><font color=Blue>symbol</font> xs <font color=Red>=</font> token <font color=Cyan>(</font>string xs<font color=Cyan>)</font>-<a name="line-212"></a>-<a name="line-213"></a><a name="identifier"></a><font color=Blue>identifier</font> <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Parser String-<a name="line-214"></a><font color=Blue>identifier</font> ks <font color=Red>=</font> token <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> ident<font color=Cyan>;</font>-<a name="line-215"></a> <font color=Green><u>if</u></font> not <font color=Cyan>(</font>elem x ks<font color=Cyan>)</font> <font color=Green><u>then</u></font> return x-<a name="line-216"></a> <font color=Green><u>else</u></font> return mzero<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="line-217"></a>-<a name="line-218"></a><font color=Blue>------------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/HuttonMeijerWallace.html
@@ -1,307 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/HuttonMeijerWallace.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Blue>{------------------------------------------------------------------------------<a name="line-2"></a>-<a name="line-3"></a> A LIBRARY OF MONADIC PARSER COMBINATORS-<a name="line-4"></a>-<a name="line-5"></a> 29th July 1996-<a name="line-6"></a>-<a name="line-7"></a> Graham Hutton Erik Meijer-<a name="line-8"></a> University of Nottingham University of Utrecht-<a name="line-9"></a>-<a name="line-10"></a>This Haskell 1.3 script defines a library of parser combinators, and is taken-<a name="line-11"></a>from sections 1-6 of our article "Monadic Parser Combinators". Some changes-<a name="line-12"></a>to the library have been made in the move from Gofer to Haskell:-<a name="line-13"></a>-<a name="line-14"></a> * Do notation is used in place of monad comprehension notation;-<a name="line-15"></a>-<a name="line-16"></a> * The parser datatype is defined using "newtype", to avoid the overhead-<a name="line-17"></a> of tagging and untagging parsers with the P constructor.-<a name="line-18"></a>-<a name="line-19"></a>-------------------------------------------------------------------------------<a name="line-20"></a>** Extended to allow a symbol table/state to be threaded through the monad.-<a name="line-21"></a>** Extended to allow a parameterised token type, rather than just strings.-<a name="line-22"></a>** Extended to allow error-reporting.-<a name="line-23"></a>-<a name="line-24"></a>(Extensions: 1998-2000 Malcolm.Wallace@cs.york.ac.uk)-<a name="line-25"></a>(More extensions: 2004 gk-haskell@ninebynine.org)-<a name="line-26"></a>-<a name="line-27"></a>------------------------------------------------------------------------------}</font>-<a name="line-28"></a>-<a name="line-29"></a><font color=Blue>-- | This library of monadic parser combinators is based on the ones</font>-<a name="line-30"></a><font color=Blue>-- defined by Graham Hutton and Erik Meijer. It has been extended by</font>-<a name="line-31"></a><font color=Blue>-- Malcolm Wallace to use an abstract token type (no longer just a</font>-<a name="line-32"></a><font color=Blue>-- string) as input, and to incorporate state in the monad, useful</font>-<a name="line-33"></a><font color=Blue>-- for symbol tables, macros, and so on. Basic facilities for error</font>-<a name="line-34"></a><font color=Blue>-- reporting have also been added, and later extended by Graham Klyne</font>-<a name="line-35"></a><font color=Blue>-- to return the errors through an @Either@ type, rather than just</font>-<a name="line-36"></a><font color=Blue>-- calling @error@.</font>-<a name="line-37"></a>-<a name="line-38"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>HuttonMeijerWallace-<a name="line-39"></a> <font color=Cyan>(</font>-<a name="line-40"></a> <font color=Blue>-- * The parser monad</font>-<a name="line-41"></a> Parser<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>-<a name="line-42"></a> <font color=Blue>-- * Primitive parser combinators</font>-<a name="line-43"></a> <font color=Cyan>,</font> item<font color=Cyan>,</font> eof<font color=Cyan>,</font> papply<font color=Cyan>,</font> papply'-<a name="line-44"></a> <font color=Blue>-- * Derived combinators</font>-<a name="line-45"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font><font color=Cyan>,</font> <font color=Blue>{-sat,-}</font> tok<font color=Cyan>,</font> nottok<font color=Cyan>,</font> many<font color=Cyan>,</font> many1-<a name="line-46"></a> <font color=Cyan>,</font> sepby<font color=Cyan>,</font> sepby1<font color=Cyan>,</font> chainl<font color=Cyan>,</font> chainl1<font color=Cyan>,</font> chainr<font color=Cyan>,</font> chainr1<font color=Cyan>,</font> ops<font color=Cyan>,</font> bracket-<a name="line-47"></a> <font color=Cyan>,</font> toEOF-<a name="line-48"></a> <font color=Blue>-- * Error handling</font>-<a name="line-49"></a> <font color=Cyan>,</font> elserror-<a name="line-50"></a> <font color=Blue>-- * State handling</font>-<a name="line-51"></a> <font color=Cyan>,</font> stupd<font color=Cyan>,</font> stquery<font color=Cyan>,</font> stget-<a name="line-52"></a> <font color=Blue>-- * Re-parsing</font>-<a name="line-53"></a> <font color=Cyan>,</font> reparse-<a name="line-54"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-55"></a>-<a name="line-56"></a><font color=Green><u>import</u></font> Char-<a name="line-57"></a><font color=Green><u>import</u></font> Monad-<a name="line-58"></a>-<a name="line-59"></a><font color=Green><u>infixr</u></font> <font color=Magenta>5</font> <font color=Cyan>+++</font>-<a name="line-60"></a>-<a name="line-61"></a><font color=Blue>--- The parser monad ---------------------------------------------------------</font>-<a name="line-62"></a>-<a name="line-63"></a><a name="ParseResult"></a><font color=Green><u>type</u></font> ParseResult s t e a <font color=Red>=</font> Either e <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font>s<font color=Cyan>,</font><font color=Red>[</font>Either e t<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font>-<a name="line-64"></a>-<a name="line-65"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t e a <font color=Red>=</font> P <font color=Cyan>(</font> s <font color=Red>-></font> <font color=Red>[</font>Either e t<font color=Red>]</font> <font color=Red>-></font> ParseResult s t e a <font color=Cyan>)</font>-<a name="line-66"></a> <font color=Blue>-- ^ The parser type is parametrised on the types of the state @s@,</font>-<a name="line-67"></a> <font color=Blue>-- the input tokens @t@, error-type @e@, and the result value @a@.</font>-<a name="line-68"></a> <font color=Blue>-- The state and remaining input are threaded through the monad.</font>-<a name="line-69"></a>-<a name="line-70"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t e<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-71"></a> <font color=Blue>-- fmap :: (a -> b) -> (Parser s t e a -> Parser s t e b)</font>-<a name="line-72"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> <font color=Green><u>case</u></font> p st inp <font color=Green><u>of</u></font>-<a name="line-73"></a> Right res <font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>f v<font color=Cyan>,</font> s<font color=Cyan>,</font> out<font color=Cyan>)</font> <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>s<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> res<font color=Red>]</font>-<a name="line-74"></a> Left err <font color=Red>-></font> Left err-<a name="line-75"></a> <font color=Cyan>)</font>-<a name="line-76"></a>-<a name="line-77"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t e<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-78"></a> <font color=Blue>-- return :: a -> Parser s t e a</font>-<a name="line-79"></a> return v <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>v<font color=Cyan>,</font>st<font color=Cyan>,</font>inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-80"></a> <font color=Blue>-- >>= :: Parser s t e a -> (a -> Parser s t e b) -> Parser s t e b</font>-<a name="line-81"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>>>=</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> <font color=Green><u>case</u></font> p st inp <font color=Green><u>of</u></font>-<a name="line-82"></a> Right res <font color=Red>-></font> foldr joinresults <font color=Cyan>(</font>Right []<font color=Cyan>)</font>-<a name="line-83"></a> <font color=Red>[</font> papply' <font color=Cyan>(</font>f v<font color=Cyan>)</font> s out <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>s<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> res <font color=Red>]</font>-<a name="line-84"></a> Left err <font color=Red>-></font> Left err-<a name="line-85"></a> <font color=Cyan>)</font>-<a name="line-86"></a> <font color=Blue>-- fail :: String -> Parser s t e a</font>-<a name="line-87"></a> fail err <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> Right []<font color=Cyan>)</font>-<a name="line-88"></a> <font color=Blue>-- I know it's counterintuitive, but we want no-parse, not an error.</font>-<a name="line-89"></a>-<a name="line-90"></a><font color=Green><u>instance</u></font> MonadPlus <font color=Cyan>(</font>Parser s t e<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-91"></a> <font color=Blue>-- mzero :: Parser s t e a</font>-<a name="line-92"></a> mzero <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> Right []<font color=Cyan>)</font>-<a name="line-93"></a> <font color=Blue>-- mplus :: Parser s t e a -> Parser s t e a -> Parser s t e a</font>-<a name="line-94"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`mplus`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> joinresults <font color=Cyan>(</font>p st inp<font color=Cyan>)</font> <font color=Cyan>(</font>q st inp<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-95"></a>-<a name="line-96"></a><a name="joinresults"></a><font color=Blue>-- joinresults ensures that explicitly raised errors are dominant,</font>-<a name="line-97"></a><font color=Blue>-- provided no parse has yet been found. The commented out code is</font>-<a name="line-98"></a><font color=Blue>-- a slightly stricter specification of the real code.</font>-<a name="line-99"></a><font color=Blue>joinresults</font> <font color=Red>::</font> ParseResult s t e a <font color=Red>-></font> ParseResult s t e a <font color=Red>-></font> ParseResult s t e a-<a name="line-100"></a><font color=Blue>{--<a name="line-101"></a>joinresults (Left p) (Left q) = Left p-<a name="line-102"></a>joinresults (Left p) (Right _) = Left p-<a name="line-103"></a>joinresults (Right []) (Left q) = Left q-<a name="line-104"></a>joinresults (Right p) (Left q) = Right p-<a name="line-105"></a>joinresults (Right p) (Right q) = Right (p++q)-<a name="line-106"></a>-}</font>-<a name="line-107"></a><font color=Blue>joinresults</font> <font color=Cyan>(</font>Left p<font color=Cyan>)</font> q <font color=Red>=</font> Left p-<a name="line-108"></a><font color=Blue>joinresults</font> <font color=Cyan>(</font>Right []<font color=Cyan>)</font> q <font color=Red>=</font> q-<a name="line-109"></a><font color=Blue>joinresults</font> <font color=Cyan>(</font>Right p<font color=Cyan>)</font> q <font color=Red>=</font> Right <font color=Cyan>(</font>p<font color=Cyan>++</font> <font color=Green><u>case</u></font> q <font color=Green><u>of</u></font> Left <font color=Green><u>_</u></font> <font color=Red>-></font> []-<a name="line-110"></a> Right r <font color=Red>-></font> r<font color=Cyan>)</font>-<a name="line-111"></a>-<a name="line-112"></a>-<a name="line-113"></a><font color=Blue>--- Primitive parser combinators ---------------------------------------------</font>-<a name="line-114"></a>-<a name="line-115"></a><a name="item"></a><font color=Blue>-- | Deliver the first remaining token.</font>-<a name="line-116"></a><font color=Blue>item</font> <font color=Red>::</font> Parser s t e t-<a name="line-117"></a><font color=Blue>item</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> <font color=Green><u>case</u></font> inp <font color=Green><u>of</u></font>-<a name="line-118"></a> [] <font color=Red>-></font> Right []-<a name="line-119"></a> <font color=Cyan>(</font>Left e<font color=Red><b>:</b></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> Left e-<a name="line-120"></a> <font color=Cyan>(</font>Right x<font color=Red><b>:</b></font> xs<font color=Cyan>)</font> <font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>x<font color=Cyan>,</font>st<font color=Cyan>,</font>xs<font color=Cyan>)</font><font color=Red>]</font>-<a name="line-121"></a> <font color=Cyan>)</font>-<a name="line-122"></a>-<a name="line-123"></a><a name="eof"></a><font color=Blue>-- | Fail if end of input is not reached</font>-<a name="line-124"></a><font color=Blue>eof</font> <font color=Red>::</font> Show p <font color=Red>=></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String ()-<a name="line-125"></a><font color=Blue>eof</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> <font color=Green><u>case</u></font> inp <font color=Green><u>of</u></font>-<a name="line-126"></a> [] <font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>()<font color=Cyan>,</font>st<font color=Cyan>,</font>[]<font color=Cyan>)</font><font color=Red>]</font>-<a name="line-127"></a> <font color=Cyan>(</font>Left e<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> Left e-<a name="line-128"></a> <font color=Cyan>(</font>Right <font color=Cyan>(</font>p<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> Left <font color=Cyan>(</font><font color=Magenta>"End of input expected at "</font>-<a name="line-129"></a> <font color=Cyan>++</font>show p<font color=Cyan>++</font><font color=Magenta>"\n but found text"</font><font color=Cyan>)</font>-<a name="line-130"></a> <font color=Cyan>)</font>-<a name="line-131"></a>-<a name="line-132"></a><font color=Blue>{--<a name="line-133"></a>-- | Ensure the value delivered by the parser is evaluated to WHNF.-<a name="line-134"></a>force :: Parser s t e a -> Parser s t e a-<a name="line-135"></a>force (P p) = P (\st inp -> let Right xs = p st inp-<a name="line-136"></a> h = head xs in-<a name="line-137"></a> h `seq` Right (h: tail xs)-<a name="line-138"></a> )-<a name="line-139"></a>-- [[[GK]]] ^^^^^^-<a name="line-140"></a>-- WHNF = Weak Head Normal Form, meaning that it has no top-level redex.-<a name="line-141"></a>-- In this case, I think that means that the first element of the list-<a name="line-142"></a>-- is fully evaluated.-<a name="line-143"></a>---<a name="line-144"></a>-- NOTE: the original form of this function fails if there is no parse-<a name="line-145"></a>-- result for p st inp (head xs fails if xs is null), so the modified-<a name="line-146"></a>-- form can assume a Right value only.-<a name="line-147"></a>---<a name="line-148"></a>-- Why is this needed?-<a name="line-149"></a>-- It's not exported, and the only use of this I see is commented out.-<a name="line-150"></a>----------------------------------------<a name="line-151"></a>-}</font>-<a name="line-152"></a>-<a name="line-153"></a>-<a name="line-154"></a><a name="first"></a><font color=Blue>-- | Deliver the first parse result only, eliminating any backtracking.</font>-<a name="line-155"></a><font color=Blue>first</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e a-<a name="line-156"></a><font color=Blue>first</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font> <font color=Green><u>case</u></font> p st inp <font color=Green><u>of</u></font>-<a name="line-157"></a> Right <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>-></font> Right <font color=Red>[</font>x<font color=Red>]</font>-<a name="line-158"></a> otherwise <font color=Red>-></font> otherwise-<a name="line-159"></a> <font color=Cyan>)</font>-<a name="line-160"></a>-<a name="line-161"></a><a name="papply"></a><font color=Blue>-- | Apply the parser to some real input, given an initial state value.</font>-<a name="line-162"></a><font color=Blue>-- If the parser fails, raise 'error' to halt the program.</font>-<a name="line-163"></a><font color=Blue>-- (This is the original exported behaviour - to allow the caller to</font>-<a name="line-164"></a><font color=Blue>-- deal with the error differently, see @papply'@.)</font>-<a name="line-165"></a><font color=Blue>papply</font> <font color=Red>::</font> Parser s t String a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>Either String t<font color=Red>]</font>-<a name="line-166"></a> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font>s<font color=Cyan>,</font><font color=Red>[</font>Either String t<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font>-<a name="line-167"></a><font color=Blue>papply</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> st inp <font color=Red>=</font> either error id <font color=Cyan>(</font>p st inp<font color=Cyan>)</font>-<a name="line-168"></a>-<a name="line-169"></a><a name="papply'"></a><font color=Blue>-- | Apply the parser to some real input, given an initial state value.</font>-<a name="line-170"></a><font color=Blue>-- If the parser fails, return a diagnostic message to the caller.</font>-<a name="line-171"></a><font color=Blue>papply'</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>Either e t<font color=Red>]</font>-<a name="line-172"></a> <font color=Red>-></font> Either e <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font>s<font color=Cyan>,</font><font color=Red>[</font>Either e t<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font>-<a name="line-173"></a><font color=Blue>papply'</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> st inp <font color=Red>=</font> p st inp-<a name="line-174"></a>-<a name="line-175"></a><font color=Blue>--- Derived combinators ------------------------------------------------------</font>-<a name="line-176"></a>-<a name="line-177"></a><a name="+++"></a><font color=Blue>-- | A choice between parsers. Keep only the first success.</font>-<a name="line-178"></a><font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e a <font color=Red>-></font> Parser s t e a-<a name="line-179"></a><a name="p"></a><font color=Blue>p</font> <font color=Cyan>+++</font> q <font color=Red>=</font> first <font color=Cyan>(</font>p <font color=Cyan>`mplus`</font> q<font color=Cyan>)</font>-<a name="line-180"></a>-<a name="line-181"></a><a name="sat"></a><font color=Blue>-- | Deliver the first token if it satisfies a predicate.</font>-<a name="line-182"></a><font color=Blue>sat</font> <font color=Red>::</font> <font color=Cyan>(</font>t <font color=Red>-></font> Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e t-<a name="line-183"></a><font color=Blue>sat</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>x<font color=Cyan>)</font> <font color=Red><-</font> item<font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> mzero<font color=Cyan>}</font>-<a name="line-184"></a>-<a name="line-185"></a><a name="tok"></a><font color=Blue>-- | Deliver the first token if it equals the argument.</font>-<a name="line-186"></a><font color=Blue>tok</font> <font color=Red>::</font> Eq t <font color=Red>=></font> t <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e t-<a name="line-187"></a><font color=Blue>tok</font> t <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>x<font color=Cyan>)</font> <font color=Red><-</font> item<font color=Cyan>;</font> <font color=Green><u>if</u></font> x<font color=Cyan>==</font>t <font color=Green><u>then</u></font> return t <font color=Green><u>else</u></font> mzero<font color=Cyan>}</font>-<a name="line-188"></a>-<a name="line-189"></a><a name="nottok"></a><font color=Blue>-- | Deliver the first token if it does not equal the argument.</font>-<a name="line-190"></a><font color=Blue>nottok</font> <font color=Red>::</font> Eq t <font color=Red>=></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e t-<a name="line-191"></a><font color=Blue>nottok</font> ts <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>x<font color=Cyan>)</font> <font color=Red><-</font> item<font color=Cyan>;</font> <font color=Green><u>if</u></font> x <font color=Cyan>`notElem`</font> ts <font color=Green><u>then</u></font> return x-<a name="line-192"></a> <font color=Green><u>else</u></font> mzero<font color=Cyan>}</font>-<a name="line-193"></a>-<a name="line-194"></a><a name="many"></a><font color=Blue>-- | Deliver zero or more values of @a@.</font>-<a name="line-195"></a><font color=Blue>many</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-196"></a><font color=Blue>many</font> p <font color=Red>=</font> many1 p <font color=Cyan>+++</font> return []-<a name="line-197"></a><font color=Blue>--many p = force (many1 p +++ return [])</font>-<a name="line-198"></a>-<a name="line-199"></a><a name="many1"></a><font color=Blue>-- | Deliver one or more values of @a@.</font>-<a name="line-200"></a><font color=Blue>many1</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-201"></a><font color=Blue>many1</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many p<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-202"></a>-<a name="line-203"></a><a name="sepby"></a><font color=Blue>-- | Deliver zero or more values of @a@ separated by @b@'s.</font>-<a name="line-204"></a><font color=Blue>sepby</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e b <font color=Red>-></font> Parser s t e <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-205"></a><a name="sepby"></a><font color=Blue>p</font> <font color=Cyan>`sepby`</font> sep <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`sepby1`</font> sep<font color=Cyan>)</font> <font color=Cyan>+++</font> return []-<a name="line-206"></a>-<a name="line-207"></a><a name="sepby1"></a><font color=Blue>-- | Deliver one or more values of @a@ separated by @b@'s.</font>-<a name="line-208"></a><font color=Blue>sepby1</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e b <font color=Red>-></font> Parser s t e <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-209"></a><a name="sepby1"></a><font color=Blue>p</font> <font color=Cyan>`sepby1`</font> sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font><font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-210"></a>-<a name="line-211"></a><a name="chainl"></a><font color=Blue>chainl</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Cyan>(</font>a<font color=Red>-></font>a<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> a-<a name="line-212"></a> <font color=Red>-></font> Parser s t e a-<a name="line-213"></a><font color=Blue>chainl</font> p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainl1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v-<a name="line-214"></a>-<a name="line-215"></a><a name="chainl1"></a><font color=Blue>chainl1</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Cyan>(</font>a<font color=Red>-></font>a<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t e a-<a name="line-216"></a><a name="chainl1"></a><font color=Blue>p</font> <font color=Cyan>`chainl1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>-<a name="line-217"></a> <font color=Green><u>where</u></font>-<a name="line-218"></a> rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>f <font color=Red><-</font> op<font color=Cyan>;</font> y <font color=Red><-</font> p<font color=Cyan>;</font> rest <font color=Cyan>(</font>f x y<font color=Cyan>)</font><font color=Cyan>}</font>-<a name="line-219"></a> <font color=Cyan>+++</font> return x-<a name="line-220"></a>-<a name="line-221"></a><a name="chainr"></a><font color=Blue>chainr</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Cyan>(</font>a<font color=Red>-></font>a<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> a-<a name="line-222"></a> <font color=Red>-></font> Parser s t e a-<a name="line-223"></a><font color=Blue>chainr</font> p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainr1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v-<a name="line-224"></a>-<a name="line-225"></a><a name="chainr1"></a><font color=Blue>chainr1</font> <font color=Red>::</font> Parser s t e a <font color=Red>-></font> Parser s t e <font color=Cyan>(</font>a<font color=Red>-></font>a<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t e a-<a name="line-226"></a><a name="chainr1"></a><font color=Blue>p</font> <font color=Cyan>`chainr1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>-<a name="line-227"></a> <font color=Green><u>where</u></font>-<a name="line-228"></a> rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> f <font color=Red><-</font> op-<a name="line-229"></a> <font color=Cyan>;</font> y <font color=Red><-</font> p <font color=Cyan>`chainr1`</font> op-<a name="line-230"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>f x y<font color=Cyan>)</font>-<a name="line-231"></a> <font color=Cyan>}</font>-<a name="line-232"></a> <font color=Cyan>+++</font> return x-<a name="line-233"></a>-<a name="line-234"></a><a name="ops"></a><font color=Blue>ops</font> <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>Parser s t e a<font color=Cyan>,</font> b<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser s t e b-<a name="line-235"></a><font color=Blue>ops</font> xs <font color=Red>=</font> foldr1 <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>[</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>p<font color=Cyan>;</font> return op<font color=Cyan>}</font> <font color=Red>|</font> <font color=Cyan>(</font>p<font color=Cyan>,</font>op<font color=Cyan>)</font> <font color=Red><-</font> xs<font color=Red>]</font>-<a name="line-236"></a>-<a name="line-237"></a><a name="bracket"></a><font color=Blue>bracket</font> <font color=Red>::</font> <font color=Cyan>(</font>Show p<font color=Cyan>,</font>Show t<font color=Cyan>)</font> <font color=Red>=></font>-<a name="line-238"></a> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e a <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e b <font color=Red>-></font>-<a name="line-239"></a> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e c <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> e b-<a name="line-240"></a><font color=Blue>bracket</font> open p close <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open-<a name="line-241"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p-<a name="line-242"></a> <font color=Cyan>;</font> close <font color=Blue>-- `elserror` "improperly matched construct";</font>-<a name="line-243"></a> <font color=Cyan>;</font> return x-<a name="line-244"></a> <font color=Cyan>}</font>-<a name="line-245"></a>-<a name="line-246"></a><a name="toEOF"></a><font color=Blue>-- | Accept a complete parse of the input only, no partial parses.</font>-<a name="line-247"></a><font color=Blue>toEOF</font> <font color=Red>::</font> Show p <font color=Red>=></font>-<a name="line-248"></a> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String a <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String a-<a name="line-249"></a><font color=Blue>toEOF</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p<font color=Cyan>;</font> eof<font color=Cyan>;</font> return x <font color=Cyan>}</font>-<a name="line-250"></a>-<a name="line-251"></a>-<a name="line-252"></a><font color=Blue>--- Error handling -----------------------------------------------------------</font>-<a name="line-253"></a>-<a name="line-254"></a><a name="parseerror"></a><font color=Blue>-- | Return an error using the supplied diagnostic string, and a token type</font>-<a name="line-255"></a><font color=Blue>-- which includes position information.</font>-<a name="line-256"></a><font color=Blue>parseerror</font> <font color=Red>::</font> <font color=Cyan>(</font>Show p<font color=Cyan>,</font>Show t<font color=Cyan>)</font> <font color=Red>=></font> String <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String a-<a name="line-257"></a><font color=Blue>parseerror</font> err <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp <font color=Red>-></font>-<a name="line-258"></a> <font color=Green><u>case</u></font> inp <font color=Green><u>of</u></font>-<a name="line-259"></a> [] <font color=Red>-></font> Left <font color=Magenta>"Parse error: unexpected EOF\n"</font>-<a name="line-260"></a> <font color=Cyan>(</font>Left e<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> Left <font color=Cyan>(</font><font color=Magenta>"Lexical error: "</font><font color=Cyan>++</font>e<font color=Cyan>)</font>-<a name="line-261"></a> <font color=Cyan>(</font>Right <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font>-<a name="line-262"></a> Left <font color=Cyan>(</font><font color=Magenta>"Parse error: in "</font><font color=Cyan>++</font>show p<font color=Cyan>++</font><font color=Magenta>"\n "</font>-<a name="line-263"></a> <font color=Cyan>++</font>err<font color=Cyan>++</font><font color=Magenta>"\n "</font><font color=Cyan>++</font><font color=Magenta>"Found "</font><font color=Cyan>++</font>show t<font color=Cyan>)</font>-<a name="line-264"></a> <font color=Cyan>)</font>-<a name="line-265"></a>-<a name="line-266"></a>-<a name="line-267"></a><a name="elserror"></a><font color=Blue>-- | If the parser fails, generate an error message.</font>-<a name="line-268"></a><font color=Blue>elserror</font> <font color=Red>::</font> <font color=Cyan>(</font>Show p<font color=Cyan>,</font>Show t<font color=Cyan>)</font> <font color=Red>=></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String a <font color=Red>-></font> String-<a name="line-269"></a> <font color=Red>-></font> Parser s <font color=Cyan>(</font>p<font color=Cyan>,</font>t<font color=Cyan>)</font> String a-<a name="line-270"></a><a name="elserror"></a><font color=Blue>p</font> <font color=Cyan>`elserror`</font> s <font color=Red>=</font> p <font color=Cyan>+++</font> parseerror s-<a name="line-271"></a>-<a name="line-272"></a><font color=Blue>--- State handling -----------------------------------------------------------</font>-<a name="line-273"></a>-<a name="line-274"></a><a name="stupd"></a><font color=Blue>-- | Update the internal state.</font>-<a name="line-275"></a><font color=Blue>stupd</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t e ()-<a name="line-276"></a><font color=Blue>stupd</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp<font color=Red>-></font> <font color=Blue>{-let newst = f st in newst `seq`-}</font>-<a name="line-277"></a> Right <font color=Red>[</font><font color=Cyan>(</font>()<font color=Cyan>,</font> f st<font color=Cyan>,</font> inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-278"></a>-<a name="line-279"></a><a name="stquery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="line-280"></a><font color=Blue>stquery</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t e a-<a name="line-281"></a><font color=Blue>stquery</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp<font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>f st<font color=Cyan>,</font> st<font color=Cyan>,</font> inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-282"></a>-<a name="line-283"></a><a name="stget"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="line-284"></a><font color=Blue>stget</font> <font color=Red>::</font> Parser s t e s-<a name="line-285"></a><font color=Blue>stget</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp<font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>st<font color=Cyan>,</font> st<font color=Cyan>,</font> inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-286"></a>-<a name="line-287"></a>-<a name="line-288"></a><font color=Blue>--- Push some tokens back onto the input stream and reparse ------------------</font>-<a name="line-289"></a>-<a name="line-290"></a><a name="reparse"></a><font color=Blue>-- | This is useful for recursively expanding macros. When the</font>-<a name="line-291"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="line-292"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="line-293"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="line-294"></a><font color=Blue>reparse</font> <font color=Red>::</font> <font color=Red>[</font>Either e t<font color=Red>]</font> <font color=Red>-></font> Parser s t e ()-<a name="line-295"></a><font color=Blue>reparse</font> ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>st inp<font color=Red>-></font> Right <font color=Red>[</font><font color=Cyan>(</font>()<font color=Cyan>,</font> st<font color=Cyan>,</font> ts<font color=Cyan>++</font>inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>-<a name="line-296"></a>-<a name="line-297"></a><font color=Blue>------------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly.html
@@ -1,15 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Plain-<a name="line-3"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-4"></a>-<a name="line-5"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Plain-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/Base.html
@@ -1,205 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly/Base.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The PolyParse class</font>-<a name="line-3"></a> PolyParse<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- class of all monadic two-level-error parsers</font>-<a name="line-4"></a>-<a name="line-5"></a> <font color=Blue>-- * Combinators general to all parser types.</font>-<a name="line-6"></a> <font color=Blue>-- ** Simple combinators</font>-<a name="line-7"></a> <font color=Cyan>,</font> discard <font color=Blue>-- :: PolyParse p => p a -> p b -> p a</font>-<a name="line-8"></a> <font color=Blue>-- ** Error-handling</font>-<a name="line-9"></a> <font color=Cyan>,</font> failBad <font color=Blue>-- :: PolyParse p => String -> p a</font>-<a name="line-10"></a> <font color=Cyan>,</font> adjustErrBad<font color=Blue>-- :: PolyParse p => p a -> (String->String) -> p a</font>-<a name="line-11"></a> <font color=Cyan>,</font> indent <font color=Blue>-- :: Int -> String -> String</font>-<a name="line-12"></a> <font color=Blue>-- ** Choices</font>-<a name="line-13"></a> <font color=Cyan>,</font> oneOf <font color=Blue>-- :: PolyParse p => [p a] -> p a</font>-<a name="line-14"></a> <font color=Cyan>,</font> optional <font color=Blue>-- :: PolyParse p => p a -> p (Maybe a)</font>-<a name="line-15"></a> <font color=Blue>-- ** Sequences</font>-<a name="line-16"></a> <font color=Cyan>,</font> exactly <font color=Blue>-- :: PolyParse p => Int -> p a -> p [a]</font>-<a name="line-17"></a> <font color=Cyan>,</font> many <font color=Blue>-- :: PolyParse p => p a -> p [a]</font>-<a name="line-18"></a> <font color=Cyan>,</font> many1 <font color=Blue>-- :: PolyParse p => p a -> p [a]</font>-<a name="line-19"></a> <font color=Cyan>,</font> sepBy <font color=Blue>-- :: PolyParse p => p a -> p sep -> p [a]</font>-<a name="line-20"></a> <font color=Cyan>,</font> sepBy1 <font color=Blue>-- :: PolyParse p => p a -> p sep -> p [a]</font>-<a name="line-21"></a> <font color=Cyan>,</font> bracketSep <font color=Blue>-- :: PolyParse p => p bra -> p sep -> p ket -> p a -> p [a]</font>-<a name="line-22"></a> <font color=Cyan>,</font> bracket <font color=Blue>-- :: PolyParse p => p bra -> p ket -> p a -> p a</font>-<a name="line-23"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: PolyParse p => p a -> p z -> p [a]</font>-<a name="line-24"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-25"></a>-<a name="line-26"></a><font color=Magenta><em>#ifdef __NHC__</em></font>-<a name="line-27"></a><font color=Green><u>default</u></font> <font color=Cyan>(</font>Integer<font color=Cyan>,</font>Double<font color=Cyan>,</font>[]<font color=Cyan>)</font> <font color=Blue>-- hack to avoid bizarre type defaulting error</font>-<a name="line-28"></a><font color=Green><u>instance</u></font> PolyParse []-<a name="line-29"></a><font color=Magenta><em>#endif</em></font>-<a name="line-30"></a>-<a name="line-31"></a><a name="PolyParse"></a><font color=Blue>-- | The @PolyParse@ class is an abstraction over all the current</font>-<a name="line-32"></a><a name="PolyParse"></a><font color=Blue>-- concrete representations of monadic parser combinators in this</font>-<a name="line-33"></a><a name="PolyParse"></a><font color=Blue>-- package. The common feature is two-level error-handling.</font>-<a name="line-34"></a><a name="PolyParse"></a><font color=Blue>-- Some primitives must be implemented specific to each parser type</font>-<a name="line-35"></a><a name="PolyParse"></a><font color=Blue>-- (e.g. depending on whether the parser has a running state, or</font>-<a name="line-36"></a><a name="PolyParse"></a><font color=Blue>-- whether it is lazy). But given those primitives, large numbers of</font>-<a name="line-37"></a><a name="PolyParse"></a><font color=Blue>-- combinators do not depend any further on the internal structure of</font>-<a name="line-38"></a><a name="PolyParse"></a><font color=Blue>-- the particular parser.</font>-<a name="line-39"></a><a name="PolyParse"></a><font color=Blue>--</font>-<a name="line-40"></a><a name="PolyParse"></a><font color=Blue>-- There are two additional basic combinators that we expect to be implemented</font>-<a name="line-41"></a><a name="PolyParse"></a><font color=Blue>-- afresh for every concrete type, but which (for technical reasons)</font>-<a name="line-42"></a><a name="PolyParse"></a><font color=Blue>-- cannot be class methods. They are @next@ and @satisfy@.</font>-<a name="line-43"></a><a name="PolyParse"></a><font color=Green><u>class</u></font> <font color=Cyan>(</font>Functor p<font color=Cyan>,</font> Monad p<font color=Cyan>)</font> <font color=Red>=></font> PolyParse p <font color=Green><u>where</u></font>-<a name="line-44"></a> <font color=Blue>-- | Commit is a way of raising the severity of any errors found within</font>-<a name="line-45"></a> <font color=Blue>-- its argument. Used in the middle of a parser definition, it means that</font>-<a name="line-46"></a> <font color=Blue>-- any operations prior to commitment fail softly, but after commitment,</font>-<a name="line-47"></a> <font color=Blue>-- they fail hard.</font>-<a name="line-48"></a> commit <font color=Red>::</font> p a <font color=Red>-></font> p a-<a name="line-49"></a> <font color=Blue>-- | @p `adjustErr` f@ applies the transformation @f@ to any error message</font>-<a name="line-50"></a> <font color=Blue>-- generated in @p@, having no effect if @p@ succeeds.</font>-<a name="line-51"></a> adjustErr <font color=Red>::</font> p a <font color=Red>-></font> <font color=Cyan>(</font>String <font color=Red>-></font> String<font color=Cyan>)</font> <font color=Red>-></font> p a-<a name="line-52"></a> <font color=Blue>-- | @p `onFail` q@ means parse p, unless p fails, in which case</font>-<a name="line-53"></a> <font color=Blue>-- parse q instead.</font>-<a name="line-54"></a> <font color=Blue>-- Can be chained together to give multiple attempts to parse something.</font>-<a name="line-55"></a> <font color=Blue>-- (Note that q could itself be a failing parser, e.g. to change the error</font>-<a name="line-56"></a> <font color=Blue>-- message from that defined in p to something different.)</font>-<a name="line-57"></a> <font color=Blue>-- However, a severe failure in p cannot be ignored.</font>-<a name="line-58"></a> onFail <font color=Red>::</font> p a <font color=Red>-></font> p a <font color=Red>-></font> p a-<a name="line-59"></a> <font color=Blue>-- | Parse the first alternative that succeeds, but if none succeed,</font>-<a name="line-60"></a> <font color=Blue>-- report only the severe errors, and if none of those, then report</font>-<a name="line-61"></a> <font color=Blue>-- all the soft errors.</font>-<a name="line-62"></a> oneOf' <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font> p a<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> p a-<a name="line-63"></a> <font color=Blue>-- | Apply a parsed function to a parsed value.</font>-<a name="line-64"></a> <font color=Blue>-- Rather like ordinary function application lifted into parsers.</font>-<a name="line-65"></a> apply <font color=Red>::</font> p <font color=Cyan>(</font>a<font color=Red>-></font>b<font color=Cyan>)</font> <font color=Red>-></font> p a <font color=Red>-></font> p b-<a name="line-66"></a> pf <font color=Cyan>`apply`</font> px <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> f <font color=Red><-</font> pf<font color=Cyan>;</font> x <font color=Red><-</font> px<font color=Cyan>;</font> return <font color=Cyan>(</font>f x<font color=Cyan>)</font> <font color=Cyan>}</font>-<a name="line-67"></a> <font color=Blue>-- note: the Poly.Lazy variants override this defn with a lazier one.</font>-<a name="line-68"></a>-<a name="line-69"></a><font color=Green><u>infixl</u></font> <font color=Magenta>6</font> <font color=Cyan>`onFail`</font> <font color=Blue>-- not sure about precedence 6?</font>-<a name="line-70"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`apply`</font>-<a name="line-71"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`discard`</font>-<a name="line-72"></a>-<a name="line-73"></a><font color=Blue>{--<a name="line-74"></a>-- Combinators we expect most concrete parser types to implement.-<a name="line-75"></a>-- For technical reasons, they cannot be class members.-<a name="line-76"></a>-<a name="line-77"></a>-- | Yield the next token-<a name="line-78"></a>next :: PolyParse p => p t-<a name="line-79"></a> -- where t is constrained to be the input token type-<a name="line-80"></a>-<a name="line-81"></a>-- | One token satisfying a predicate.-<a name="line-82"></a>satisfy :: PolyParse p => (t->Bool) -> p t t-<a name="line-83"></a>satisfy p = do{ x <- next-<a name="line-84"></a> ; if p x then return x else fail "Parse.satisfy: failed"-<a name="line-85"></a> }-<a name="line-86"></a> -- note: must be re-defined for each implementation because-<a name="line-87"></a> -- its type cannot be expressed otherwise.-<a name="line-88"></a>-}</font>-<a name="line-89"></a>-<a name="line-90"></a><a name="failBad"></a><font color=Blue>-- | When a simple fail is not strong enough, use failBad for emphasis.</font>-<a name="line-91"></a><font color=Blue>-- An emphasised (severe) error cannot be overridden by choice</font>-<a name="line-92"></a><font color=Blue>-- operators.</font>-<a name="line-93"></a><font color=Blue>failBad</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> String <font color=Red>-></font> p a-<a name="line-94"></a><font color=Blue>failBad</font> e <font color=Red>=</font> commit <font color=Cyan>(</font>fail e<font color=Cyan>)</font>-<a name="line-95"></a>-<a name="line-96"></a><a name="discard"></a><font color=Blue>-- | @x `discard` y@ parses both x and y, but discards the result of y.</font>-<a name="line-97"></a><font color=Blue>-- Rather like @const@ lifted into parsers.</font>-<a name="line-98"></a><font color=Blue>discard</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p b <font color=Red>-></font> p a-<a name="line-99"></a><a name="discard"></a><font color=Blue>px</font> <font color=Cyan>`discard`</font> py <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> px<font color=Cyan>;</font> return <font color=Cyan>(</font>const x<font color=Cyan>)</font> <font color=Cyan>`apply`</font> py<font color=Cyan>;</font> <font color=Cyan>}</font>-<a name="line-100"></a>-<a name="line-101"></a><a name="adjustErrBad"></a><font color=Blue>-- | @adjustErrBad@ is just like @adjustErr@ except it also raises the</font>-<a name="line-102"></a><font color=Blue>-- severity of the error.</font>-<a name="line-103"></a><font color=Blue>adjustErrBad</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> p a-<a name="line-104"></a><a name="adjustErrBad"></a><font color=Blue>p</font> <font color=Cyan>`adjustErrBad`</font> f <font color=Red>=</font> commit <font color=Cyan>(</font>p <font color=Cyan>`adjustErr`</font> f<font color=Cyan>)</font>-<a name="line-105"></a>-<a name="line-106"></a><a name="oneOf"></a><font color=Blue>-- | Parse the first alternative in the list that succeeds.</font>-<a name="line-107"></a><font color=Blue>oneOf</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> <font color=Red>[</font>p a<font color=Red>]</font> <font color=Red>-></font> p a-<a name="line-108"></a><font color=Blue>oneOf</font> [] <font color=Red>=</font> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices"</font><font color=Cyan>)</font>-<a name="line-109"></a><font color=Blue>oneOf</font> <font color=Cyan>(</font>p<font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font> p <font color=Cyan>`onFail`</font> oneOf ps-<a name="line-110"></a><font color=Blue>--oneOf :: Show t => [Parser t a] -> Parser t a</font>-<a name="line-111"></a><font color=Blue>--oneOf [] = do { n <- next</font>-<a name="line-112"></a><font color=Blue>-- ; fail ("failed to parse any of the possible choices"</font>-<a name="line-113"></a><font color=Blue>-- ++"\n next token is "++show n)</font>-<a name="line-114"></a><font color=Blue>-- }</font>-<a name="line-115"></a><font color=Blue>--oneOf (p:ps) = p `onFail` oneOf ps</font>-<a name="line-116"></a>-<a name="line-117"></a><a name="indent"></a><font color=Blue>-- | Helper for formatting error messages: indents all lines by a fixed amount.</font>-<a name="line-118"></a><font color=Blue>indent</font> <font color=Red>::</font> Int <font color=Red>-></font> String <font color=Red>-></font> String-<a name="line-119"></a><font color=Blue>indent</font> n <font color=Red>=</font> unlines <font color=Cyan>.</font> map <font color=Cyan>(</font>replicate n <font color=Magenta>' '</font> <font color=Cyan>++</font><font color=Cyan>)</font> <font color=Cyan>.</font> lines-<a name="line-120"></a>-<a name="line-121"></a><a name="optional"></a><font color=Blue>-- | 'optional' indicates whether the parser succeeded through the Maybe type.</font>-<a name="line-122"></a><font color=Blue>optional</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p <font color=Cyan>(</font>Maybe a<font color=Cyan>)</font>-<a name="line-123"></a><font color=Blue>optional</font> p <font color=Red>=</font> fmap Just p <font color=Cyan>`onFail`</font> return Nothing-<a name="line-124"></a>-<a name="line-125"></a><a name="exactly"></a><font color=Blue>-- | 'exactly n p' parses precisely n items, using the parser p, in sequence.</font>-<a name="line-126"></a><font color=Blue>exactly</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> Int <font color=Red>-></font> p a <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-127"></a><font color=Blue>exactly</font> <font color=Magenta>0</font> p <font color=Red>=</font> return []-<a name="line-128"></a><font color=Blue>exactly</font> n p <font color=Red>=</font> return <font color=Cyan>(</font><font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> <font color=Cyan>(</font>p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"When expecting exactly "</font>-<a name="line-129"></a> <font color=Cyan>++</font>show n<font color=Cyan>++</font><font color=Magenta>" more items"</font><font color=Cyan>)</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-130"></a> <font color=Cyan>`apply`</font> exactly <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> p-<a name="line-131"></a>-<a name="line-132"></a><a name="many"></a><font color=Blue>-- | 'many p' parses a list of elements with individual parser p.</font>-<a name="line-133"></a><font color=Blue>-- Cannot fail, since an empty list is a valid return value.</font>-<a name="line-134"></a><font color=Blue>many</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-135"></a><font color=Blue>many</font> p <font color=Red>=</font> many1 p <font color=Cyan>`onFail`</font> return []-<a name="line-136"></a>-<a name="line-137"></a><a name="many1"></a><font color=Blue>-- | Parse a non-empty list of items.</font>-<a name="line-138"></a><font color=Blue>many1</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-139"></a><font color=Blue>many1</font> p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"In a sequence:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>.</font> indent <font color=Magenta>2</font><font color=Cyan>)</font>-<a name="line-140"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> many p-<a name="line-141"></a> <font color=Cyan>}</font>-<a name="line-142"></a><font color=Blue>-- `adjustErr` ("When looking for a non-empty sequence:\n\t"++)</font>-<a name="line-143"></a>-<a name="line-144"></a><a name="sepBy"></a><font color=Blue>-- | Parse a list of items separated by discarded junk.</font>-<a name="line-145"></a><font color=Blue>sepBy</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p sep <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-146"></a><font color=Blue>sepBy</font> p sep <font color=Red>=</font> <font color=Green><u>do</u></font> sepBy1 p sep <font color=Cyan>`onFail`</font> return []-<a name="line-147"></a>-<a name="line-148"></a><a name="sepBy1"></a><font color=Blue>-- | Parse a non-empty list of items separated by discarded junk.</font>-<a name="line-149"></a><font color=Blue>sepBy1</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p sep <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-150"></a><font color=Blue>sepBy1</font> p sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p-<a name="line-151"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="line-152"></a> <font color=Cyan>}</font>-<a name="line-153"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for a non-empty sequence with separators:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-154"></a> -<a name="line-155"></a><a name="bracketSep"></a><font color=Blue>-- | Parse a list of items, discarding the start, end, and separator</font>-<a name="line-156"></a><font color=Blue>-- items.</font>-<a name="line-157"></a><font color=Blue>bracketSep</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p bra <font color=Red>-></font> p sep <font color=Red>-></font> p ket <font color=Red>-></font> p a <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-158"></a><font color=Blue>bracketSep</font> open sep close p <font color=Red>=</font>-<a name="line-159"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open<font color=Cyan>;</font> close<font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="line-160"></a> <font color=Cyan>`onFail`</font>-<a name="line-161"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-162"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"After first bracket in a group:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-163"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font>-<a name="line-164"></a> <font color=Cyan>`apply`</font> manyFinally <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="line-165"></a> <font color=Cyan>(</font>close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for closing bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-166"></a> <font color=Cyan>}</font>-<a name="line-167"></a>-<a name="line-168"></a><a name="bracket"></a><font color=Blue>-- | Parse a bracketed item, discarding the brackets.</font>-<a name="line-169"></a><font color=Blue>bracket</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p bra <font color=Red>-></font> p ket <font color=Red>-></font> p a <font color=Red>-></font> p a-<a name="line-170"></a><font color=Blue>bracket</font> open close p <font color=Red>=</font> <font color=Green><u>do</u></font>-<a name="line-171"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="line-172"></a> <font color=Cyan>;</font> p <font color=Cyan>`discard`</font> <font color=Cyan>(</font>close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"Missing closing bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-173"></a> <font color=Cyan>}</font>-<a name="line-174"></a>-<a name="line-175"></a><a name="manyFinally"></a><font color=Blue>-- | 'manyFinally e t' parses a possibly-empty sequence of e's,</font>-<a name="line-176"></a><font color=Blue>-- terminated by a t. The final t is discarded. Any parse failures</font>-<a name="line-177"></a><font color=Blue>-- could be due either to a badly-formed terminator or a badly-formed</font>-<a name="line-178"></a><font color=Blue>-- element, so it raises both possible errors.</font>-<a name="line-179"></a><font color=Blue>manyFinally</font> <font color=Red>::</font> PolyParse p <font color=Red>=></font> p a <font color=Red>-></font> p z <font color=Red>-></font> p <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-180"></a><font color=Blue>manyFinally</font> p t <font color=Red>=</font>-<a name="line-181"></a> <font color=Cyan>(</font>many p <font color=Cyan>`discard`</font> t<font color=Cyan>)</font>-<a name="line-182"></a> <font color=Cyan>`onFail`</font>-<a name="line-183"></a> oneOf' <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"sequence terminator"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> t<font color=Cyan>;</font> return [] <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="line-184"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"item in a sequence"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> p<font color=Cyan>;</font> return [] <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="line-185"></a> <font color=Red>]</font>-<a name="line-186"></a><font color=Blue>{--<a name="line-187"></a>manyFinally p t =-<a name="line-188"></a> do { xs <- many p-<a name="line-189"></a> ; oneOf' [ ("sequence terminator", do { t; return () } )-<a name="line-190"></a> , ("item in a sequence", do { p; return () } )-<a name="line-191"></a> ]-<a name="line-192"></a> ; return xs-<a name="line-193"></a> }-<a name="line-194"></a>-}</font>-<a name="line-195"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/Lazy.html
@@ -1,139 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly/Lazy.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Lazy-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="line-3"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="line-4"></a> <font color=Cyan>,</font> Result<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- internal to the parser monad</font>-<a name="line-5"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser t a -> [t] -> (Either String a, [t])</font>-<a name="line-6"></a> <font color=Blue>-- ** basic parsers</font>-<a name="line-7"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser t t</font>-<a name="line-8"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser t t</font>-<a name="line-9"></a>-<a name="line-10"></a> <font color=Blue>-- ** re-parsing</font>-<a name="line-11"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser t ()</font>-<a name="line-12"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="line-13"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-14"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-15"></a>-<a name="line-16"></a>-<a name="line-17"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-18"></a>-<a name="line-19"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="line-20"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="line-21"></a><a name="throwE"></a><font color=Blue>throwE</font> <font color=Red>::</font> String <font color=Red>-></font> a-<a name="line-22"></a><font color=Blue>throwE</font> msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="line-23"></a><font color=Magenta><em>#else</em></font>-<a name="line-24"></a><font color=Blue>throwE</font> <font color=Red>::</font> String <font color=Red>-></font> a-<a name="line-25"></a><font color=Blue>throwE</font> msg <font color=Red>=</font> error msg-<a name="line-26"></a><font color=Magenta><em>#endif</em></font>-<a name="line-27"></a>-<a name="line-28"></a>-<a name="line-29"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="line-30"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="line-31"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="line-32"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="line-33"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser t a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> a<font color=Cyan>)</font>-<a name="line-34"></a>-<a name="line-35"></a><a name="Result"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="line-36"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="line-37"></a><a name="Result"></a><font color=Blue>-- This should only be used for writing very primitive</font>-<a name="line-38"></a><a name="Result"></a><font color=Blue>-- parsers - really it is an internal detail of the library.</font>-<a name="line-39"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z a <font color=Red>=</font> Success z a-<a name="line-40"></a> <font color=Red>|</font> Failure z String-<a name="line-41"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z a<font color=Cyan>)</font> <font color=Blue>-- still needed</font>-<a name="line-42"></a>-<a name="line-43"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-44"></a> fmap f <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> Success z <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="line-45"></a> fmap f <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="line-46"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="line-47"></a>-<a name="line-48"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="line-49"></a><font color=Blue>runParser</font> <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-50"></a><font color=Blue>runParser</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> fromResult <font color=Cyan>.</font> p-<a name="line-51"></a> <font color=Green><u>where</u></font>-<a name="line-52"></a> fromResult <font color=Red>::</font> Result z a <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-53"></a> fromResult <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-54"></a> fromResult <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> throwE e-<a name="line-55"></a> fromResult <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> fromResult r-<a name="line-56"></a>-<a name="line-57"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-58"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>fmap f <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-59"></a>-<a name="line-60"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-61"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Success ts x<font color=Cyan>)</font>-<a name="line-62"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Failure ts e<font color=Cyan>)</font>-<a name="line-63"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> f<font color=Cyan>)</font>-<a name="line-64"></a> <font color=Green><u>where</u></font>-<a name="line-65"></a> continue <font color=Cyan>(</font>Success ts x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' ts-<a name="line-66"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="line-67"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-68"></a> continue <font color=Cyan>(</font>Failure ts e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts e-<a name="line-69"></a>-<a name="line-70"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-71"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>Committed <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-72"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font>adjust <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-73"></a> <font color=Green><u>where</u></font>-<a name="line-74"></a> adjust <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="line-75"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="line-76"></a> adjust good <font color=Red>=</font> good-<a name="line-77"></a>-<a name="line-78"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> continue ts <font color=Cyan>$</font> p ts<font color=Cyan>)</font>-<a name="line-79"></a> <font color=Green><u>where</u></font>-<a name="line-80"></a> continue ts <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> q ts-<a name="line-81"></a> <font color=Blue>-- continue _ (Committed r) = r -- no, remain Committed</font>-<a name="line-82"></a> continue <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="line-83"></a>-<a name="line-84"></a> oneOf' <font color=Red>=</font> accum []-<a name="line-85"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="line-86"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="line-87"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-88"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="line-89"></a> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="line-90"></a> Failure <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="line-91"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="line-92"></a> <font color=Green><u>in</u></font> p ts-<a name="line-93"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="line-94"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="line-95"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="line-96"></a>-<a name="line-97"></a> <font color=Blue>-- Apply a parsed function to a parsed value. This version</font>-<a name="line-98"></a> <font color=Blue>-- is strict in the result of the function parser, but</font>-<a name="line-99"></a> <font color=Blue>-- lazy in the result of the argument parser. (Argument laziness is</font>-<a name="line-100"></a> <font color=Blue>-- the distinctive feature over other implementations.)</font>-<a name="line-101"></a> <font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> px <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> pf<font color=Cyan>)</font>-<a name="line-102"></a> <font color=Green><u>where</u></font>-<a name="line-103"></a> continue <font color=Cyan>(</font>Success z f<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x<font color=Cyan>,</font>z'<font color=Cyan>)</font> <font color=Red>=</font> runParser px z-<a name="line-104"></a> <font color=Green><u>in</u></font> Success z' <font color=Cyan>(</font>f x<font color=Cyan>)</font>-<a name="line-105"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-106"></a> continue <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="line-107"></a>-<a name="line-108"></a>-<a name="line-109"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-110"></a><font color=Blue>next</font> <font color=Red>::</font> Parser t t-<a name="line-111"></a><font color=Blue>next</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="line-112"></a> [] <font color=Red>-></font> Failure [] <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="line-113"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' t <font color=Cyan>)</font>-<a name="line-114"></a>-<a name="line-115"></a><a name="satisfy"></a><font color=Blue>satisfy</font> <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser t t-<a name="line-116"></a><font color=Blue>satisfy</font> pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="line-117"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="line-118"></a> <font color=Cyan>}</font>-<a name="line-119"></a>-<a name="line-120"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-121"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="line-122"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="line-123"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="line-124"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="line-125"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="line-126"></a><font color=Blue>reparse</font> <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser t ()-<a name="line-127"></a><font color=Blue>reparse</font> ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="line-128"></a>-<a name="line-129"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/Lazy.html
@@ -1,130 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>NoLeak<font color=Cyan>.</font>Lazy-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="(line3)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="(line4)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser t a -> [t] -> (Either String a, [t])</font>-<a name="(line5)"></a> <font color=Blue>-- ** basic parsers</font>-<a name="(line6)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser t t</font>-<a name="(line7)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser t t</font>-<a name="(line8)"></a>-<a name="(line9)"></a> <font color=Blue>-- ** re-parsing</font>-<a name="(line10)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser t ()</font>-<a name="(line11)"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="(line12)"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line13)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line14)"></a>-<a name="(line15)"></a>-<a name="(line16)"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line17)"></a>-<a name="(line18)"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="(line19)"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="(line20)"></a><a name="throwE"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line21)"></a>throwE msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="(line22)"></a><font color=Magenta><em>#else</em></font>-<a name="(line23)"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line24)"></a>throwE msg <font color=Red>=</font> error msg-<a name="(line25)"></a><font color=Magenta><em>#endif</em></font>-<a name="(line26)"></a>-<a name="(line27)"></a>-<a name="(line28)"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line29)"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="(line30)"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="(line31)"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="(line32)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser t a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> a<font color=Cyan>)</font>-<a name="(line33)"></a>-<a name="(line34)"></a><a name="Result"></a><font color=Blue>-- A return type like Either, that distinguishes not only between</font>-<a name="(line35)"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="(line36)"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z a <font color=Red>=</font> Success z a-<a name="(line37)"></a> <font color=Red>|</font> Failure z String-<a name="(line38)"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z a<font color=Cyan>)</font> <font color=Blue>-- still needed</font>-<a name="(line39)"></a>-<a name="(line40)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line41)"></a> fmap f <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> Success z <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="(line42)"></a> fmap f <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="(line43)"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="(line44)"></a>-<a name="(line45)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="(line46)"></a>runParser <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line47)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> fromResult <font color=Cyan>.</font> p-<a name="(line48)"></a> <font color=Green><u>where</u></font>-<a name="(line49)"></a> fromResult <font color=Red>::</font> Result z a <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line50)"></a> fromResult <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line51)"></a> fromResult <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> throwE e-<a name="(line52)"></a> fromResult <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> fromResult r-<a name="(line53)"></a>-<a name="(line54)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line55)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>fmap f <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line56)"></a>-<a name="(line57)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line58)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Success ts x<font color=Cyan>)</font>-<a name="(line59)"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Failure ts e<font color=Cyan>)</font>-<a name="(line60)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> f<font color=Cyan>)</font>-<a name="(line61)"></a> <font color=Green><u>where</u></font>-<a name="(line62)"></a> continue <font color=Cyan>(</font>Success ts x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' ts-<a name="(line63)"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="(line64)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line65)"></a> continue <font color=Cyan>(</font>Failure ts e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts e-<a name="(line66)"></a>-<a name="(line67)"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line68)"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>Committed <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line69)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font>adjust <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line70)"></a> <font color=Green><u>where</u></font>-<a name="(line71)"></a> adjust <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="(line72)"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="(line73)"></a> adjust good <font color=Red>=</font> good-<a name="(line74)"></a>-<a name="(line75)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> continue ts <font color=Cyan>$</font> p ts<font color=Cyan>)</font>-<a name="(line76)"></a> <font color=Green><u>where</u></font>-<a name="(line77)"></a> continue ts <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> q ts-<a name="(line78)"></a> <font color=Blue>-- continue _ (Committed r) = r -- no, remain Committed</font>-<a name="(line79)"></a> continue <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="(line80)"></a>-<a name="(line81)"></a> oneOf' <font color=Red>=</font> accum []-<a name="(line82)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line83)"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="(line84)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line85)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line86)"></a> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line87)"></a> Failure <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="(line88)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line89)"></a> <font color=Green><u>in</u></font> p ts-<a name="(line90)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="(line91)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="(line92)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line93)"></a>-<a name="(line94)"></a> <font color=Blue>-- Apply a parsed function to a parsed value. This version</font>-<a name="(line95)"></a> <font color=Blue>-- is strict in the result of the function parser, but</font>-<a name="(line96)"></a> <font color=Blue>-- lazy in the result of the argument parser. (Argument laziness is</font>-<a name="(line97)"></a> <font color=Blue>-- the distinctive feature over other implementations.)</font>-<a name="(line98)"></a> <font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> px <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> pf<font color=Cyan>)</font>-<a name="(line99)"></a> <font color=Green><u>where</u></font>-<a name="(line100)"></a> continue <font color=Cyan>(</font>Success z f<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x<font color=Cyan>,</font>z'<font color=Cyan>)</font> <font color=Red>=</font> runParser px z-<a name="(line101)"></a> <font color=Green><u>in</u></font> Success z' <font color=Cyan>(</font>f x<font color=Cyan>)</font>-<a name="(line102)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line103)"></a> continue <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="(line104)"></a>-<a name="(line105)"></a>-<a name="(line106)"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line107)"></a>next <font color=Red>::</font> Parser t t-<a name="(line108)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line109)"></a> [] <font color=Red>-></font> Failure [] <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="(line110)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' t <font color=Cyan>)</font>-<a name="(line111)"></a>-<a name="(line112)"></a><a name="satisfy"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser t t-<a name="(line113)"></a>satisfy pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line114)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line115)"></a> <font color=Cyan>}</font>-<a name="(line116)"></a>-<a name="(line117)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line118)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line119)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line120)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line121)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line122)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line123)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser t ()-<a name="(line124)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="(line125)"></a>-<a name="(line126)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/Plain.html
@@ -1,109 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>NoLeak<font color=Cyan>.</font>Plain-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="(line3)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="(line4)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser t a -> [t] -> (Either String a, [t])</font>-<a name="(line5)"></a> <font color=Blue>-- ** basic parsers</font>-<a name="(line6)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser t t</font>-<a name="(line7)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser t t</font>-<a name="(line8)"></a>-<a name="(line9)"></a> <font color=Blue>-- ** re-parsing</font>-<a name="(line10)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser t ()</font>-<a name="(line11)"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="(line12)"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line13)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line14)"></a>-<a name="(line15)"></a>-<a name="(line16)"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line17)"></a>-<a name="(line18)"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line19)"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="(line20)"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="(line21)"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="(line22)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser t a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> a<font color=Cyan>)</font>-<a name="(line23)"></a>-<a name="(line24)"></a><a name="Result"></a><font color=Blue>-- A return type like Either, that distinguishes not only between</font>-<a name="(line25)"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has commitment, so that a failure</font>-<a name="(line26)"></a><a name="Result"></a><font color=Blue>-- cannot be undone.</font>-<a name="(line27)"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z a <font color=Red>=</font> Success z a-<a name="(line28)"></a> <font color=Red>|</font> Failure z String-<a name="(line29)"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z a<font color=Cyan>)</font>-<a name="(line30)"></a>-<a name="(line31)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line32)"></a> fmap f <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> Success z <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="(line33)"></a> fmap f <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="(line34)"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="(line35)"></a>-<a name="(line36)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="(line37)"></a>runParser <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line38)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> resultToEither <font color=Cyan>.</font> p-<a name="(line39)"></a> <font color=Green><u>where</u></font>-<a name="(line40)"></a> resultToEither <font color=Red>::</font> Result z a <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line41)"></a> resultToEither <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Right a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line42)"></a> resultToEither <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line43)"></a> resultToEither <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> resultToEither r-<a name="(line44)"></a>-<a name="(line45)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line46)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>fmap f <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line47)"></a>-<a name="(line48)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line49)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Success ts x<font color=Cyan>)</font>-<a name="(line50)"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Failure ts e<font color=Cyan>)</font>-<a name="(line51)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> f<font color=Cyan>)</font>-<a name="(line52)"></a> <font color=Green><u>where</u></font>-<a name="(line53)"></a> continue <font color=Cyan>(</font>Success ts x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' ts-<a name="(line54)"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="(line55)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line56)"></a> continue <font color=Cyan>(</font>Failure ts e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts e-<a name="(line57)"></a>-<a name="(line58)"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line59)"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>Committed <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line60)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font>adjust <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="(line61)"></a> <font color=Green><u>where</u></font>-<a name="(line62)"></a> adjust <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="(line63)"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="(line64)"></a> adjust good <font color=Red>=</font> good-<a name="(line65)"></a>-<a name="(line66)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> continue ts <font color=Cyan>$</font> p ts<font color=Cyan>)</font>-<a name="(line67)"></a> <font color=Green><u>where</u></font>-<a name="(line68)"></a> continue ts <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> q ts-<a name="(line69)"></a> <font color=Blue>-- continue _ (Committed r) = r -- no, remain Committed</font>-<a name="(line70)"></a> continue <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="(line71)"></a>-<a name="(line72)"></a> oneOf' <font color=Red>=</font> accum []-<a name="(line73)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line74)"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="(line75)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line76)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line77)"></a> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line78)"></a> Failure <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="(line79)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line80)"></a> <font color=Green><u>in</u></font> p ts-<a name="(line81)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="(line82)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="(line83)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line84)"></a>-<a name="(line85)"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line86)"></a>next <font color=Red>::</font> Parser t t-<a name="(line87)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line88)"></a> [] <font color=Red>-></font> Failure [] <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="(line89)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' t <font color=Cyan>)</font>-<a name="(line90)"></a>-<a name="(line91)"></a><a name="satisfy"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser t t-<a name="(line92)"></a>satisfy pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line93)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line94)"></a> <font color=Cyan>}</font>-<a name="(line95)"></a>-<a name="(line96)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line97)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line98)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line99)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line100)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line101)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line102)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser t ()-<a name="(line103)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="(line104)"></a>-<a name="(line105)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/State.html
@@ -1,126 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>NoLeak<font color=Cyan>.</font>State-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="(line3)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="(line4)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (Either String a, s, [t])</font>-<a name="(line5)"></a> <font color=Blue>-- ** basic parsers</font>-<a name="(line6)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="(line7)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="(line8)"></a> <font color=Blue>-- ** State-handling</font>-<a name="(line9)"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="(line10)"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="(line11)"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="(line12)"></a> <font color=Blue>-- ** re-parsing</font>-<a name="(line13)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="(line14)"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="(line15)"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line16)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line17)"></a>-<a name="(line18)"></a>-<a name="(line19)"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line20)"></a>-<a name="(line21)"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line22)"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="(line23)"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="(line24)"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="(line25)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> s a<font color=Cyan>)</font>-<a name="(line26)"></a>-<a name="(line27)"></a><a name="Result"></a><font color=Blue>-- A return type like Either, that distinguishes not only between</font>-<a name="(line28)"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="(line29)"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z s a <font color=Red>=</font> Success z s a-<a name="(line30)"></a> <font color=Red>|</font> Failure z s String-<a name="(line31)"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z s a<font color=Cyan>)</font>-<a name="(line32)"></a>-<a name="(line33)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z s<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line34)"></a> fmap f <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> Success z s <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="(line35)"></a> fmap f <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="(line36)"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="(line37)"></a>-<a name="(line38)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="(line39)"></a>runParser <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line40)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> <font color=Red>\</font>s<font color=Red>-></font> resultToEither <font color=Cyan>.</font> p s-<a name="(line41)"></a> <font color=Green><u>where</u></font>-<a name="(line42)"></a> resultToEither <font color=Red>::</font> Result z s a <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line43)"></a> resultToEither <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Right a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line44)"></a> resultToEither <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line45)"></a> resultToEither <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> resultToEither r-<a name="(line46)"></a>-<a name="(line47)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line48)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> fmap f <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line49)"></a>-<a name="(line50)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line51)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s x<font color=Cyan>)</font>-<a name="(line52)"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Failure ts s e<font color=Cyan>)</font>-<a name="(line53)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> f s<font color=Cyan>)</font>-<a name="(line54)"></a> <font color=Green><u>where</u></font>-<a name="(line55)"></a> continue <font color=Cyan>(</font>Success ts s x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' s ts-<a name="(line56)"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="(line57)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line58)"></a> continue <font color=Cyan>(</font>Failure ts s e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts s e-<a name="(line59)"></a>-<a name="(line60)"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line61)"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> Committed <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line62)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> adjust <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line63)"></a> <font color=Green><u>where</u></font>-<a name="(line64)"></a> adjust <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="(line65)"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="(line66)"></a> adjust good <font color=Red>=</font> good-<a name="(line67)"></a>-<a name="(line68)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> continue s ts <font color=Cyan>$</font> p s ts<font color=Cyan>)</font>-<a name="(line69)"></a> <font color=Green><u>where</u></font>-<a name="(line70)"></a> continue s ts <font color=Cyan>(</font>Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> q s ts-<a name="(line71)"></a> <font color=Blue>-- continue _ _ (Committed r) = r -- no, remain Committed</font>-<a name="(line72)"></a> continue <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="(line73)"></a>-<a name="(line74)"></a> oneOf' <font color=Red>=</font> accum []-<a name="(line75)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line76)"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="(line77)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line78)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line79)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line80)"></a> Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="(line81)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line82)"></a> <font color=Green><u>in</u></font> p s ts-<a name="(line83)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z <font color=Green><u>_</u></font> a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="(line84)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="(line85)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line86)"></a>-<a name="(line87)"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line88)"></a>next <font color=Red>::</font> Parser s t t-<a name="(line89)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line90)"></a> [] <font color=Red>-></font> Failure [] s <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="(line91)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' s t <font color=Cyan>)</font>-<a name="(line92)"></a>-<a name="(line93)"></a><a name="satisfy"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="(line94)"></a>satisfy pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line95)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line96)"></a> <font color=Cyan>}</font>-<a name="(line97)"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line98)"></a><font color=Blue>-- State handling</font>-<a name="(line99)"></a>-<a name="(line100)"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="(line101)"></a>stUpdate <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="(line102)"></a>stUpdate f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts <font color=Cyan>(</font>f s<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="(line103)"></a>-<a name="(line104)"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="(line105)"></a>stQuery <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line106)"></a>stQuery f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line107)"></a>-<a name="(line108)"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="(line109)"></a>stGet <font color=Red>::</font> Parser s t s-<a name="(line110)"></a>stGet <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s s<font color=Cyan>)</font>-<a name="(line111)"></a>-<a name="(line112)"></a>-<a name="(line113)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line114)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line115)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line116)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line117)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line118)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line119)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="(line120)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> s ()<font color=Cyan>)</font>-<a name="(line121)"></a>-<a name="(line122)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/NoLeak/StateLazy.html
@@ -1,176 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>NoLeak<font color=Cyan>.</font>StateLazy-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="(line3)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="(line4)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (Either String a, s, [t])</font>-<a name="(line5)"></a> <font color=Blue>-- ** basic parsers</font>-<a name="(line6)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="(line7)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="(line8)"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: Parser s t a -> Parser s t z -> Parser s t [a]</font>-<a name="(line9)"></a> <font color=Blue>-- ** State-handling</font>-<a name="(line10)"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="(line11)"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="(line12)"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="(line13)"></a> <font color=Blue>-- ** re-parsing</font>-<a name="(line14)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="(line15)"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="(line16)"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="(line17)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line18)"></a>-<a name="(line19)"></a>-<a name="(line20)"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base hiding <font color=Cyan>(</font>manyFinally<font color=Cyan>)</font>-<a name="(line21)"></a>-<a name="(line22)"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="(line23)"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="(line24)"></a><a name="throwE"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line25)"></a>throwE msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="(line26)"></a><font color=Magenta><em>#else</em></font>-<a name="(line27)"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line28)"></a>throwE msg <font color=Red>=</font> error msg-<a name="(line29)"></a><font color=Magenta><em>#endif</em></font>-<a name="(line30)"></a>-<a name="(line31)"></a>-<a name="(line32)"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line33)"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="(line34)"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="(line35)"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="(line36)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> s a<font color=Cyan>)</font>-<a name="(line37)"></a>-<a name="(line38)"></a><a name="Result"></a><font color=Blue>-- A return type like Either, that distinguishes not only between</font>-<a name="(line39)"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="(line40)"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z s a <font color=Red>=</font> Success z s a-<a name="(line41)"></a> <font color=Red>|</font> Failure z s String-<a name="(line42)"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z s a<font color=Cyan>)</font>-<a name="(line43)"></a>-<a name="(line44)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z s<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line45)"></a> fmap f <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> Success z s <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="(line46)"></a> fmap f <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="(line47)"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="(line48)"></a>-<a name="(line49)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="(line50)"></a>runParser <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line51)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> <font color=Red>\</font>s <font color=Red>-></font> fromResult <font color=Cyan>.</font> p s-<a name="(line52)"></a> <font color=Green><u>where</u></font>-<a name="(line53)"></a> fromResult <font color=Red>::</font> Result z s a <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line54)"></a> fromResult <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="(line55)"></a> fromResult <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> throwE e-<a name="(line56)"></a> fromResult <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> fromResult r-<a name="(line57)"></a>-<a name="(line58)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line59)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s <font color=Red>-></font> fmap f <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line60)"></a>-<a name="(line61)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line62)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s x<font color=Cyan>)</font>-<a name="(line63)"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Failure ts s e<font color=Cyan>)</font>-<a name="(line64)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> f s<font color=Cyan>)</font>-<a name="(line65)"></a> <font color=Green><u>where</u></font>-<a name="(line66)"></a> continue <font color=Cyan>(</font>Success ts s x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' s ts-<a name="(line67)"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="(line68)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line69)"></a> continue <font color=Cyan>(</font>Failure ts s e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts s e-<a name="(line70)"></a>-<a name="(line71)"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line72)"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> Committed <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line73)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> adjust <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="(line74)"></a> <font color=Green><u>where</u></font>-<a name="(line75)"></a> adjust <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="(line76)"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="(line77)"></a> adjust good <font color=Red>=</font> good-<a name="(line78)"></a>-<a name="(line79)"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> continue s ts <font color=Cyan>$</font> p s ts<font color=Cyan>)</font>-<a name="(line80)"></a> <font color=Green><u>where</u></font>-<a name="(line81)"></a> continue s ts <font color=Cyan>(</font>Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> q s ts-<a name="(line82)"></a> <font color=Blue>-- continue _ _ (Committed r) = r -- no, remain Committed</font>-<a name="(line83)"></a> continue <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="(line84)"></a>-<a name="(line85)"></a> oneOf' <font color=Red>=</font> accum []-<a name="(line86)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line87)"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="(line88)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line89)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line90)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line91)"></a> Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="(line92)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line93)"></a> <font color=Green><u>in</u></font> p s ts-<a name="(line94)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z <font color=Green><u>_</u></font> a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="(line95)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="(line96)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line97)"></a>-<a name="(line98)"></a> <font color=Blue>-- Apply a parsed function to a parsed value. This version</font>-<a name="(line99)"></a> <font color=Blue>-- is strict in the result of the function parser, but</font>-<a name="(line100)"></a> <font color=Blue>-- lazy in the result of the argument parser. (Argument laziness is</font>-<a name="(line101)"></a> <font color=Blue>-- the distinctive feature over other implementations.)</font>-<a name="(line102)"></a> <font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> px <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> pf s<font color=Cyan>)</font>-<a name="(line103)"></a> <font color=Green><u>where</u></font>-<a name="(line104)"></a> continue <font color=Cyan>(</font>Success z s f<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x<font color=Cyan>,</font>s'<font color=Cyan>,</font>z'<font color=Cyan>)</font> <font color=Red>=</font> runParser px s z-<a name="(line105)"></a> <font color=Green><u>in</u></font> Success z' s' <font color=Cyan>(</font>f x<font color=Cyan>)</font>-<a name="(line106)"></a> continue <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="(line107)"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="(line108)"></a>-<a name="(line109)"></a><a name="manyFinally"></a>manyFinally <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t z <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line110)"></a><font color=Blue>{--<a name="(line111)"></a>manyFinally pp@(P p) pt@(P t) = P (\s ts -> item s ts (p s ts))-<a name="(line112)"></a> where-<a name="(line113)"></a> item _ _ (Success ts s x) = success ts s x-<a name="(line114)"></a> item s ts (Failure _ _ e) = terminate (t s ts)-<a name="(line115)"></a> item s ts (Committed r) = Committed (within r)-<a name="(line116)"></a>-<a name="(line117)"></a> success ts s x =-<a name="(line118)"></a> let (tail,s',ts') = runParser (manyFinally pp pt) s ts-<a name="(line119)"></a> in Success ts' s' (x:tail)-<a name="(line120)"></a>-<a name="(line121)"></a> terminate (Success ts s _) = Success ts s []-<a name="(line122)"></a> terminate (Failure ts s e) = Failure ts s e-<a name="(line123)"></a> terminate (Committed r) = Committed (terminate r)-<a name="(line124)"></a>-<a name="(line125)"></a> within (Success ts s x) = success ts s x-<a name="(line126)"></a> within (Failure ts s e) = Failure ts s e-<a name="(line127)"></a> within (Committed r) = within r-<a name="(line128)"></a>-}</font>-<a name="(line129)"></a>-<a name="(line130)"></a>manyFinally p z <font color=Red>=</font>-<a name="(line131)"></a> <font color=Cyan>(</font><font color=Green><u>do</u></font> x <font color=Red><-</font> p<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> manyFinally p z<font color=Cyan>)</font>-<a name="(line132)"></a> <font color=Cyan>`onFail`</font>-<a name="(line133)"></a> <font color=Cyan>(</font><font color=Green><u>do</u></font> z<font color=Cyan>;</font> return []<font color=Cyan>)</font>-<a name="(line134)"></a> <font color=Cyan>`onFail`</font>-<a name="(line135)"></a> oneOf' <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"item in sequence"</font><font color=Cyan>,</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> p<font color=Cyan>;</font> return []<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line136)"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"sequence terminator"</font><font color=Cyan>,</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> z<font color=Cyan>;</font> return []<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>]</font>-<a name="(line137)"></a>-<a name="(line138)"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line139)"></a>next <font color=Red>::</font> Parser s t t-<a name="(line140)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line141)"></a> [] <font color=Red>-></font> Failure [] s <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="(line142)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' s t <font color=Cyan>)</font>-<a name="(line143)"></a>-<a name="(line144)"></a><a name="satisfy"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="(line145)"></a>satisfy pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line146)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line147)"></a> <font color=Cyan>}</font>-<a name="(line148)"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line149)"></a><font color=Blue>-- State handling</font>-<a name="(line150)"></a>-<a name="(line151)"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="(line152)"></a>stUpdate <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="(line153)"></a>stUpdate f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts <font color=Cyan>(</font>f s<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="(line154)"></a>-<a name="(line155)"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="(line156)"></a>stQuery <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line157)"></a>stQuery f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line158)"></a>-<a name="(line159)"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="(line160)"></a>stGet <font color=Red>::</font> Parser s t s-<a name="(line161)"></a>stGet <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s s<font color=Cyan>)</font>-<a name="(line162)"></a>-<a name="(line163)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line164)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line165)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line166)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line167)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line168)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line169)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="(line170)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> s ()<font color=Cyan>)</font>-<a name="(line171)"></a>-<a name="(line172)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/Plain.html
@@ -1,117 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly/Plain.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Plain-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="line-3"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="line-4"></a> <font color=Cyan>,</font> Result<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- internal to the Parser Monad.</font>-<a name="line-5"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser t a -> [t] -> (Either String a, [t])</font>-<a name="line-6"></a> <font color=Blue>-- ** basic parsers</font>-<a name="line-7"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser t t</font>-<a name="line-8"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser t t</font>-<a name="line-9"></a>-<a name="line-10"></a> <font color=Blue>-- ** re-parsing</font>-<a name="line-11"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser t ()</font>-<a name="line-12"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="line-13"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-14"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-15"></a>-<a name="line-16"></a>-<a name="line-17"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-18"></a>-<a name="line-19"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="line-20"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="line-21"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="line-22"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="line-23"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser t a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> a<font color=Cyan>)</font>-<a name="line-24"></a>-<a name="line-25"></a><a name="Result"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="line-26"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has commitment, so that a failure</font>-<a name="line-27"></a><a name="Result"></a><font color=Blue>-- cannot be undone. This should only be used for writing very primitive</font>-<a name="line-28"></a><a name="Result"></a><font color=Blue>-- parsers - really it is an internal detail of the library.</font>-<a name="line-29"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z a <font color=Red>=</font> Success z a-<a name="line-30"></a> <font color=Red>|</font> Failure z String-<a name="line-31"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z a<font color=Cyan>)</font>-<a name="line-32"></a>-<a name="line-33"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-34"></a> fmap f <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> Success z <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="line-35"></a> fmap f <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z e-<a name="line-36"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="line-37"></a>-<a name="line-38"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="line-39"></a><font color=Blue>runParser</font> <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-40"></a><font color=Blue>runParser</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> resultToEither <font color=Cyan>.</font> p-<a name="line-41"></a> <font color=Green><u>where</u></font>-<a name="line-42"></a> resultToEither <font color=Red>::</font> Result z a <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-43"></a> resultToEither <font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Right a<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-44"></a> resultToEither <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-45"></a> resultToEither <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> resultToEither r-<a name="line-46"></a>-<a name="line-47"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-48"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>fmap f <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-49"></a>-<a name="line-50"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-51"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Success ts x<font color=Cyan>)</font>-<a name="line-52"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> Failure ts e<font color=Cyan>)</font>-<a name="line-53"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font>continue <font color=Cyan>.</font> f<font color=Cyan>)</font>-<a name="line-54"></a> <font color=Green><u>where</u></font>-<a name="line-55"></a> continue <font color=Cyan>(</font>Success ts x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' ts-<a name="line-56"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="line-57"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-58"></a> continue <font color=Cyan>(</font>Failure ts e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts e-<a name="line-59"></a>-<a name="line-60"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-61"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font>Committed <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-62"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font>adjust <font color=Cyan>.</font> p<font color=Cyan>)</font>-<a name="line-63"></a> <font color=Green><u>where</u></font>-<a name="line-64"></a> adjust <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> Failure z <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="line-65"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="line-66"></a> adjust good <font color=Red>=</font> good-<a name="line-67"></a>-<a name="line-68"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> continue ts <font color=Cyan>$</font> p ts<font color=Cyan>)</font>-<a name="line-69"></a> <font color=Green><u>where</u></font>-<a name="line-70"></a> continue ts <font color=Cyan>(</font>Failure z e<font color=Cyan>)</font> <font color=Red>=</font> q ts-<a name="line-71"></a> <font color=Blue>-- continue _ (Committed r) = r -- no, remain Committed</font>-<a name="line-72"></a> continue <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="line-73"></a>-<a name="line-74"></a> oneOf' <font color=Red>=</font> accum []-<a name="line-75"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="line-76"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="line-77"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-78"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="line-79"></a> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="line-80"></a> Failure <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="line-81"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="line-82"></a> <font color=Green><u>in</u></font> p ts-<a name="line-83"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="line-84"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="line-85"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="line-86"></a>-<a name="line-87"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-88"></a><font color=Blue>next</font> <font color=Red>::</font> Parser t t-<a name="line-89"></a><font color=Blue>next</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="line-90"></a> [] <font color=Red>-></font> Failure [] <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="line-91"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' t <font color=Cyan>)</font>-<a name="line-92"></a>-<a name="line-93"></a><a name="satisfy"></a><font color=Blue>satisfy</font> <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser t t-<a name="line-94"></a><font color=Blue>satisfy</font> pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="line-95"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="line-96"></a> <font color=Cyan>}</font>-<a name="line-97"></a>-<a name="line-98"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-99"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="line-100"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="line-101"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="line-102"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="line-103"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="line-104"></a><font color=Blue>reparse</font> <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser t ()-<a name="line-105"></a><font color=Blue>reparse</font> ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="line-106"></a>-<a name="line-107"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/State.html
@@ -1,135 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly/State.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>State-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="line-3"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="line-4"></a> <font color=Cyan>,</font> Result<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- internal to the parser monad</font>-<a name="line-5"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (Either String a, s, [t])</font>-<a name="line-6"></a> <font color=Blue>-- ** basic parsers</font>-<a name="line-7"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="line-8"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="line-9"></a> <font color=Blue>-- ** State-handling</font>-<a name="line-10"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="line-11"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="line-12"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="line-13"></a> <font color=Blue>-- ** re-parsing</font>-<a name="line-14"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="line-15"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="line-16"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-17"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-18"></a>-<a name="line-19"></a>-<a name="line-20"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-21"></a>-<a name="line-22"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="line-23"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="line-24"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="line-25"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="line-26"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> s a<font color=Cyan>)</font>-<a name="line-27"></a>-<a name="line-28"></a><a name="Result"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="line-29"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="line-30"></a><a name="Result"></a><font color=Blue>-- This should only be used for writing very primitive</font>-<a name="line-31"></a><a name="Result"></a><font color=Blue>-- parsers - really it is an internal detail of the library.</font>-<a name="line-32"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z s a <font color=Red>=</font> Success z s a-<a name="line-33"></a> <font color=Red>|</font> Failure z s String-<a name="line-34"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z s a<font color=Cyan>)</font>-<a name="line-35"></a>-<a name="line-36"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z s<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-37"></a> fmap f <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> Success z s <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="line-38"></a> fmap f <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="line-39"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="line-40"></a>-<a name="line-41"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="line-42"></a><font color=Blue>runParser</font> <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-43"></a><font color=Blue>runParser</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> <font color=Red>\</font>s<font color=Red>-></font> resultToEither <font color=Cyan>.</font> p s-<a name="line-44"></a> <font color=Green><u>where</u></font>-<a name="line-45"></a> resultToEither <font color=Red>::</font> Result z s a <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-46"></a> resultToEither <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Right a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-47"></a> resultToEither <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-48"></a> resultToEither <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> resultToEither r-<a name="line-49"></a>-<a name="line-50"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-51"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> fmap f <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-52"></a>-<a name="line-53"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-54"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s x<font color=Cyan>)</font>-<a name="line-55"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Failure ts s e<font color=Cyan>)</font>-<a name="line-56"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> f s<font color=Cyan>)</font>-<a name="line-57"></a> <font color=Green><u>where</u></font>-<a name="line-58"></a> continue <font color=Cyan>(</font>Success ts s x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' s ts-<a name="line-59"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="line-60"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-61"></a> continue <font color=Cyan>(</font>Failure ts s e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts s e-<a name="line-62"></a>-<a name="line-63"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-64"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> Committed <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-65"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> adjust <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-66"></a> <font color=Green><u>where</u></font>-<a name="line-67"></a> adjust <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="line-68"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="line-69"></a> adjust good <font color=Red>=</font> good-<a name="line-70"></a>-<a name="line-71"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> continue s ts <font color=Cyan>$</font> p s ts<font color=Cyan>)</font>-<a name="line-72"></a> <font color=Green><u>where</u></font>-<a name="line-73"></a> continue s ts <font color=Cyan>(</font>Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> q s ts-<a name="line-74"></a> <font color=Blue>-- continue _ _ (Committed r) = r -- no, remain Committed</font>-<a name="line-75"></a> continue <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="line-76"></a>-<a name="line-77"></a> oneOf' <font color=Red>=</font> accum []-<a name="line-78"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="line-79"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="line-80"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-81"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="line-82"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="line-83"></a> Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="line-84"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="line-85"></a> <font color=Green><u>in</u></font> p s ts-<a name="line-86"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z <font color=Green><u>_</u></font> a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="line-87"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="line-88"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="line-89"></a>-<a name="line-90"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-91"></a><font color=Blue>next</font> <font color=Red>::</font> Parser s t t-<a name="line-92"></a><font color=Blue>next</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="line-93"></a> [] <font color=Red>-></font> Failure [] s <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="line-94"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' s t <font color=Cyan>)</font>-<a name="line-95"></a>-<a name="line-96"></a><a name="satisfy"></a><font color=Blue>satisfy</font> <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="line-97"></a><font color=Blue>satisfy</font> pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="line-98"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="line-99"></a> <font color=Cyan>}</font>-<a name="line-100"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-101"></a><font color=Blue>-- State handling</font>-<a name="line-102"></a>-<a name="line-103"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="line-104"></a><font color=Blue>stUpdate</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="line-105"></a><font color=Blue>stUpdate</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts <font color=Cyan>(</font>f s<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="line-106"></a>-<a name="line-107"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="line-108"></a><font color=Blue>stQuery</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="line-109"></a><font color=Blue>stQuery</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-110"></a>-<a name="line-111"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="line-112"></a><font color=Blue>stGet</font> <font color=Red>::</font> Parser s t s-<a name="line-113"></a><font color=Blue>stGet</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s s<font color=Cyan>)</font>-<a name="line-114"></a>-<a name="line-115"></a>-<a name="line-116"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-117"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="line-118"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="line-119"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="line-120"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="line-121"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="line-122"></a><font color=Blue>reparse</font> <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="line-123"></a><font color=Blue>reparse</font> ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> s ()<font color=Cyan>)</font>-<a name="line-124"></a>-<a name="line-125"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/Poly/StateLazy.html
@@ -1,185 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<head>-<!-- Generated by HsColour, http://www.cs.york.ac.uk/fp/darcs/hscolour/ -->-<title>src/Text/ParserCombinators/Poly/StateLazy.hs</title>-</head>-<body>-<pre><a name="line-1"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>StateLazy-<a name="line-2"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="line-3"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad, PolyParse</font>-<a name="line-4"></a> <font color=Cyan>,</font> Result<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Blue>-- internal to the parser monad</font>-<a name="line-5"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (Either String a, s, [t])</font>-<a name="line-6"></a> <font color=Blue>-- ** basic parsers</font>-<a name="line-7"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="line-8"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="line-9"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: Parser s t a -> Parser s t z -> Parser s t [a]</font>-<a name="line-10"></a> <font color=Blue>-- ** State-handling</font>-<a name="line-11"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="line-12"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="line-13"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="line-14"></a> <font color=Blue>-- ** re-parsing</font>-<a name="line-15"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="line-16"></a> <font color=Blue>-- * Re-export all more general combinators</font>-<a name="line-17"></a> <font color=Cyan>,</font> <font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base-<a name="line-18"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-19"></a>-<a name="line-20"></a>-<a name="line-21"></a><font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>Poly<font color=Cyan>.</font>Base hiding <font color=Cyan>(</font>manyFinally<font color=Cyan>)</font>-<a name="line-22"></a>-<a name="line-23"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="line-24"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="line-25"></a><a name="throwE"></a><font color=Blue>throwE</font> <font color=Red>::</font> String <font color=Red>-></font> a-<a name="line-26"></a><font color=Blue>throwE</font> msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="line-27"></a><font color=Magenta><em>#else</em></font>-<a name="line-28"></a><font color=Blue>throwE</font> <font color=Red>::</font> String <font color=Red>-></font> a-<a name="line-29"></a><font color=Blue>throwE</font> msg <font color=Red>=</font> error msg-<a name="line-30"></a><font color=Magenta><em>#endif</em></font>-<a name="line-31"></a>-<a name="line-32"></a>-<a name="line-33"></a><a name="Parser"></a><font color=Blue>-- | This @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="line-34"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="line-35"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyState</font>-<a name="line-36"></a><a name="Parser"></a><font color=Blue>-- instead)</font>-<a name="line-37"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Result <font color=Red>[</font>t<font color=Red>]</font> s a<font color=Cyan>)</font>-<a name="line-38"></a>-<a name="line-39"></a><a name="Result"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="line-40"></a><a name="Result"></a><font color=Blue>-- right and wrong answers, but also has gradations of wrongness.</font>-<a name="line-41"></a><a name="Result"></a><font color=Blue>-- This should only be used for writing very primitive</font>-<a name="line-42"></a><a name="Result"></a><font color=Blue>-- parsers - really it is an internal detail of the library.</font>-<a name="line-43"></a><a name="Result"></a><font color=Green><u>data</u></font> Result z s a <font color=Red>=</font> Success z s a-<a name="line-44"></a> <font color=Red>|</font> Failure z s String-<a name="line-45"></a> <font color=Red>|</font> Committed <font color=Cyan>(</font>Result z s a<font color=Cyan>)</font>-<a name="line-46"></a>-<a name="line-47"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Result z s<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-48"></a> fmap f <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> Success z s <font color=Cyan>(</font>f a<font color=Cyan>)</font>-<a name="line-49"></a> fmap f <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="line-50"></a> fmap f <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>fmap f r<font color=Cyan>)</font>-<a name="line-51"></a>-<a name="line-52"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence.</font>-<a name="line-53"></a><font color=Blue>runParser</font> <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="line-54"></a><font color=Blue>runParser</font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> <font color=Red>\</font>s <font color=Red>-></font> fromResult <font color=Cyan>.</font> p s-<a name="line-55"></a> <font color=Green><u>where</u></font>-<a name="line-56"></a> fromResult <font color=Red>::</font> Result z s a <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-57"></a> fromResult <font color=Cyan>(</font>Success z s a<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> z<font color=Cyan>)</font>-<a name="line-58"></a> fromResult <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> throwE e-<a name="line-59"></a> fromResult <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> fromResult r-<a name="line-60"></a>-<a name="line-61"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-62"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s <font color=Red>-></font> fmap f <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-63"></a>-<a name="line-64"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-65"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s x<font color=Cyan>)</font>-<a name="line-66"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Failure ts s e<font color=Cyan>)</font>-<a name="line-67"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> f s<font color=Cyan>)</font>-<a name="line-68"></a> <font color=Green><u>where</u></font>-<a name="line-69"></a> continue <font color=Cyan>(</font>Success ts s x<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' s ts-<a name="line-70"></a> continue <font color=Cyan>(</font>Committed <font color=Cyan>(</font>Committed r<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font>-<a name="line-71"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-72"></a> continue <font color=Cyan>(</font>Failure ts s e<font color=Cyan>)</font> <font color=Red>=</font> Failure ts s e-<a name="line-73"></a>-<a name="line-74"></a><font color=Green><u>instance</u></font> PolyParse <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="line-75"></a> commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> Committed <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-76"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> adjust <font color=Cyan>.</font> p s<font color=Cyan>)</font>-<a name="line-77"></a> <font color=Green><u>where</u></font>-<a name="line-78"></a> adjust <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s <font color=Cyan>(</font>f e<font color=Cyan>)</font>-<a name="line-79"></a> adjust <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>adjust r<font color=Cyan>)</font>-<a name="line-80"></a> adjust good <font color=Red>=</font> good-<a name="line-81"></a>-<a name="line-82"></a> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> continue s ts <font color=Cyan>$</font> p s ts<font color=Cyan>)</font>-<a name="line-83"></a> <font color=Green><u>where</u></font>-<a name="line-84"></a> continue s ts <font color=Cyan>(</font>Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> q s ts-<a name="line-85"></a> <font color=Blue>-- continue _ _ (Committed r) = r -- no, remain Committed</font>-<a name="line-86"></a> continue <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> r <font color=Red>=</font> r-<a name="line-87"></a>-<a name="line-88"></a> oneOf' <font color=Red>=</font> accum []-<a name="line-89"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="line-90"></a> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="line-91"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-92"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="line-93"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="line-94"></a> Failure <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> err <font color=Red>-></font>-<a name="line-95"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="line-96"></a> <font color=Green><u>in</u></font> p s ts-<a name="line-97"></a> r<font color=Red>@</font><font color=Cyan>(</font>Success z <font color=Green><u>_</u></font> a<font color=Cyan>)</font> <font color=Red>-></font> r-<a name="line-98"></a> r<font color=Red>@</font><font color=Cyan>(</font>Committed <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r <font color=Cyan>)</font>-<a name="line-99"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="line-100"></a>-<a name="line-101"></a> <font color=Blue>-- Apply a parsed function to a parsed value. This version</font>-<a name="line-102"></a> <font color=Blue>-- is strict in the result of the function parser, but</font>-<a name="line-103"></a> <font color=Blue>-- lazy in the result of the argument parser. (Argument laziness is</font>-<a name="line-104"></a> <font color=Blue>-- the distinctive feature over other implementations.)</font>-<a name="line-105"></a> <font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> px <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s<font color=Red>-></font> continue <font color=Cyan>.</font> pf s<font color=Cyan>)</font>-<a name="line-106"></a> <font color=Green><u>where</u></font>-<a name="line-107"></a> continue <font color=Cyan>(</font>Success z s f<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x<font color=Cyan>,</font>s'<font color=Cyan>,</font>z'<font color=Cyan>)</font> <font color=Red>=</font> runParser px s z-<a name="line-108"></a> <font color=Green><u>in</u></font> Success z' s' <font color=Cyan>(</font>f x<font color=Cyan>)</font>-<a name="line-109"></a> continue <font color=Cyan>(</font>Failure z s e<font color=Cyan>)</font> <font color=Red>=</font> Failure z s e-<a name="line-110"></a> continue <font color=Cyan>(</font>Committed r<font color=Cyan>)</font> <font color=Red>=</font> Committed <font color=Cyan>(</font>continue r<font color=Cyan>)</font>-<a name="line-111"></a>-<a name="line-112"></a><a name="manyFinally"></a><font color=Blue>manyFinally</font> <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t z <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="line-113"></a><font color=Blue>{--<a name="line-114"></a>manyFinally pp@(P p) pt@(P t) = P (\s ts -> item s ts (p s ts))-<a name="line-115"></a> where-<a name="line-116"></a> item _ _ (Success ts s x) = success ts s x-<a name="line-117"></a> item s ts (Failure _ _ e) = terminate (t s ts)-<a name="line-118"></a> item s ts (Committed r) = Committed (within r)-<a name="line-119"></a>-<a name="line-120"></a> success ts s x =-<a name="line-121"></a> let (tail,s',ts') = runParser (manyFinally pp pt) s ts-<a name="line-122"></a> in Success ts' s' (x:tail)-<a name="line-123"></a>-<a name="line-124"></a> terminate (Success ts s _) = Success ts s []-<a name="line-125"></a> terminate (Failure ts s e) = Failure ts s e-<a name="line-126"></a> terminate (Committed r) = Committed (terminate r)-<a name="line-127"></a>-<a name="line-128"></a> within (Success ts s x) = success ts s x-<a name="line-129"></a> within (Failure ts s e) = Failure ts s e-<a name="line-130"></a> within (Committed r) = within r-<a name="line-131"></a>-}</font>-<a name="line-132"></a>-<a name="line-133"></a><font color=Blue>manyFinally</font> p z <font color=Red>=</font>-<a name="line-134"></a> <font color=Cyan>(</font><font color=Green><u>do</u></font> x <font color=Red><-</font> p<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> manyFinally p z<font color=Cyan>)</font>-<a name="line-135"></a> <font color=Cyan>`onFail`</font>-<a name="line-136"></a> <font color=Cyan>(</font><font color=Green><u>do</u></font> z<font color=Cyan>;</font> return []<font color=Cyan>)</font>-<a name="line-137"></a> <font color=Cyan>`onFail`</font>-<a name="line-138"></a> oneOf' <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"item in sequence"</font><font color=Cyan>,</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> p<font color=Cyan>;</font> return []<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-139"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"sequence terminator"</font><font color=Cyan>,</font> <font color=Cyan>(</font><font color=Green><u>do</u></font> z<font color=Cyan>;</font> return []<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>]</font>-<a name="line-140"></a>-<a name="line-141"></a><a name="next"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-142"></a><font color=Blue>next</font> <font color=Red>::</font> Parser s t t-<a name="line-143"></a><font color=Blue>next</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="line-144"></a> [] <font color=Red>-></font> Failure [] s <font color=Magenta>"Ran out of input (EOF)"</font>-<a name="line-145"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> Success ts' s t <font color=Cyan>)</font>-<a name="line-146"></a>-<a name="line-147"></a><a name="satisfy"></a><font color=Blue>satisfy</font> <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="line-148"></a><font color=Blue>satisfy</font> pred <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="line-149"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> pred x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="line-150"></a> <font color=Cyan>}</font>-<a name="line-151"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-152"></a><font color=Blue>-- State handling</font>-<a name="line-153"></a>-<a name="line-154"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="line-155"></a><font color=Blue>stUpdate</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="line-156"></a><font color=Blue>stUpdate</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts <font color=Cyan>(</font>f s<font color=Cyan>)</font> ()<font color=Cyan>)</font>-<a name="line-157"></a>-<a name="line-158"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="line-159"></a><font color=Blue>stQuery</font> <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="line-160"></a><font color=Blue>stQuery</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="line-161"></a>-<a name="line-162"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="line-163"></a><font color=Blue>stGet</font> <font color=Red>::</font> Parser s t s-<a name="line-164"></a><font color=Blue>stGet</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> Success ts s s<font color=Cyan>)</font>-<a name="line-165"></a>-<a name="line-166"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="line-167"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="line-168"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="line-169"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="line-170"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="line-171"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="line-172"></a><font color=Blue>reparse</font> <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="line-173"></a><font color=Blue>reparse</font> ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> Success <font color=Cyan>(</font>ts<font color=Cyan>++</font>inp<font color=Cyan>)</font> s ()<font color=Cyan>)</font>-<a name="line-174"></a>-<a name="line-175"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</body>-</html>
− docs/haddock/src/Text/ParserCombinators/PolyLazy.html
@@ -1,279 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>PolyLazy-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype.</font>-<a name="(line3)"></a> <font color=Blue>-- $parser</font>-<a name="(line4)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad</font>-<a name="(line5)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser t a -> [t] -> (a, [t])</font>-<a name="(line6)"></a> <font color=Cyan>,</font> failBad <font color=Blue>-- :: String -> Parser t a</font>-<a name="(line7)"></a> <font color=Cyan>,</font> commit <font color=Blue>-- :: Parser t a -> Parser t a</font>-<a name="(line8)"></a> <font color=Blue>-- * Combinators:</font>-<a name="(line9)"></a> <font color=Blue>-- ** Primitives</font>-<a name="(line10)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser t t</font>-<a name="(line11)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser t t</font>-<a name="(line12)"></a> <font color=Cyan>,</font> apply <font color=Blue>-- :: Parser t (a->b) -> Parser t a -> Parser t b</font>-<a name="(line13)"></a> <font color=Cyan>,</font> discard <font color=Blue>-- :: Parser t a -> Parser t b -> Parser t a</font>-<a name="(line14)"></a> <font color=Blue>-- ** Error-handling</font>-<a name="(line15)"></a> <font color=Cyan>,</font> adjustErr <font color=Blue>-- :: Parser t a -> (String->String) -> Parser t a</font>-<a name="(line16)"></a> <font color=Cyan>,</font> adjustErrBad<font color=Blue>-- :: Parser t a -> (String->String) -> Parser t a</font>-<a name="(line17)"></a> <font color=Cyan>,</font> indent <font color=Blue>-- :: Int -> String -> String</font>-<a name="(line18)"></a> <font color=Blue>-- ** Choices</font>-<a name="(line19)"></a> <font color=Cyan>,</font> onFail <font color=Blue>-- :: Parser t a -> Parser t a -> Parser t a</font>-<a name="(line20)"></a> <font color=Cyan>,</font> oneOf <font color=Blue>-- :: Show t => [Parser t a] -> Parser t a</font>-<a name="(line21)"></a> <font color=Cyan>,</font> oneOf' <font color=Blue>-- :: [(String,Parser t a)] -> Parser t a</font>-<a name="(line22)"></a> <font color=Cyan>,</font> optional <font color=Blue>-- :: Parser t a -> Parser t (Maybe a)</font>-<a name="(line23)"></a> <font color=Blue>-- ** Sequences</font>-<a name="(line24)"></a> <font color=Cyan>,</font> exactly <font color=Blue>-- :: Int -> Parser t a -> Parser t [a]</font>-<a name="(line25)"></a> <font color=Cyan>,</font> many <font color=Blue>-- :: Parser t a -> Parser t [a]</font>-<a name="(line26)"></a> <font color=Cyan>,</font> many1 <font color=Blue>-- :: Parser t a -> Parser t [a]</font>-<a name="(line27)"></a> <font color=Cyan>,</font> sepBy <font color=Blue>-- :: Parser t a -> Parser t sep -> Parser t [a]</font>-<a name="(line28)"></a> <font color=Cyan>,</font> sepBy1 <font color=Blue>-- :: Parser t a -> Parser t sep -> Parser t [a]</font>-<a name="(line29)"></a> <font color=Cyan>,</font> bracketSep <font color=Blue>-- :: Parser t bra -> Parser t sep -> Parser t ket</font>-<a name="(line30)"></a> <font color=Blue>-- -> Parser t a -> Parser t [a]</font>-<a name="(line31)"></a> <font color=Cyan>,</font> bracket <font color=Blue>-- :: Parser t bra -> Parser t ket -> Parser t a</font>-<a name="(line32)"></a> <font color=Blue>-- -> Parser t a</font>-<a name="(line33)"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: Parser t a -> Parser t z -> Parser t [a]</font>-<a name="(line34)"></a> <font color=Blue>-- ** Re-parsing</font>-<a name="(line35)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser t ()</font>-<a name="(line36)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line37)"></a>-<a name="(line38)"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="(line39)"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="(line40)"></a><a name="throwE"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line41)"></a>throwE msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="(line42)"></a><font color=Magenta><em>#else</em></font>-<a name="(line43)"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line44)"></a>throwE msg <font color=Red>=</font> error msg-<a name="(line45)"></a><font color=Magenta><em>#endif</em></font>-<a name="(line46)"></a>-<a name="(line47)"></a><font color=Blue>-- $parser</font>-<a name="(line48)"></a><font color=Blue>-- When applied, these parsers do not return explicit failure.</font>-<a name="(line49)"></a><font color=Blue>-- An exception is</font>-<a name="(line50)"></a><font color=Blue>-- raised instead. This allows partial results to be returned</font>-<a name="(line51)"></a><font color=Blue>-- before a full parse is complete.</font>-<a name="(line52)"></a><font color=Blue>-- One of the key ways to ensure that your parser is properly lazy,</font>-<a name="(line53)"></a><font color=Blue>-- is to parse the initial portion of text returning a function, then</font>-<a name="(line54)"></a><font color=Blue>-- use the @apply@ combinator to build the final value.</font>-<a name="(line55)"></a>-<a name="(line56)"></a><a name="Parser"></a><font color=Blue>-- | The @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line57)"></a><a name="Parser"></a><font color=Blue>-- reporting. It can be used for arbitrary token types, not just</font>-<a name="(line58)"></a><a name="Parser"></a><font color=Blue>-- String input. (If you require a running state, use module PolyStateLazy</font>-<a name="(line59)"></a><a name="Parser"></a><font color=Blue>-- instead.)</font>-<a name="(line60)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser t a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line61)"></a>-<a name="(line62)"></a><a name="EitherE"></a><font color=Blue>-- A return type like Either, that distinguishes not only between</font>-<a name="(line63)"></a><a name="EitherE"></a><font color=Blue>-- right and wrong answers, but also had gradations of wrongness.</font>-<a name="(line64)"></a><a name="EitherE"></a><font color=Blue>-- Not used in this library. !!!!!!!!!!!!!!!!!!!!!!!!!!!</font>-<a name="(line65)"></a><a name="EitherE"></a><font color=Green><u>type</u></font> EitherE a b <font color=Red>=</font> Either <font color=Cyan>(</font>Bool<font color=Cyan>,</font>a<font color=Cyan>)</font> b-<a name="(line66)"></a>-<a name="(line67)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an input token sequence. The parser cannot return</font>-<a name="(line68)"></a><font color=Blue>-- an error value explicitly, so errors raise an exception. Thus, results</font>-<a name="(line69)"></a><font color=Blue>-- can be partial (lazily constructed, but containing undefined).</font>-<a name="(line70)"></a>runParser <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line71)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line72)"></a> <font color=Cyan>(</font><font color=Red>\</font> <font color=Cyan>(</font>e<font color=Cyan>,</font>ts<font color=Cyan>)</font><font color=Red>-></font> <font color=Cyan>(</font><font color=Green><u>case</u></font> e <font color=Green><u>of</u></font> <font color=Cyan>{</font>Left m<font color=Red>-></font>throwE m<font color=Cyan>;</font> Right x<font color=Red>-></font>x<font color=Cyan>}</font><font color=Cyan>,</font> ts<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line73)"></a> <font color=Cyan>.</font> p-<a name="(line74)"></a>-<a name="(line75)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line76)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line77)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line78)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f x<font color=Cyan>)</font><font color=Cyan>,</font> ts'<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line79)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line80)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line81)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> f ts <font color=Green><u>of</u></font>-<a name="(line82)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line83)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x <font color=Green><u>in</u></font> g' ts'<font color=Cyan>)</font>-<a name="(line84)"></a> fail e <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line85)"></a>-<a name="(line86)"></a><font color=Blue>-- | Simple failure can be corrected, but when a simple fail is not strong</font>-<a name="(line87)"></a><font color=Blue>-- enough, use failBad for emphasis. It guarantees parsing will</font>-<a name="(line88)"></a><font color=Blue>-- terminate with an exception.</font>-<a name="(line89)"></a>-<a name="(line90)"></a><a name="failBad"></a>failBad <font color=Red>::</font> String <font color=Red>-></font> Parser t a-<a name="(line91)"></a>failBad msg <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Cyan>(</font>throwE msg<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line92)"></a>-<a name="(line93)"></a><a name="commit"></a><font color=Blue>-- | Commit is a way of raising the severity of any errors found within</font>-<a name="(line94)"></a><font color=Blue>-- its argument. Used in the middle of a parser definition, it means that</font>-<a name="(line95)"></a><font color=Blue>-- any operations prior to commitment fail softly, but after commitment,</font>-<a name="(line96)"></a><font color=Blue>-- they fail hard.</font>-<a name="(line97)"></a>commit <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t a-<a name="(line98)"></a>commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line99)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>throwE e<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line100)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line101)"></a>-<a name="(line102)"></a>-<a name="(line103)"></a><font color=Blue>-- Combinators</font>-<a name="(line104)"></a>-<a name="(line105)"></a><a name="next"></a><font color=Blue>-- | One token</font>-<a name="(line106)"></a>next <font color=Red>::</font> Parser t t-<a name="(line107)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line108)"></a> [] <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Magenta>"Ran out of input (EOF)"</font><font color=Cyan>,</font> []<font color=Cyan>)</font>-<a name="(line109)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right t<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line110)"></a>-<a name="(line111)"></a><a name="satisfy"></a><font color=Blue>-- | One token satifying a predicate</font>-<a name="(line112)"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser t t-<a name="(line113)"></a>satisfy p <font color=Red>=</font> <font color=Green><u>do</u></font><font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line114)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line115)"></a> <font color=Cyan>}</font>-<a name="(line116)"></a>-<a name="(line117)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`apply`</font>-<a name="(line118)"></a><a name="apply"></a><font color=Blue>-- | Apply a parsed function to a parsed value</font>-<a name="(line119)"></a>apply <font color=Red>::</font> Parser t <font color=Cyan>(</font>a<font color=Red>-></font>b<font color=Cyan>)</font> <font color=Red>-></font> Parser t a <font color=Red>-></font> Parser t b-<a name="(line120)"></a><a name="apply"></a><font color=Blue>--pf `apply` px = do { f <- pf; x <- px; return (f x) }</font>-<a name="(line121)"></a><a name="apply"></a><font color=Blue>-- Needs to be lazier! Must not force the argument value too early. </font>-<a name="(line122)"></a><a name="apply"></a><font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> <font color=Cyan>(</font>P px<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font>-<a name="(line123)"></a> <font color=Green><u>case</u></font> pf ts <font color=Green><u>of</u></font>-<a name="(line124)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line125)"></a> <font color=Cyan>(</font>Right f<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x'<font color=Cyan>,</font>ts''<font color=Cyan>)</font> <font color=Red>=</font> px ts'-<a name="(line126)"></a> x <font color=Red>=</font> <font color=Green><u>case</u></font> x' <font color=Green><u>of</u></font> <font color=Cyan>{</font> Right x <font color=Red>-></font> x<font color=Cyan>;</font> Left e <font color=Red>-></font> throwE e <font color=Cyan>}</font>-<a name="(line127)"></a> <font color=Green><u>in</u></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f x<font color=Cyan>)</font><font color=Cyan>,</font> ts''<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line128)"></a>-<a name="(line129)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`discard`</font>-<a name="(line130)"></a><a name="discard"></a><font color=Blue>-- | @x `discard` y@ parses both x and y, but discards the result of y</font>-<a name="(line131)"></a>discard <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t b <font color=Red>-></font> Parser t a-<a name="(line132)"></a><a name="discard"></a><font color=Blue>--px `discard` py = do { x <- px; _ <- py; return x }</font>-<a name="(line133)"></a><a name="discard"></a><font color=Blue>-- Needs to be lazier! Do not force the discarded portion too early.</font>-<a name="(line134)"></a><a name="discard"></a>px <font color=Cyan>`discard`</font> py <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> px<font color=Cyan>;</font> return <font color=Cyan>(</font><font color=Red>\</font><font color=Green><u>_</u></font><font color=Red>-></font> x<font color=Cyan>)</font> <font color=Cyan>`apply`</font> py <font color=Cyan>}</font>-<a name="(line135)"></a>-<a name="(line136)"></a><a name="adjustErr"></a><font color=Blue>-- | @p `adjustErr` f@ applies the transformation @f@ to any error message</font>-<a name="(line137)"></a><font color=Blue>-- generated in @p@, having no effect if @p@ succeeds.</font>-<a name="(line138)"></a>adjustErr <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser t a-<a name="(line139)"></a><a name="adjustErr"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line140)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>f msg<font color=Cyan>)</font><font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line141)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line142)"></a>-<a name="(line143)"></a><a name="adjustErrBad"></a><font color=Blue>-- | @adjustErrBad@ is just like @adjustErr@ except it also raises the</font>-<a name="(line144)"></a><font color=Blue>-- severity of the error.</font>-<a name="(line145)"></a>adjustErrBad <font color=Red>::</font> Parser t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser t a-<a name="(line146)"></a><a name="adjustErrBad"></a>p <font color=Cyan>`adjustErrBad`</font> f <font color=Red>=</font> commit <font color=Cyan>(</font>p <font color=Cyan>`adjustErr`</font> f<font color=Cyan>)</font>-<a name="(line147)"></a>-<a name="(line148)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>6</font> <font color=Cyan>`onFail`</font> <font color=Blue>-- not sure about precedence 6?</font>-<a name="(line149)"></a><a name="onFail"></a><font color=Blue>-- | @p `onFail` q@ means parse p unless p fails in which case parse q instead.</font>-<a name="(line150)"></a><font color=Blue>-- Can be chained together to give multiple attempts to parse something.</font>-<a name="(line151)"></a><font color=Blue>-- (Note that q could itself be a failing parser, e.g. to change the error</font>-<a name="(line152)"></a><font color=Blue>-- message from that defined in p to something different.)</font>-<a name="(line153)"></a><font color=Blue>-- However, a *severe* failure in p cannot be ignored.</font>-<a name="(line154)"></a>onFail <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t a <font color=Red>-></font> Parser t a-<a name="(line155)"></a><a name="onFail"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line156)"></a> <font color=Cyan>(</font>Left <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> q ts-<a name="(line157)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line158)"></a>-<a name="(line159)"></a><a name="oneOf"></a><font color=Blue>-- | Parse the first alternative in the list that succeeds.</font>-<a name="(line160)"></a>oneOf <font color=Red>::</font> <font color=Red>[</font>Parser t a<font color=Red>]</font> <font color=Red>-></font> Parser t a-<a name="(line161)"></a>oneOf [] <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> n <font color=Red><-</font> next-<a name="(line162)"></a> <font color=Cyan>;</font> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices"</font><font color=Cyan>)</font>-<a name="(line163)"></a> <font color=Cyan>}</font>-<a name="(line164)"></a><font color=Blue>--oneOf :: Show t => [Parser t a] -> Parser t a</font>-<a name="(line165)"></a><font color=Blue>--oneOf [] = do { n <- next</font>-<a name="(line166)"></a><font color=Blue>-- ; fail ("failed to parse any of the possible choices"</font>-<a name="(line167)"></a><font color=Blue>-- ++"\n next token is "++show n)</font>-<a name="(line168)"></a><font color=Blue>-- }</font>-<a name="(line169)"></a>oneOf <font color=Cyan>(</font>p<font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font> p <font color=Cyan>`onFail`</font> oneOf ps-<a name="(line170)"></a>-<a name="(line171)"></a><a name="oneOf'"></a><font color=Blue>-- | Parse the first alternative that succeeds, but if none succeed,</font>-<a name="(line172)"></a><font color=Blue>-- report only the severe errors, and if none of those, then report</font>-<a name="(line173)"></a><font color=Blue>-- all the soft errors.</font>-<a name="(line174)"></a>oneOf' <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font> Parser t a<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser t a-<a name="(line175)"></a>oneOf' ps <font color=Red>=</font> accum [] ps-<a name="(line176)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line177)"></a> <font color=Green><u>case</u></font> errs <font color=Green><u>of</u></font>-<a name="(line178)"></a> [] <font color=Red>-></font> failBad <font color=Cyan>(</font><font color=Magenta>"internal failure in parser (oneOf'):\n"</font>-<a name="(line179)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>show <font color=Cyan>(</font>map fst ps<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line180)"></a> <font color=Red>[</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>e<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> fail e-<a name="(line181)"></a> es <font color=Red>-></font> fail <font color=Cyan>(</font><font color=Magenta>"one of the following failures occurred:\n"</font>-<a name="(line182)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse es<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line183)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line184)"></a> P <font color=Cyan>(</font><font color=Red>\</font>ts<font color=Red>-></font> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line185)"></a> <font color=Cyan>(</font>Left err<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line186)"></a> <font color=Green><u>in</u></font> p ts-<a name="(line187)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line188)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line189)"></a>-<a name="(line190)"></a><a name="indent"></a><font color=Blue>-- | Helper for formatting error messages: indents all lines by a fixed amount.</font>-<a name="(line191)"></a>indent <font color=Red>::</font> Int <font color=Red>-></font> String <font color=Red>-></font> String-<a name="(line192)"></a>indent n <font color=Red>=</font> unlines <font color=Cyan>.</font> map <font color=Cyan>(</font>replicate n <font color=Magenta>' '</font> <font color=Cyan>++</font><font color=Cyan>)</font> <font color=Cyan>.</font> lines-<a name="(line193)"></a>-<a name="(line194)"></a><a name="optional"></a><font color=Blue>-- | 'optional' indicates whether the parser succeeded through the Maybe type.</font>-<a name="(line195)"></a>optional <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t <font color=Cyan>(</font>Maybe a<font color=Cyan>)</font>-<a name="(line196)"></a>optional p <font color=Red>=</font> fmap Just p <font color=Cyan>`onFail`</font> return Nothing-<a name="(line197)"></a>-<a name="(line198)"></a><a name="exactly"></a><font color=Blue>-- | 'exactly n p' parses a precise number of items, n, using the parser</font>-<a name="(line199)"></a><font color=Blue>-- p, in sequence.</font>-<a name="(line200)"></a>exactly <font color=Red>::</font> Int <font color=Red>-></font> Parser t a <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line201)"></a>exactly <font color=Magenta>0</font> p <font color=Red>=</font> return []-<a name="(line202)"></a>exactly n p <font color=Red>=</font> return <font color=Cyan>(</font><font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> p <font color=Cyan>`apply`</font> exactly <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> p-<a name="(line203)"></a>-<a name="(line204)"></a><a name="many"></a><font color=Blue>-- | 'many p' parses a list of elements with individual parser p.</font>-<a name="(line205)"></a><font color=Blue>-- Cannot fail, since an empty list is a valid return value.</font>-<a name="(line206)"></a>many <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line207)"></a>many p <font color=Red>=</font> many1 p <font color=Cyan>`onFail`</font> return []-<a name="(line208)"></a> <font color=Green><u>where</u></font> many1 p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p-<a name="(line209)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> many p-<a name="(line210)"></a> <font color=Cyan>}</font>-<a name="(line211)"></a>-<a name="(line212)"></a><a name="many1"></a><font color=Blue>-- | Parse a non-empty list of items.</font>-<a name="(line213)"></a>many1 <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line214)"></a>many1 p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"In a sequence:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>.</font> indent <font color=Magenta>2</font><font color=Cyan>)</font>-<a name="(line215)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> many p-<a name="(line216)"></a> <font color=Cyan>}</font>-<a name="(line217)"></a><font color=Blue>-- `adjustErr` ("When looking for a non-empty sequence:\n\t"++)</font>-<a name="(line218)"></a>-<a name="(line219)"></a><a name="sepBy"></a><font color=Blue>-- | Parse a list of items separated by discarded junk.</font>-<a name="(line220)"></a>sepBy <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t sep <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line221)"></a>sepBy p sep <font color=Red>=</font> <font color=Green><u>do</u></font> sepBy1 p sep <font color=Cyan>`onFail`</font> return []-<a name="(line222)"></a>-<a name="(line223)"></a><a name="sepBy1"></a><font color=Blue>-- | Parse a non-empty list of items separated by discarded junk.</font>-<a name="(line224)"></a>sepBy1 <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t sep <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line225)"></a>sepBy1 p sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p-<a name="(line226)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line227)"></a> <font color=Cyan>}</font>-<a name="(line228)"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for a non-empty sequence with separators:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line229)"></a> -<a name="(line230)"></a><a name="bracketSep"></a><font color=Blue>-- | Parse a list of items, discarding the start, end, and separator</font>-<a name="(line231)"></a><font color=Blue>-- items.</font>-<a name="(line232)"></a>bracketSep <font color=Red>::</font> Parser t bra <font color=Red>-></font> Parser t sep <font color=Red>-></font> Parser t ket-<a name="(line233)"></a> <font color=Red>-></font> Parser t a <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line234)"></a>bracketSep open sep close p <font color=Red>=</font>-<a name="(line235)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open<font color=Cyan>;</font> close<font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="(line236)"></a> <font color=Cyan>`onFail`</font>-<a name="(line237)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line238)"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"After first bracket in a group:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line239)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>`apply`</font>-<a name="(line240)"></a> manyFinally <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line241)"></a> <font color=Cyan>(</font>close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for closing bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line242)"></a> <font color=Cyan>}</font>-<a name="(line243)"></a>-<a name="(line244)"></a><a name="bracket"></a><font color=Blue>-- | Parse a bracketed item, discarding the brackets.</font>-<a name="(line245)"></a>bracket <font color=Red>::</font> Parser t bra <font color=Red>-></font> Parser t ket <font color=Red>-></font> Parser t a <font color=Red>-></font> Parser t a-<a name="(line246)"></a>bracket open close p <font color=Red>=</font> <font color=Green><u>do</u></font>-<a name="(line247)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line248)"></a> <font color=Cyan>;</font> p <font color=Cyan>`discard`</font> <font color=Cyan>(</font>close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"Missing closing bracket:\n\t"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line249)"></a> <font color=Cyan>}</font>-<a name="(line250)"></a>-<a name="(line251)"></a><a name="manyFinally"></a><font color=Blue>-- | 'manyFinally e t' parses a possibly-empty sequence of e's,</font>-<a name="(line252)"></a><font color=Blue>-- terminated by a t. Any parse failures could be due either to</font>-<a name="(line253)"></a><font color=Blue>-- a badly-formed terminator or a badly-formed element, so raise</font>-<a name="(line254)"></a><font color=Blue>-- both possible errors.</font>-<a name="(line255)"></a>manyFinally <font color=Red>::</font> Parser t a <font color=Red>-></font> Parser t z <font color=Red>-></font> Parser t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line256)"></a>manyFinally pp<font color=Red>@</font><font color=Cyan>(</font>P p<font color=Cyan>)</font> pt<font color=Red>@</font><font color=Cyan>(</font>P t<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>ts <font color=Red>-></font>-<a name="(line257)"></a> <font color=Green><u>case</u></font> p ts <font color=Green><u>of</u></font>-<a name="(line258)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font>-<a name="(line259)"></a> <font color=Green><u>case</u></font> t ts <font color=Green><u>of</u></font>-<a name="(line260)"></a> <font color=Cyan>(</font>Right <font color=Green><u>_</u></font><font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right []<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line261)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line262)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font>-<a name="(line263)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>tail<font color=Cyan>,</font>ts''<font color=Cyan>)</font> <font color=Red>=</font> runParser <font color=Cyan>(</font>manyFinally pp pt<font color=Cyan>)</font> ts'-<a name="(line264)"></a> <font color=Green><u>in</u></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>x<font color=Red><b>:</b></font>tail<font color=Cyan>)</font><font color=Cyan>,</font> ts''<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line265)"></a>-<a name="(line266)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line267)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line268)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line269)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line270)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line271)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line272)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser t ()-<a name="(line273)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp<font color=Red>-></font> <font color=Cyan>(</font>Right ()<font color=Cyan>,</font> ts<font color=Cyan>++</font>inp<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line274)"></a>-<a name="(line275)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/PolyState.html
@@ -1,261 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>PolyState-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype</font>-<a name="(line3)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad</font>-<a name="(line4)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (Either String a, s, [t])</font>-<a name="(line5)"></a> <font color=Cyan>,</font> failBad <font color=Blue>-- :: String -> Parser s t a</font>-<a name="(line6)"></a> <font color=Cyan>,</font> commit <font color=Blue>-- :: Parser s t a -> Parser s t a</font>-<a name="(line7)"></a> <font color=Blue>-- * Combinators:</font>-<a name="(line8)"></a> <font color=Blue>-- ** Primitives</font>-<a name="(line9)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="(line10)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="(line11)"></a> <font color=Cyan>,</font> apply <font color=Blue>-- :: Parser t (a->b) -> Parser s t a -> Parser s t b</font>-<a name="(line12)"></a> <font color=Cyan>,</font> discard <font color=Blue>-- :: Parser s t a -> Parser s t b -> Parser s t a</font>-<a name="(line13)"></a> <font color=Blue>-- ** Error-handling</font>-<a name="(line14)"></a> <font color=Cyan>,</font> adjustErr <font color=Blue>-- :: Parser s t a -> (String->String) -> Parser s t a</font>-<a name="(line15)"></a> <font color=Cyan>,</font> adjustErrBad<font color=Blue>-- :: Parser s t a -> (String->String) -> Parser s t a</font>-<a name="(line16)"></a> <font color=Cyan>,</font> indent <font color=Blue>-- :: Int -> String -> String</font>-<a name="(line17)"></a> <font color=Blue>-- ** Choices</font>-<a name="(line18)"></a> <font color=Cyan>,</font> onFail <font color=Blue>-- :: Parser s t a -> Parser s t a -> Parser s t a</font>-<a name="(line19)"></a> <font color=Cyan>,</font> oneOf <font color=Blue>-- :: [Parser s t a] -> Parser s t a</font>-<a name="(line20)"></a> <font color=Cyan>,</font> oneOf' <font color=Blue>-- :: [(String, Parser s t a)] -> Parser s t a</font>-<a name="(line21)"></a> <font color=Blue>-- ** Sequences</font>-<a name="(line22)"></a> <font color=Cyan>,</font> exactly <font color=Blue>-- :: Int -> Parser s t a -> Parser s t [a]</font>-<a name="(line23)"></a> <font color=Cyan>,</font> many <font color=Blue>-- :: Parser s t a -> Parser s t [a]</font>-<a name="(line24)"></a> <font color=Cyan>,</font> many1 <font color=Blue>-- :: Parser s t a -> Parser s t [a]</font>-<a name="(line25)"></a> <font color=Cyan>,</font> sepBy <font color=Blue>-- :: Parser s t a -> Parser s t sep -> Parser s t [a]</font>-<a name="(line26)"></a> <font color=Cyan>,</font> sepBy1 <font color=Blue>-- :: Parser s t a -> Parser s t sep -> Parser s t [a]</font>-<a name="(line27)"></a> <font color=Cyan>,</font> bracketSep <font color=Blue>-- :: Parser s t bra -> Parser s t sep -> Parser s t ket</font>-<a name="(line28)"></a> <font color=Blue>-- -> Parser s t a -> Parser s t [a]</font>-<a name="(line29)"></a> <font color=Cyan>,</font> bracket <font color=Blue>-- :: Parser s t bra -> Parser s t ket -> Parser s t a</font>-<a name="(line30)"></a> <font color=Blue>-- -> Parser s t a</font>-<a name="(line31)"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: Parser s t a -> Parser s t z -> Parser s t [a]</font>-<a name="(line32)"></a> <font color=Blue>-- ** State-handling</font>-<a name="(line33)"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="(line34)"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="(line35)"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="(line36)"></a> <font color=Blue>-- ** Re-parsing</font>-<a name="(line37)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="(line38)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line39)"></a>-<a name="(line40)"></a><a name="Parser"></a><font color=Blue>-- | The @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line41)"></a><a name="Parser"></a><font color=Blue>-- reporting and a running state. It can be used for arbitrary token</font>-<a name="(line42)"></a><a name="Parser"></a><font color=Blue>-- types, not just String input.</font>-<a name="(line43)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>EitherE String a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line44)"></a>-<a name="(line45)"></a><a name="EitherE"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="(line46)"></a><a name="EitherE"></a><font color=Blue>-- right and wrong answers, but also had gradations of wrongness.</font>-<a name="(line47)"></a><a name="EitherE"></a><font color=Green><u>type</u></font> EitherE a b <font color=Red>=</font> Either <font color=Cyan>(</font>Bool<font color=Cyan>,</font>a<font color=Cyan>)</font> b-<a name="(line48)"></a>-<a name="(line49)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an initial state and input token sequence.</font>-<a name="(line50)"></a>runParser <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line51)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> s <font color=Red>=</font>-<a name="(line52)"></a> <font color=Cyan>(</font><font color=Red>\</font> <font color=Cyan>(</font>e<font color=Cyan>,</font>s<font color=Cyan>,</font>ts<font color=Cyan>)</font><font color=Red>-></font> <font color=Cyan>(</font><font color=Green><u>case</u></font> e <font color=Green><u>of</u></font> Left <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>m<font color=Cyan>)</font><font color=Red>-></font>Left m<font color=Cyan>;</font> Right m<font color=Red>-></font>Right m-<a name="(line53)"></a> <font color=Cyan>,</font>s<font color=Cyan>,</font>ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line54)"></a> <font color=Cyan>.</font> p s-<a name="(line55)"></a>-<a name="(line56)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line57)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line58)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line59)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f x<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line60)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line61)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line62)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> f s ts <font color=Green><u>of</u></font>-<a name="(line63)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line64)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x-<a name="(line65)"></a> <font color=Green><u>in</u></font> g' s' ts'<font color=Cyan>)</font>-<a name="(line66)"></a> fail msg <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>False<font color=Cyan>,</font>msg<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line67)"></a>-<a name="(line68)"></a><a name="failBad"></a><font color=Blue>-- | When a simple fail is not strong enough, use failBad for emphasis.</font>-<a name="(line69)"></a><font color=Blue>-- An emphasised (severe) error can propagate out through choice operators.</font>-<a name="(line70)"></a>failBad <font color=Red>::</font> String <font color=Red>-></font> Parser s t a-<a name="(line71)"></a>failBad msg <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>True<font color=Cyan>,</font>msg<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line72)"></a>-<a name="(line73)"></a><a name="commit"></a><font color=Blue>-- | Commit is a way of raising the severity of any errors found within</font>-<a name="(line74)"></a><font color=Blue>-- its argument. Used in the middle of a parser definition, it means that</font>-<a name="(line75)"></a><font color=Blue>-- any operations prior to commitment fail softly, but after commitment,</font>-<a name="(line76)"></a><font color=Blue>-- they fail hard.</font>-<a name="(line77)"></a>commit <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line78)"></a>commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line79)"></a> <font color=Cyan>(</font>Left <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>e<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>True<font color=Cyan>,</font>e<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line80)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line81)"></a>-<a name="(line82)"></a><font color=Blue>-- Combinators</font>-<a name="(line83)"></a>-<a name="(line84)"></a><a name="next"></a><font color=Blue>-- | One token</font>-<a name="(line85)"></a>next <font color=Red>::</font> Parser s t t-<a name="(line86)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line87)"></a> [] <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>False<font color=Cyan>,</font><font color=Magenta>"Ran out of input (EOF)"</font><font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> []<font color=Cyan>)</font>-<a name="(line88)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right t<font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line89)"></a>-<a name="(line90)"></a><a name="satisfy"></a><font color=Blue>-- | One token satifying a predicate</font>-<a name="(line91)"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="(line92)"></a>satisfy p <font color=Red>=</font> <font color=Green><u>do</u></font><font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line93)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line94)"></a> <font color=Cyan>}</font>-<a name="(line95)"></a>-<a name="(line96)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`apply`</font>-<a name="(line97)"></a><a name="apply"></a><font color=Blue>-- | Apply a parsed function to a parsed value</font>-<a name="(line98)"></a>apply <font color=Red>::</font> Parser s t <font color=Cyan>(</font>a<font color=Red>-></font>b<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t b-<a name="(line99)"></a><a name="apply"></a>pf <font color=Cyan>`apply`</font> px <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> f <font color=Red><-</font> pf<font color=Cyan>;</font> x <font color=Red><-</font> px<font color=Cyan>;</font> return <font color=Cyan>(</font>f x<font color=Cyan>)</font> <font color=Cyan>}</font>-<a name="(line100)"></a>-<a name="(line101)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`discard`</font>-<a name="(line102)"></a><a name="discard"></a><font color=Blue>-- | @x `discard` y@ parses both x and y, but discards the result of y</font>-<a name="(line103)"></a>discard <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t b <font color=Red>-></font> Parser s t a-<a name="(line104)"></a><a name="discard"></a>px <font color=Cyan>`discard`</font> py <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> px<font color=Cyan>;</font> <font color=Green><u>_</u></font> <font color=Red><-</font> py<font color=Cyan>;</font> return x <font color=Cyan>}</font>-<a name="(line105)"></a>-<a name="(line106)"></a><a name="adjustErr"></a><font color=Blue>-- | @p `adjustErr` f@ applies the transformation @f@ to any error message</font>-<a name="(line107)"></a><font color=Blue>-- generated in @p@, having no effect if @p@ succeeds.</font>-<a name="(line108)"></a>adjustErr <font color=Red>::</font> Parser s t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line109)"></a><a name="adjustErr"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font>-<a name="(line110)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line111)"></a> <font color=Cyan>(</font>Left <font color=Cyan>(</font>b<font color=Cyan>,</font>msg<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>b<font color=Cyan>,</font><font color=Cyan>(</font>f msg<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line112)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line113)"></a>-<a name="(line114)"></a><a name="adjustErrBad"></a><font color=Blue>-- | @adjustErrBad@ is just like @adjustErr@ except it also raises the</font>-<a name="(line115)"></a><font color=Blue>-- severity of the error.</font>-<a name="(line116)"></a>adjustErrBad <font color=Red>::</font> Parser s t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line117)"></a><a name="adjustErrBad"></a><font color=Blue>-- p `adjustErrBad` f = commit (p `adjustErr` f)</font>-<a name="(line118)"></a><a name="adjustErrBad"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErrBad`</font> f <font color=Red>=</font>-<a name="(line119)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line120)"></a> <font color=Cyan>(</font>Left <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>msg<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>True<font color=Cyan>,</font><font color=Cyan>(</font>f msg<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line121)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line122)"></a>-<a name="(line123)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>6</font> <font color=Cyan>`onFail`</font> <font color=Blue>-- not sure about precedence 6?</font>-<a name="(line124)"></a><a name="onFail"></a><font color=Blue>-- | @p `onFail` q@ means parse p unless p fails in which case parse q instead.</font>-<a name="(line125)"></a><font color=Blue>-- Can be chained together to give multiple attempts to parse something.</font>-<a name="(line126)"></a><font color=Blue>-- (Note that q could itself be a failing parser, e.g. to change the error</font>-<a name="(line127)"></a><font color=Blue>-- message from that defined in p to something different.)</font>-<a name="(line128)"></a><font color=Blue>-- However, a severe failure in p cannot be ignored.</font>-<a name="(line129)"></a>onFail <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line130)"></a><a name="onFail"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line131)"></a> r<font color=Red>@</font><font color=Cyan>(</font>Left <font color=Cyan>(</font>True<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> r-<a name="(line132)"></a> <font color=Cyan>(</font>Left <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> q s ts-<a name="(line133)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line134)"></a>-<a name="(line135)"></a><a name="oneOf"></a><font color=Blue>-- | Parse the first alternative in the list that succeeds.</font>-<a name="(line136)"></a>oneOf <font color=Red>::</font> <font color=Red>[</font>Parser s t a<font color=Red>]</font> <font color=Red>-></font> Parser s t a-<a name="(line137)"></a>oneOf [] <font color=Red>=</font> fail <font color=Cyan>(</font><font color=Magenta>"Failed to parse any of the possible choices"</font><font color=Cyan>)</font>-<a name="(line138)"></a>oneOf <font color=Cyan>(</font>p<font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font> p <font color=Cyan>`onFail`</font> oneOf ps-<a name="(line139)"></a>-<a name="(line140)"></a><a name="oneOf'"></a><font color=Blue>-- | Parse the first alternative that succeeds, but if none succeed,</font>-<a name="(line141)"></a><font color=Blue>-- report only the severe errors, and if none of those, then report</font>-<a name="(line142)"></a><font color=Blue>-- all the soft errors.</font>-<a name="(line143)"></a>oneOf' <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font> Parser s t a<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser s t a-<a name="(line144)"></a>oneOf' <font color=Red>=</font> accum []-<a name="(line145)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line146)"></a> <font color=Green><u>case</u></font> filter isBad errs <font color=Green><u>of</u></font>-<a name="(line147)"></a> [] <font color=Red>-></font> fail <font color=Cyan>(</font><font color=Magenta>"failed to parse any of the possible choices:\n"</font>-<a name="(line148)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse errs<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line149)"></a> <font color=Red>[</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>e<font color=Cyan>)</font><font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> failBad e-<a name="(line150)"></a> es <font color=Red>-></font> failBad <font color=Cyan>(</font><font color=Magenta>"one of the following failures occurred:\n"</font>-<a name="(line151)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse es<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line152)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line153)"></a> P <font color=Cyan>(</font><font color=Red>\</font>u ts<font color=Red>-></font> <font color=Green><u>case</u></font> p u ts <font color=Green><u>of</u></font>-<a name="(line154)"></a> <font color=Cyan>(</font>Left err<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line155)"></a> <font color=Green><u>in</u></font> p u ts-<a name="(line156)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line157)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line158)"></a> isBad <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font><font color=Cyan>(</font>b<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Cyan>)</font> <font color=Red>=</font> b-<a name="(line159)"></a>-<a name="(line160)"></a><a name="indent"></a><font color=Blue>-- | Helper for formatting error messages: indents all lines by a fixed amount.</font>-<a name="(line161)"></a>indent <font color=Red>::</font> Int <font color=Red>-></font> String <font color=Red>-></font> String-<a name="(line162)"></a>indent n <font color=Red>=</font> unlines <font color=Cyan>.</font> map <font color=Cyan>(</font>replicate n <font color=Magenta>' '</font> <font color=Cyan>++</font><font color=Cyan>)</font> <font color=Cyan>.</font> lines-<a name="(line163)"></a>-<a name="(line164)"></a><a name="exactly"></a><font color=Blue>-- | 'exactly n p' parses a precise number of items, n, using the parser</font>-<a name="(line165)"></a><font color=Blue>-- p, in sequence.</font>-<a name="(line166)"></a>exactly <font color=Red>::</font> Int <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line167)"></a>exactly <font color=Magenta>0</font> p <font color=Red>=</font> return []-<a name="(line168)"></a>exactly n p <font color=Red>=</font> <font color=Green><u>do</u></font> x <font color=Red><-</font> p-<a name="(line169)"></a> xs <font color=Red><-</font> exactly <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> p-<a name="(line170)"></a> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line171)"></a>-<a name="(line172)"></a><a name="many"></a><font color=Blue>-- | 'many p' parses a list of elements with individual parser p.</font>-<a name="(line173)"></a><font color=Blue>-- Cannot fail, since an empty list is a valid return value.</font>-<a name="(line174)"></a>many <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line175)"></a>many p <font color=Red>=</font> many1 p <font color=Cyan>`onFail`</font> return []-<a name="(line176)"></a>-<a name="(line177)"></a><a name="many1"></a><font color=Blue>-- | Parse a non-empty list of items.</font>-<a name="(line178)"></a>many1 <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line179)"></a>many1 p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"In a sequence:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>.</font> indent <font color=Magenta>2</font><font color=Cyan>)</font>-<a name="(line180)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many p-<a name="(line181)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line182)"></a> <font color=Cyan>}</font>-<a name="(line183)"></a><font color=Blue>-- `adjustErr` ("When looking for a non-empty sequence:\n"++)</font>-<a name="(line184)"></a>-<a name="(line185)"></a><a name="sepBy"></a><font color=Blue>-- | Parse a list of items separated by discarded junk.</font>-<a name="(line186)"></a>sepBy <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line187)"></a>sepBy p sep <font color=Red>=</font> <font color=Green><u>do</u></font> sepBy1 p sep <font color=Cyan>`onFail`</font> return []-<a name="(line188)"></a>-<a name="(line189)"></a><a name="sepBy1"></a><font color=Blue>-- | Parse a non-empty list of items separated by discarded junk.</font>-<a name="(line190)"></a>sepBy1 <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line191)"></a>sepBy1 p sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p-<a name="(line192)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line193)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line194)"></a> <font color=Cyan>}</font>-<a name="(line195)"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for a non-empty sequence with separators:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line196)"></a> -<a name="(line197)"></a><a name="bracketSep"></a><font color=Blue>-- | Parse a list of items, discarding the start, end, and separator</font>-<a name="(line198)"></a><font color=Blue>-- items.</font>-<a name="(line199)"></a>bracketSep <font color=Red>::</font> Parser s t bra <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t ket-<a name="(line200)"></a> <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line201)"></a>bracketSep open sep close p <font color=Red>=</font>-<a name="(line202)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open<font color=Cyan>;</font> close<font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="(line203)"></a> <font color=Cyan>`onFail`</font>-<a name="(line204)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line205)"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"After first bracket in a group:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line206)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line207)"></a> <font color=Cyan>;</font> close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for closing bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line208)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line209)"></a> <font color=Cyan>}</font>-<a name="(line210)"></a>-<a name="(line211)"></a><a name="bracket"></a><font color=Blue>-- | Parse a bracketed item, discarding the brackets.</font>-<a name="(line212)"></a>bracket <font color=Red>::</font> Parser s t bra <font color=Red>-></font> Parser s t ket <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line213)"></a>bracket open close p <font color=Red>=</font> <font color=Green><u>do</u></font>-<a name="(line214)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line215)"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p-<a name="(line216)"></a> <font color=Cyan>;</font> close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"Missing closing bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line217)"></a> <font color=Cyan>;</font> return x-<a name="(line218)"></a> <font color=Cyan>}</font>-<a name="(line219)"></a>-<a name="(line220)"></a><a name="manyFinally"></a><font color=Blue>-- | 'manyFinally e t' parses a possibly-empty sequence of e's,</font>-<a name="(line221)"></a><font color=Blue>-- terminated by a t. Any parse failures could be due either to</font>-<a name="(line222)"></a><font color=Blue>-- a badly-formed terminator or a badly-formed element, so raise</font>-<a name="(line223)"></a><font color=Blue>-- both possible errors.</font>-<a name="(line224)"></a>manyFinally <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t z <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line225)"></a>manyFinally p t <font color=Red>=</font>-<a name="(line226)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> xs <font color=Red><-</font> many p-<a name="(line227)"></a> <font color=Cyan>;</font> oneOf' <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"sequence terminator"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> t<font color=Cyan>;</font> return () <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="(line228)"></a> <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"item in a sequence"</font><font color=Cyan>,</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> p<font color=Cyan>;</font> return () <font color=Cyan>}</font> <font color=Cyan>)</font>-<a name="(line229)"></a> <font color=Red>]</font>-<a name="(line230)"></a> <font color=Cyan>;</font> return xs-<a name="(line231)"></a> <font color=Cyan>}</font>-<a name="(line232)"></a>-<a name="(line233)"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line234)"></a><font color=Blue>-- State handling</font>-<a name="(line235)"></a>-<a name="(line236)"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="(line237)"></a>stUpdate <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="(line238)"></a>stUpdate f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right ()<font color=Cyan>,</font> f s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line239)"></a>-<a name="(line240)"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="(line241)"></a>stQuery <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line242)"></a>stQuery f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line243)"></a>-<a name="(line244)"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="(line245)"></a>stGet <font color=Red>::</font> Parser s t s-<a name="(line246)"></a>stGet <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right s<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line247)"></a>-<a name="(line248)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line249)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line250)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line251)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line252)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line253)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line254)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="(line255)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> <font color=Cyan>(</font>Right ()<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>++</font>inp<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line256)"></a>-<a name="(line257)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/haddock/src/Text/ParserCombinators/PolyStateLazy.html
@@ -1,294 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">-<html>-<pre><a name="(line1)"></a><font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>PolyStateLazy-<a name="(line2)"></a> <font color=Cyan>(</font> <font color=Blue>-- * The Parser datatype.</font>-<a name="(line3)"></a> <font color=Blue>-- $parser</font>-<a name="(line4)"></a> Parser<font color=Cyan>(</font>P<font color=Cyan>)</font> <font color=Blue>-- datatype, instance of: Functor, Monad</font>-<a name="(line5)"></a> <font color=Cyan>,</font> runParser <font color=Blue>-- :: Parser s t a -> s -> [t] -> (a, s, [t])</font>-<a name="(line6)"></a> <font color=Cyan>,</font> failBad <font color=Blue>-- :: String -> Parser s t a</font>-<a name="(line7)"></a> <font color=Cyan>,</font> commit <font color=Blue>-- :: Parser s t a -> Parser s t a</font>-<a name="(line8)"></a> <font color=Blue>-- * Combinators:</font>-<a name="(line9)"></a> <font color=Blue>-- ** Primitives</font>-<a name="(line10)"></a> <font color=Cyan>,</font> next <font color=Blue>-- :: Parser s t t</font>-<a name="(line11)"></a> <font color=Cyan>,</font> satisfy <font color=Blue>-- :: (t->Bool) -> Parser s t t</font>-<a name="(line12)"></a> <font color=Cyan>,</font> apply <font color=Blue>-- :: Parser t (a->b) -> Parser s t a -> Parser s t b</font>-<a name="(line13)"></a> <font color=Cyan>,</font> discard <font color=Blue>-- :: Parser s t a -> Parser s t b -> Parser s t a</font>-<a name="(line14)"></a> <font color=Blue>-- ** Error-handling</font>-<a name="(line15)"></a> <font color=Cyan>,</font> adjustErr <font color=Blue>-- :: Parser s t a -> (String->String) -> Parser s t a</font>-<a name="(line16)"></a> <font color=Cyan>,</font> adjustErrBad<font color=Blue>-- :: Parser s t a -> (String->String) -> Parser s t a</font>-<a name="(line17)"></a> <font color=Cyan>,</font> indent <font color=Blue>-- :: Int -> String -> String</font>-<a name="(line18)"></a> <font color=Blue>-- ** Choices</font>-<a name="(line19)"></a> <font color=Cyan>,</font> onFail <font color=Blue>-- :: Parser s t a -> Parser s t a -> Parser s t a</font>-<a name="(line20)"></a> <font color=Cyan>,</font> oneOf <font color=Blue>-- :: [Parser s t a] -> Parser s t a</font>-<a name="(line21)"></a> <font color=Cyan>,</font> oneOf' <font color=Blue>-- :: [(String, Parser s t a)] -> Parser s t a</font>-<a name="(line22)"></a> <font color=Cyan>,</font> optional <font color=Blue>-- :: Parser s t a -> Parser s t (Maybe a)</font>-<a name="(line23)"></a> <font color=Blue>-- ** Sequences</font>-<a name="(line24)"></a> <font color=Cyan>,</font> exactly <font color=Blue>-- :: Int -> Parser s t a -> Parser s t [a]</font>-<a name="(line25)"></a> <font color=Cyan>,</font> many <font color=Blue>-- :: Parser s t a -> Parser s t [a]</font>-<a name="(line26)"></a> <font color=Cyan>,</font> many1 <font color=Blue>-- :: Parser s t a -> Parser s t [a]</font>-<a name="(line27)"></a> <font color=Cyan>,</font> sepBy <font color=Blue>-- :: Parser s t a -> Parser s t sep -> Parser s t [a]</font>-<a name="(line28)"></a> <font color=Cyan>,</font> sepBy1 <font color=Blue>-- :: Parser s t a -> Parser s t sep -> Parser s t [a]</font>-<a name="(line29)"></a> <font color=Cyan>,</font> bracketSep <font color=Blue>-- :: Parser s t bra -> Parser s t sep -> Parser s t ket</font>-<a name="(line30)"></a> <font color=Blue>-- -> Parser s t a -> Parser s t [a]</font>-<a name="(line31)"></a> <font color=Cyan>,</font> bracket <font color=Blue>-- :: Parser s t bra -> Parser s t ket -> Parser s t a</font>-<a name="(line32)"></a> <font color=Blue>-- -> Parser s t a</font>-<a name="(line33)"></a> <font color=Cyan>,</font> manyFinally <font color=Blue>-- :: Parser s t a -> Parser s t z -> Parser s t [a]</font>-<a name="(line34)"></a> <font color=Blue>-- ** State-handling</font>-<a name="(line35)"></a> <font color=Cyan>,</font> stUpdate <font color=Blue>-- :: (s->s) -> Parser s t ()</font>-<a name="(line36)"></a> <font color=Cyan>,</font> stQuery <font color=Blue>-- :: (s->a) -> Parser s t a</font>-<a name="(line37)"></a> <font color=Cyan>,</font> stGet <font color=Blue>-- :: Parser s t s</font>-<a name="(line38)"></a> <font color=Blue>-- ** Re-parsing</font>-<a name="(line39)"></a> <font color=Cyan>,</font> reparse <font color=Blue>-- :: [t] -> Parser s t ()</font>-<a name="(line40)"></a> <font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line41)"></a>-<a name="(line42)"></a><font color=Magenta><em>#if __GLASGOW_HASKELL__</em></font>-<a name="(line43)"></a><font color=Green><u>import</u></font> Control<font color=Cyan>.</font>Exception hiding <font color=Cyan>(</font>bracket<font color=Cyan>)</font>-<a name="(line44)"></a><a name="throwE"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line45)"></a>throwE msg <font color=Red>=</font> throw <font color=Cyan>(</font>ErrorCall msg<font color=Cyan>)</font>-<a name="(line46)"></a><font color=Magenta><em>#else</em></font>-<a name="(line47)"></a>throwE <font color=Red>::</font> String <font color=Red>-></font> a-<a name="(line48)"></a>throwE msg <font color=Red>=</font> error msg-<a name="(line49)"></a><font color=Magenta><em>#endif</em></font>-<a name="(line50)"></a>-<a name="(line51)"></a><font color=Blue>-- $parser</font>-<a name="(line52)"></a><font color=Blue>-- Parsers do not return explicit failure. An exception is raised</font>-<a name="(line53)"></a><font color=Blue>-- instead. This allows partial results to be returned before a</font>-<a name="(line54)"></a><font color=Blue>-- full parse is complete.</font>-<a name="(line55)"></a>-<a name="(line56)"></a><a name="Parser"></a><font color=Blue>-- | The @Parser@ datatype is a fairly generic parsing monad with error</font>-<a name="(line57)"></a><a name="Parser"></a><font color=Blue>-- reporting and a running state. It can be used for arbitrary token</font>-<a name="(line58)"></a><a name="Parser"></a><font color=Blue>-- types, not just String input.</font>-<a name="(line59)"></a><a name="Parser"></a><font color=Green><u>newtype</u></font> Parser s t a <font color=Red>=</font> P <font color=Cyan>(</font>s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>Either String a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line60)"></a>-<a name="(line61)"></a><a name="EitherE"></a><font color=Blue>-- | A return type like Either, that distinguishes not only between</font>-<a name="(line62)"></a><a name="EitherE"></a><font color=Blue>-- right and wrong answers, but also had gradations of wrongness.</font>-<a name="(line63)"></a><a name="EitherE"></a><font color=Blue>-- Not used in this library. !!!!!!!!!!!!!!!!!!!!!!!!!!</font>-<a name="(line64)"></a><a name="EitherE"></a><font color=Green><u>type</u></font> EitherE a b <font color=Red>=</font> Either <font color=Cyan>(</font>Bool<font color=Cyan>,</font>a<font color=Cyan>)</font> b-<a name="(line65)"></a>-<a name="(line66)"></a><a name="runParser"></a><font color=Blue>-- | Apply a parser to an initial state and input token sequence.</font>-<a name="(line67)"></a><font color=Blue>-- The parser cannot return an error value explicitly, so errors</font>-<a name="(line68)"></a><font color=Blue>-- raise an exception. Thus, results can be partial (lazily constructed,</font>-<a name="(line69)"></a><font color=Blue>-- but containing undefined).</font>-<a name="(line70)"></a>runParser <font color=Red>::</font> Parser s t a <font color=Red>-></font> s <font color=Red>-></font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Cyan>,</font> s<font color=Cyan>,</font> <font color=Red>[</font>t<font color=Red>]</font><font color=Cyan>)</font>-<a name="(line71)"></a>runParser <font color=Cyan>(</font>P p<font color=Cyan>)</font> s <font color=Red>=</font>-<a name="(line72)"></a> <font color=Cyan>(</font><font color=Red>\</font> <font color=Cyan>(</font>e<font color=Cyan>,</font>s<font color=Cyan>,</font>ts<font color=Cyan>)</font><font color=Red>-></font> <font color=Cyan>(</font><font color=Green><u>case</u></font> e <font color=Green><u>of</u></font> <font color=Cyan>{</font>Left m<font color=Red>-></font>throwE m<font color=Cyan>;</font> Right x<font color=Red>-></font>x<font color=Cyan>}</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line73)"></a> <font color=Cyan>.</font> p s-<a name="(line74)"></a>-<a name="(line75)"></a><font color=Green><u>instance</u></font> Functor <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line76)"></a> fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line77)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line78)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f x<font color=Cyan>)</font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line79)"></a><font color=Green><u>instance</u></font> Monad <font color=Cyan>(</font>Parser s t<font color=Cyan>)</font> <font color=Green><u>where</u></font>-<a name="(line80)"></a> return x <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line81)"></a> <font color=Cyan>(</font>P f<font color=Cyan>)</font> <font color=Cyan>>>=</font> g <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> f s ts <font color=Green><u>of</u></font>-<a name="(line82)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line83)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P g'<font color=Cyan>)</font> <font color=Red>=</font> g x-<a name="(line84)"></a> <font color=Green><u>in</u></font> g' s' ts'<font color=Cyan>)</font>-<a name="(line85)"></a> fail msg <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line86)"></a>-<a name="(line87)"></a><a name="failBad"></a><font color=Blue>-- | Simple failure can be corrected, but when a simple fail is not strong</font>-<a name="(line88)"></a><font color=Blue>-- enough, use failBad for emphasis. It guarantees parsing will terminate</font>-<a name="(line89)"></a><font color=Blue>-- with an exception.</font>-<a name="(line90)"></a>failBad <font color=Red>::</font> String <font color=Red>-></font> Parser s t a-<a name="(line91)"></a>failBad msg <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>throwE msg<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line92)"></a>-<a name="(line93)"></a><a name="commit"></a><font color=Blue>-- | Commit is a way of raising the severity of any errors found within</font>-<a name="(line94)"></a><font color=Blue>-- its argument. Used in the middle of a parser definition, it means that</font>-<a name="(line95)"></a><font color=Blue>-- any operations prior to commitment fail softly, but after commitment,</font>-<a name="(line96)"></a><font color=Blue>-- they fail hard.</font>-<a name="(line97)"></a>commit <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line98)"></a>commit <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line99)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>throwE e<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line100)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line101)"></a>-<a name="(line102)"></a><font color=Blue>-- Combinators</font>-<a name="(line103)"></a>-<a name="(line104)"></a><a name="next"></a><font color=Blue>-- | One token</font>-<a name="(line105)"></a>next <font color=Red>::</font> Parser s t t-<a name="(line106)"></a>next <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> ts <font color=Green><u>of</u></font>-<a name="(line107)"></a> [] <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Magenta>"Ran out of input (EOF)"</font><font color=Cyan>,</font> s<font color=Cyan>,</font> []<font color=Cyan>)</font>-<a name="(line108)"></a> <font color=Cyan>(</font>t<font color=Red><b>:</b></font>ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right t<font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line109)"></a>-<a name="(line110)"></a><a name="satisfy"></a><font color=Blue>-- | One token satifying a predicate</font>-<a name="(line111)"></a>satisfy <font color=Red>::</font> <font color=Cyan>(</font>t<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser s t t-<a name="(line112)"></a>satisfy p <font color=Red>=</font> <font color=Green><u>do</u></font><font color=Cyan>{</font> x <font color=Red><-</font> next-<a name="(line113)"></a> <font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> fail <font color=Magenta>"Parse.satisfy: failed"</font>-<a name="(line114)"></a> <font color=Cyan>}</font>-<a name="(line115)"></a>-<a name="(line116)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`apply`</font>-<a name="(line117)"></a><a name="apply"></a><font color=Blue>-- | Apply a parsed function to a parsed value</font>-<a name="(line118)"></a>apply <font color=Red>::</font> Parser s t <font color=Cyan>(</font>a<font color=Red>-></font>b<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t b-<a name="(line119)"></a><a name="apply"></a><font color=Blue>--pf `apply` px = do { f <- pf; x <- px; return (f x) }</font>-<a name="(line120)"></a><a name="apply"></a><font color=Blue>-- Needs to be lazier! Must not force the argument value too early.</font>-<a name="(line121)"></a><a name="apply"></a><font color=Cyan>(</font>P pf<font color=Cyan>)</font> <font color=Cyan>`apply`</font> <font color=Cyan>(</font>P px<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font>-<a name="(line122)"></a> <font color=Green><u>case</u></font> pf s ts <font color=Green><u>of</u></font>-<a name="(line123)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line124)"></a> <font color=Cyan>(</font>Right f<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>x'<font color=Cyan>,</font>s''<font color=Cyan>,</font>ts''<font color=Cyan>)</font> <font color=Red>=</font> px s' ts'-<a name="(line125)"></a> x <font color=Red>=</font> <font color=Green><u>case</u></font> x' <font color=Green><u>of</u></font>-<a name="(line126)"></a> Right x <font color=Red>-></font> x-<a name="(line127)"></a> Left e <font color=Red>-></font> throwE e-<a name="(line128)"></a> <font color=Green><u>in</u></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f x<font color=Cyan>)</font><font color=Cyan>,</font> s''<font color=Cyan>,</font> ts''<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line129)"></a>-<a name="(line130)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>3</font> <font color=Cyan>`discard`</font>-<a name="(line131)"></a><a name="discard"></a><font color=Blue>-- | @x `discard` y@ parses both x and y, but discards the result of y</font>-<a name="(line132)"></a>discard <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t b <font color=Red>-></font> Parser s t a-<a name="(line133)"></a><a name="discard"></a>px <font color=Cyan>`discard`</font> py <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> px<font color=Cyan>;</font> <font color=Green><u>_</u></font> <font color=Red><-</font> py<font color=Cyan>;</font> return x <font color=Cyan>}</font>-<a name="(line134)"></a>-<a name="(line135)"></a><a name="adjustErr"></a><font color=Blue>-- | @p `adjustErr` f@ applies the transformation @f@ to any error message</font>-<a name="(line136)"></a><font color=Blue>-- generated in @p@, having no effect if @p@ succeeds.</font>-<a name="(line137)"></a>adjustErr <font color=Red>::</font> Parser s t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line138)"></a><a name="adjustErr"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErr`</font> f <font color=Red>=</font>-<a name="(line139)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line140)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left <font color=Cyan>(</font>f msg<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line141)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line142)"></a>-<a name="(line143)"></a><a name="adjustErrBad"></a><font color=Blue>-- | @adjustErrBad@ is just like @adjustErr@ except it also raises the</font>-<a name="(line144)"></a><font color=Blue>-- severity of the error.</font>-<a name="(line145)"></a>adjustErrBad <font color=Red>::</font> Parser s t a <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Red>-></font>String<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line146)"></a><a name="adjustErrBad"></a><font color=Blue>-- p `adjustErrBad` f = commit (p `adjustErr` f)</font>-<a name="(line147)"></a><a name="adjustErrBad"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`adjustErrBad`</font> f <font color=Red>=</font>-<a name="(line148)"></a> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line149)"></a> <font color=Cyan>(</font>Left msg<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>throwE <font color=Cyan>(</font>f msg<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line150)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line151)"></a>-<a name="(line152)"></a><font color=Green><u>infixl</u></font> <font color=Magenta>6</font> <font color=Cyan>`onFail`</font> <font color=Blue>-- not sure about precedence 6?</font>-<a name="(line153)"></a><a name="onFail"></a><font color=Blue>-- | @p `onFail` q@ means parse p unless p fails in which case parse q instead.</font>-<a name="(line154)"></a><font color=Blue>-- Can be chained together to give multiple attempts to parse something.</font>-<a name="(line155)"></a><font color=Blue>-- (Note that q could itself be a failing parser, e.g. to change the error</font>-<a name="(line156)"></a><font color=Blue>-- message from that defined in p to something different.)</font>-<a name="(line157)"></a><font color=Blue>-- However, a *severe* failure in p cannot be ignored.</font>-<a name="(line158)"></a>onFail <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line159)"></a><a name="onFail"></a><font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`onFail`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line160)"></a> <font color=Cyan>(</font>Left <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> q s ts-<a name="(line161)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line162)"></a>-<a name="(line163)"></a><a name="oneOf"></a><font color=Blue>-- | Parse the first alternative in the list that succeeds.</font>-<a name="(line164)"></a>oneOf <font color=Red>::</font> <font color=Red>[</font>Parser s t a<font color=Red>]</font> <font color=Red>-></font> Parser s t a-<a name="(line165)"></a>oneOf [] <font color=Red>=</font> fail <font color=Cyan>(</font><font color=Magenta>"Failed to parse any of the possible choices"</font><font color=Cyan>)</font>-<a name="(line166)"></a>oneOf <font color=Cyan>(</font>p<font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font> p <font color=Cyan>`onFail`</font> oneOf ps-<a name="(line167)"></a>-<a name="(line168)"></a><a name="oneOf'"></a><font color=Blue>-- | Parse the first alternative that succeeds, but if none succeed,</font>-<a name="(line169)"></a><font color=Blue>-- report only the severe errors, and if none of those, then report</font>-<a name="(line170)"></a><font color=Blue>-- all the soft errors.</font>-<a name="(line171)"></a>oneOf' <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font> Parser s t a<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser s t a-<a name="(line172)"></a>oneOf' ps <font color=Red>=</font> accum [] ps-<a name="(line173)"></a> <font color=Green><u>where</u></font> accum errs [] <font color=Red>=</font>-<a name="(line174)"></a> <font color=Green><u>case</u></font> errs <font color=Green><u>of</u></font>-<a name="(line175)"></a> [] <font color=Red>-></font> failBad <font color=Cyan>(</font><font color=Magenta>"internal failure in parser (oneOf'):\n"</font>-<a name="(line176)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>show <font color=Cyan>(</font>map fst ps<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line177)"></a> <font color=Red>[</font><font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Cyan>,</font>e<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> fail e-<a name="(line178)"></a> es <font color=Red>-></font> fail <font color=Cyan>(</font><font color=Magenta>"one of the following failures occurred:\n"</font>-<a name="(line179)"></a> <font color=Cyan>++</font>indent <font color=Magenta>2</font> <font color=Cyan>(</font>concatMap showErr <font color=Cyan>(</font>reverse es<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line180)"></a> accum errs <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>P p<font color=Cyan>)</font><font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font>-<a name="(line181)"></a> P <font color=Cyan>(</font><font color=Red>\</font>u ts<font color=Red>-></font> <font color=Green><u>case</u></font> p u ts <font color=Green><u>of</u></font>-<a name="(line182)"></a> <font color=Cyan>(</font>Left err<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> accum <font color=Cyan>(</font><font color=Cyan>(</font>e<font color=Cyan>,</font>err<font color=Cyan>)</font><font color=Red><b>:</b></font>errs<font color=Cyan>)</font> ps-<a name="(line183)"></a> <font color=Green><u>in</u></font> p u ts-<a name="(line184)"></a> right <font color=Red>-></font> right <font color=Cyan>)</font>-<a name="(line185)"></a> showErr <font color=Cyan>(</font>name<font color=Cyan>,</font>err<font color=Cyan>)</font> <font color=Red>=</font> name<font color=Cyan>++</font><font color=Magenta>":\n"</font><font color=Cyan>++</font>indent <font color=Magenta>2</font> err-<a name="(line186)"></a>-<a name="(line187)"></a><a name="indent"></a><font color=Blue>-- | Helper for formatting error messages: indents all lines by a fixed amount.</font>-<a name="(line188)"></a>indent <font color=Red>::</font> Int <font color=Red>-></font> String <font color=Red>-></font> String-<a name="(line189)"></a>indent n <font color=Red>=</font> unlines <font color=Cyan>.</font> map <font color=Cyan>(</font>replicate n <font color=Magenta>' '</font> <font color=Cyan>++</font><font color=Cyan>)</font> <font color=Cyan>.</font> lines-<a name="(line190)"></a>-<a name="(line191)"></a><a name="optional"></a><font color=Blue>-- | 'optional' indicates whether the parser succeeded through the Maybe type.</font>-<a name="(line192)"></a>optional <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t <font color=Cyan>(</font>Maybe a<font color=Cyan>)</font>-<a name="(line193)"></a>optional p <font color=Red>=</font> fmap Just p <font color=Cyan>`onFail`</font> return Nothing-<a name="(line194)"></a>-<a name="(line195)"></a><a name="exactly"></a><font color=Blue>-- | 'exactly n p' parses a precise number of items, n, using the parser</font>-<a name="(line196)"></a><font color=Blue>-- p, in sequence.</font>-<a name="(line197)"></a>exactly <font color=Red>::</font> Int <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line198)"></a>exactly <font color=Magenta>0</font> p <font color=Red>=</font> return []-<a name="(line199)"></a>exactly n p <font color=Red>=</font> <font color=Green><u>do</u></font> x <font color=Red><-</font> p-<a name="(line200)"></a> xs <font color=Red><-</font> exactly <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> p-<a name="(line201)"></a> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line202)"></a>-<a name="(line203)"></a><a name="many"></a><font color=Blue>-- | 'many p' parses a list of elements with individual parser p.</font>-<a name="(line204)"></a><font color=Blue>-- Cannot fail, since an empty list is a valid return value.</font>-<a name="(line205)"></a>many <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line206)"></a>many p <font color=Red>=</font> many1 p <font color=Cyan>`onFail`</font> return []-<a name="(line207)"></a>-<a name="(line208)"></a><a name="many1"></a><font color=Blue>-- | Parse a non-empty list of items.</font>-<a name="(line209)"></a>many1 <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line210)"></a>many1 p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"In a sequence:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>.</font> indent <font color=Magenta>2</font><font color=Cyan>)</font>-<a name="(line211)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many p-<a name="(line212)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line213)"></a> <font color=Cyan>}</font>-<a name="(line214)"></a><font color=Blue>-- `adjustErr` ("When looking for a non-empty sequence:\n"++)</font>-<a name="(line215)"></a>-<a name="(line216)"></a><a name="sepBy"></a><font color=Blue>-- | Parse a list of items separated by discarded junk.</font>-<a name="(line217)"></a>sepBy <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line218)"></a>sepBy p sep <font color=Red>=</font> <font color=Green><u>do</u></font> sepBy1 p sep <font color=Cyan>`onFail`</font> return []-<a name="(line219)"></a>-<a name="(line220)"></a><a name="sepBy1"></a><font color=Blue>-- | Parse a non-empty list of items separated by discarded junk.</font>-<a name="(line221)"></a>sepBy1 <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line222)"></a>sepBy1 p sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font> x <font color=Red><-</font> p-<a name="(line223)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line224)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line225)"></a> <font color=Cyan>}</font>-<a name="(line226)"></a> <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for a non-empty sequence with separators:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line227)"></a> -<a name="(line228)"></a><a name="bracketSep"></a><font color=Blue>-- | Parse a list of items, discarding the start, end, and separator</font>-<a name="(line229)"></a><font color=Blue>-- items.</font>-<a name="(line230)"></a>bracketSep <font color=Red>::</font> Parser s t bra <font color=Red>-></font> Parser s t sep <font color=Red>-></font> Parser s t ket-<a name="(line231)"></a> <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line232)"></a>bracketSep open sep close p <font color=Red>=</font>-<a name="(line233)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open<font color=Cyan>;</font> close<font color=Cyan>;</font> return [] <font color=Cyan>}</font>-<a name="(line234)"></a> <font color=Cyan>`onFail`</font>-<a name="(line235)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line236)"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"After first bracket in a group:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line237)"></a> <font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font>-<a name="(line238)"></a> <font color=Cyan>;</font> close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"When looking for closing bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line239)"></a> <font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>-<a name="(line240)"></a> <font color=Cyan>}</font>-<a name="(line241)"></a>-<a name="(line242)"></a><a name="bracket"></a><font color=Blue>-- | Parse a bracketed item, discarding the brackets.</font>-<a name="(line243)"></a>bracket <font color=Red>::</font> Parser s t bra <font color=Red>-></font> Parser s t ket <font color=Red>-></font> Parser s t a <font color=Red>-></font> Parser s t a-<a name="(line244)"></a>bracket open close p <font color=Red>=</font> <font color=Green><u>do</u></font>-<a name="(line245)"></a> <font color=Green><u>do</u></font> <font color=Cyan>{</font> open <font color=Cyan>`adjustErr`</font> <font color=Cyan>(</font><font color=Magenta>"Missing opening bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line246)"></a> <font color=Cyan>;</font> x <font color=Red><-</font> p-<a name="(line247)"></a> <font color=Cyan>;</font> close <font color=Cyan>`adjustErrBad`</font> <font color=Cyan>(</font><font color=Magenta>"Missing closing bracket:\n"</font><font color=Cyan>++</font><font color=Cyan>)</font>-<a name="(line248)"></a> <font color=Cyan>;</font> return x-<a name="(line249)"></a> <font color=Cyan>}</font>-<a name="(line250)"></a>-<a name="(line251)"></a><a name="manyFinally"></a><font color=Blue>-- | 'manyFinally e t' parses a possibly-empty sequence of e's,</font>-<a name="(line252)"></a><font color=Blue>-- terminated by a t. Any parse failures could be due either to</font>-<a name="(line253)"></a><font color=Blue>-- a badly-formed terminator or a badly-formed element, so raise</font>-<a name="(line254)"></a><font color=Blue>-- both possible errors.</font>-<a name="(line255)"></a>manyFinally <font color=Red>::</font> Parser s t a <font color=Red>-></font> Parser s t z <font color=Red>-></font> Parser s t <font color=Red>[</font>a<font color=Red>]</font>-<a name="(line256)"></a>manyFinally pp<font color=Red>@</font><font color=Cyan>(</font>P p<font color=Cyan>)</font> pt<font color=Red>@</font><font color=Cyan>(</font>P t<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts <font color=Red>-></font>-<a name="(line257)"></a> <font color=Green><u>case</u></font> p s ts <font color=Green><u>of</u></font>-<a name="(line258)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>,</font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font>-<a name="(line259)"></a> <font color=Green><u>case</u></font> t s ts <font color=Green><u>of</u></font>-<a name="(line260)"></a> <font color=Cyan>(</font>Right <font color=Green><u>_</u></font><font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Right []<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line261)"></a> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>Left e<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font>-<a name="(line262)"></a> <font color=Cyan>(</font>Right x<font color=Cyan>,</font> s'<font color=Cyan>,</font> ts'<font color=Cyan>)</font> <font color=Red>-></font>-<a name="(line263)"></a> <font color=Green><u>let</u></font> <font color=Cyan>(</font>tail<font color=Cyan>,</font>s''<font color=Cyan>,</font>ts''<font color=Cyan>)</font> <font color=Red>=</font> runParser <font color=Cyan>(</font>manyFinally pp pt<font color=Cyan>)</font> s' ts'-<a name="(line264)"></a> <font color=Green><u>in</u></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>x<font color=Red><b>:</b></font>tail<font color=Cyan>)</font><font color=Cyan>,</font> s''<font color=Cyan>,</font> ts''<font color=Cyan>)</font> <font color=Cyan>)</font>-<a name="(line265)"></a>-<a name="(line266)"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line267)"></a><font color=Blue>-- State handling</font>-<a name="(line268)"></a>-<a name="(line269)"></a><a name="stUpdate"></a><font color=Blue>-- | Update the internal state.</font>-<a name="(line270)"></a>stUpdate <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>s<font color=Cyan>)</font> <font color=Red>-></font> Parser s t ()-<a name="(line271)"></a>stUpdate f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right ()<font color=Cyan>,</font> f s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line272)"></a>-<a name="(line273)"></a><a name="stQuery"></a><font color=Blue>-- | Query the internal state.</font>-<a name="(line274)"></a>stQuery <font color=Red>::</font> <font color=Cyan>(</font>s<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> Parser s t a-<a name="(line275)"></a>stQuery f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right <font color=Cyan>(</font>f s<font color=Cyan>)</font><font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line276)"></a>-<a name="(line277)"></a><a name="stGet"></a><font color=Blue>-- | Deliver the entire internal state.</font>-<a name="(line278)"></a>stGet <font color=Red>::</font> Parser s t s-<a name="(line279)"></a>stGet <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s ts<font color=Red>-></font> <font color=Cyan>(</font>Right s<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line280)"></a>-<a name="(line281)"></a><a name="reparse"></a><font color=Blue>------------------------------------------------------------------------</font>-<a name="(line282)"></a><font color=Blue>-- | Push some tokens back onto the front of the input stream and reparse.</font>-<a name="(line283)"></a><font color=Blue>-- This is useful e.g. for recursively expanding macros. When the</font>-<a name="(line284)"></a><font color=Blue>-- user-parser recognises a macro use, it can lookup the macro</font>-<a name="(line285)"></a><font color=Blue>-- expansion from the parse state, lex it, and then stuff the</font>-<a name="(line286)"></a><font color=Blue>-- lexed expansion back down into the parser.</font>-<a name="(line287)"></a>reparse <font color=Red>::</font> <font color=Red>[</font>t<font color=Red>]</font> <font color=Red>-></font> Parser s t ()-<a name="(line288)"></a>reparse ts <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>s inp<font color=Red>-></font> <font color=Cyan>(</font>Right ()<font color=Cyan>,</font> s<font color=Cyan>,</font> ts<font color=Cyan>++</font>inp<font color=Cyan>)</font><font color=Cyan>)</font>-<a name="(line289)"></a>-<a name="(line290)"></a><font color=Blue>------------------------------------------------------------------------</font>-</pre>-</html>
− docs/index.html
@@ -1,317 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-<html>-<head>-<title>- polyparse: alternative parser combinator libraries-</title>-</head>--<body bgcolor='#ffffff'>--<center>-<h1>polyparse</h1>-<table><tr><td width=200 align=center>-<a href="#what">What is polyparse?</a><br>-<a href="#how">How do I use it?</a><br>-<a href="#download">Downloads</a><br>-</td><td width=200 align=center>-<a href="#news">Recent news</a><br>-<a href="#who">Contacts</a><br>-<a href="#related">Related Work</a><br>-</td></tr></table>-</center>--<hr>-<center><h3><a name="what">What is polyparse?</a></h3></center>-<p>-<b>polyparse</b> is a collection of parser combinator libraries in-Haskell. It is distributed as a package, but you are likely to use only-one of the included modules at any one time - they are generally-alternatives to each other, as well as an alternative to other-widely-used parser libraries available elsewhere.--<ul>-<li> <b>Text.Parse</b> The Text.Read class from Haskell'98 is widely- recognised to have many problems. It is inefficient. If a read- fails, there is no indication of why. Worst of all, a read failure- crashes your whole program! Text.Parse is a proposed replacement- for the Read class. It defines a new class, Parse, with methods- that return an explicit notification of errors, through the Either- type. It also defines a number of useful helper functions to- enable the construction of parsers for textual representations of- Haskell data structures, e.g. named fields. Unsurprisingly,- Text.Parse is really just a specialisation of the Poly combinators- for String input, and the entire Poly API is also re-exported.- The <a href="http://repetae.net/~john/computer/haskell/DrIFT">DrIFT</a>- tool can derive instances of the Parse class for you- automatically. (Use the syntax <tt>{-! derive : Parse !-}</tt>)-<li> <b>Text.ParserCombinators.Poly</b>- Currently re-exports Text.ParserCombinators.Poly.Plain.- The name Poly comes from the arbitrary token type. Thus, you can- write your own lexer if you wish, rather than needing to encode- lexical analysis within the parser itself.-<li> <b>Text.ParserCombinators.Poly.Plain</b> This is a fresh- set of combinators, improving on the HuttonMeijer variety by- keeping only a single success, not a list of them. This is- more space-efficient, whilst still permitting backtracking.- Error-handling is also much improved: there are essentially two- kinds of failure, soft and hard. Soft failure just means that the- current parse did not work out, but another parse might be OK.- Hard failure means that no parse will succeed, because we have- already passed a point of commitment. Thus you can give far more- accurate error messages to the user, including multi-layered- locations.-<li> <b>Text.ParserCombinators.Poly.State</b> is just like Poly, except it- adds an arbitrary running state parameter.-<li> <b>Text.ParserCombinators.Poly.Lazy</b> is just like Poly, except it- does not return explicit failures. Instead, an exception is raised.- Thus, it can return a partial parse result, before a full parse is- complete. The word partial indicates that, having committed to- return some outer data constructor, we might later discover some- parse error further inside, so the value will be partial, as in- incomplete: containing bottom. However, if you are confident that- the input is error-free, then you will gain hugely in- space-efficiency - essentially you can stream-process your parsed- data-structure within very small constant space. This is especially- useful for large structures like e.g. XML trees.-<li> <b>Text.ParserCombinators.Poly.StateLazy</b> combines Poly.State and- Poly.Lazy.-<li> <b>Text.ParserCombinators.Poly.Base</b>- All of the Poly variations (Plain, Lazy, State, etc)- share a lot in common: many of the- combinators are indeed implemented identically. To reduce code- duplication in the library, we provide a class-based interface- here. The actual implementations for strict, lazy, and so on, are- instances of the class, defined in modules at the same level in the- hierarchy (e.g. T.P.Poly.Lazy etc). Every individual variation- re-exports these base combinators, so there should be no need to- import this module directly.-<li> <b>Text.ParserCombinators.HuttonMeijer</b> The most venerable of all- monadic parser combinator libraries, this version dates from 1996.- Originally distributed with Gofer, then Hugs, as ParseLib. It uses- the idea of "failure as a list of successes" to give multiple- possible parses through backtracking. (But in practice, almost- nobody wants any parse except the first complete one.)-<li> <b>Text.ParserCombinators.HuttonMeijerWallace</b> The- Hutton/Meijer combinators, extended to take an arbitrary token type- as input (not just characters), plus a running state (e.g. to- collect a symbol table, or macros), plus some facilities for- simple error-reporting.-</ul>-<p>-All the <b>Poly*</b> variations share the same basic API, so it is easy-to switch from one set to another, when you discover you need an extra-facility, just by changing a single import.--<hr>-<center><h3><a name="how">How do I use it?</a></h3></center>-<p>-<a href="haddock/index.html">Detailed documentation of the polyparse APIs</a>-is generated automatically by Haddock directly from the source code.--<p>-In general, you can just add an import of the relevant module to your-source code, and everything should just compile OK. However, if the-package is not 'exposed' (in ghc-pkg terminology), then you might need-to use a command-line option <tt>--package polyparse</tt> at compile-time.--<p>-The original Hutton/Meijer combinators are described in a very nice-tutorial tech report:-<a href="http://eprints.nottingham.ac.uk/archive/00000237/">NOTTCS-TR-96-4</a>--<p>-I wrote some motivation for <tt>Text.Parse</tt> (including simple examples)-on my blog a while back. <a href="http://nhc98.blogspot.com/2005/11/replacement-for-read-class.html">Here is the posting.</a>--<p>-If you are familiar with the Parsec library, then the key insight for-using PolyParse is that the two libraries' approach to backtracking are-the duals of each another. In Parsec, you must explicitly add a-<tt>try</tt> combinator at any location where backtracking might be-necessary. Users often find this a bit of a black art. In PolyParse-by contrast, all parsers are backtracking unless you explicitly add a-<tt>commit</tt> (or one of its variations). It is easy to tell where to-add a commit point, because you have already parsed enough of a data-structure to know that only one outcome is possible. For instance, if-you are parsing a Haskell value produced by 'show', then as soon as you-have parsed the initial constructor, you know that no other constructor-of that datatype is possible, so you can commit to returning it.--<p>-User-contributed documentation for polyparse is on the Haskell wiki at:-<a href="http://haskell.org/haskellwiki/Polyparse">http://haskell.org/haskellwiki/Polyparse</a>-Please edit the wiki if you discover any nice tricks!--<p>-<b>Known problems:</b>-<ul>-<li> No problems currently known.-<li> Report bugs to <tt>Malcolm.Wallace@cs.york.ac.uk</tt>-<li> Even better, fix any bugs you find, and then <tt>darcs send</tt> a patch.-</ul>--<hr>-<center><h3><a name="download">Downloads</a></h3></center>-<p>-<b>Development version:</b><br>-<br><tt><a href="http://darcs.net/">darcs</a> get- http://www.cs.york.ac.uk/fp/darcs/polyparse</tt>--<p>-<b>Current released version:</b><br>-polyparse-1.3, release date 2009.03.09<br>-By HTTP:-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.3.tar.gz">.tar.gz</a>,-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.3.zip">.zip</a>.-<br>-By FTP: -<a href="ftp://ftp.cs.york.ac.uk/pub/haskell/polyparse/">-ftp://ftp.cs.york.ac.uk/pub/haskell/polyparse/</a>--<p>-<b>Older versions:</b><br>-polyparse-1.2, release date 2009.03.04<br>-By HTTP:-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.2.tar.gz">.tar.gz</a>,-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.2.zip">.zip</a>.-<br>-polyparse-1.1, release date 2007.10.23<br>-By HTTP:-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.1.tar.gz">.tar.gz</a>,-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.1.zip">.zip</a>.-<br>-polyparse-1.0, release date 2007.01.26<br>-By HTTP:-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.0.tar.gz">.tar.gz</a>,-<a href="http://www.cs.york.ac.uk/fp/polyparse/polyparse-1.0.zip">.zip</a>.-<br>-All older versions by FTP: -<a href="ftp://ftp.cs.york.ac.uk/pub/haskell/polyparse/">-ftp://ftp.cs.york.ac.uk/pub/haskell/polyparse/</a>---<hr>-<center><h3><a name="install">Installation</a></h3></center>-<p>-To install polyparse, you must have a Haskell compiler: <em>ghc-6.2</em>-or later, and/or <em>nhc98-1.16/hmake-3.06</em> or later, and/or-<em>Hugs98 (Sept 2003)</em> or later. For more recent compilers,-use the standard Cabal method of installation:-<pre>- runhaskell Setup.hs configure [--prefix=...] [--buildwith=...]- runhaskell Setup.hs build- runhaskell Setup.hs install-</pre>--For older compilers, use:-<pre>- sh configure [--prefix=...] [--buildwith=...]- make- make install-</pre>-to configure, build, and install polyparse as a package for your-compiler(s). If you don't use the --prefix option, you may need write-permission on the library installation directories of your compiler(s).-Afterwards, to gain access to the polyparse libraries, you only need to-add the option <tt>-package polyparse</tt> to your compiler commandline-(no option required for Hugs).--<hr>-<center><h3><a name="news">Recent news</a></h3></center>-<p>-Version 1.3 has a single bugfix: Text.Parse.parseFloat now accepts-ordinary floating point notation, in addition to scientific (exponent)-notation.--<p>-Version 1.2 improves the Text.Parse implementation significantly. Where-previously all the parsers for builtin basic datatype (Int,Float,Char)-were just thin wrappers over the H'98 Read instances, now they are all-proper parsers, therefore they should (a) be faster; (b) give better-error messages.--<p>-Version 1.1 much improves the laziness characteristics of the Poly*-combinators. There are also a lot of new implementations of the Poly*-parser types, all of which attempt to preserve exactly the same-combinator interface, so it is easy to switch between them.--<p>-Version 1.00 is the first release of polyparse as a separate package.-It was previously part of the HaXml suite. HaXml continues to use-polyparse, but polyparse will be useful more widely. If you are looking-for examples of the usage of polyparse, the implementations of-Text.XML.HaXml.Parse, Text.XML.HaXml.ParseLazy, and-Text.XML.HaXml.XmlContent are good places to look.--<br>-<a href="changelog.html">Complete Changelog</a><br>--<hr>-<center><h3><a name="who">Contacts</a></h3></center>-<p>-We are interested in hearing your feedback on these parser combinators --suggestions for improvements, comments, criticisms, bug reports. Please mail-<ul>-<li> <a href="mailto:Malcolm.Wallace@cs.york.ac.uk">- Malcolm.Wallace@cs.york.ac.uk</a>-</ul>--<p>--<p><b>Licence:</b> The library is Free and Open Source Software,-i.e., the bits we wrote are copyright to us, but freely licensed-for your use, modification, and re-distribution, provided you don't-restrict anyone else's use of it. The polyparse library is distributed-under the GNU Lesser General Public Licence (LGPL) - see file-<a href="LICENCE-LGPL">LICENCE-LGPL</a> for more details. We allow one-special exception to the LGPL - see <a href="COPYRIGHT">COPYRIGHT</a>.-(If you don't like any of these licensing conditions, please contact us-to discuss your requirements.)--<hr>-<p>-<center><h3><a name="related">Related work</a></h3></center>-<ul>-<li>-Parser combinators have a long history in Haskell. The first(?) monadic-combinator tutorial was introduced by-<a href="http://eprints.nottingham.ac.uk/archive/00000237/">Hutton and-Meijer</a> in 1996, and the accompanying library was distributed with-Gofer (a precursor to Hugs), and known simply as ParseLib. That library-lives on here as Text.ParserCombinators.HuttonMeijer.--<li>-<a href="http://www.cs.chalmers.se/~rojemo/thesis.html">Niklas Rojemo's-combinators.</a> The parser combinators developed and used in the-implementation of the nhc98 compiler are monadic and space-efficient.-However, they do not use the standard do-notation, because in fact they-are more general than the standard monad category.--<li>-<a href="http://research.microsoft.com/~emeijer/Papers/Parsec.pdf">-Daan Leijen's parsec.</a> The parsec library is widely used, since it is-distributed with ghc. Its combinators are fairly robust, but you need-to place explicit backtracking into your parsers, using the <tt>try</tt>-operator. This can be tricky.--<li><a href="http://www.cs.uu.nl/wiki/HUT/ParserCombinators">Doaitse-Swierstra's UU_Parse.</a>-An all-singing, all-dancing parsing library. Deeply sophisticated.-Allows on-line results, which is closely related to lazy parsing.--<li><a href="http://cvs.haskell.org/Hugs/pages/libraries/base/Text-ParserCombinators-ReadP.html">Koen Claessen's ReadP.</a>-This is a different proposed replacement for the standard Haskell'98-Read class. It is a whole lot more efficient that Read, but because it-is also API-compatible with Read, that unfortunately means it suffers-from not giving good error messages. Also, it requires rank-2 types,-which is a non-Haskell'98 extension.--</ul>--<hr>--</body>-</html>
polyparse.cabal view
@@ -1,7 +1,5 @@ name: polyparse-version: 1.3-cpp-options: -DVERSION="1.3"-nhc98-options: -K6M+version: 1.4 license: LGPL license-file: COPYRIGHT author: Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk>@@ -16,17 +14,27 @@ parsing, and so on. Finally, Text.Parse is a proposed replacement for the standard Read class, for better deserialisation of Haskell values from Strings.-exposed-modules:- Text.ParserCombinators.HuttonMeijer,- Text.ParserCombinators.HuttonMeijerWallace,- Text.ParserCombinators.Poly,- Text.ParserCombinators.Poly.Base,- Text.ParserCombinators.Poly.Plain,- Text.ParserCombinators.Poly.Lazy,- Text.ParserCombinators.Poly.State,- Text.ParserCombinators.Poly.StateLazy,- Text.Parse-hs-source-dirs: src-build-depends: base, haskell98 build-type: Simple-extensions: CPP+cabal-version: >=1.2++library+ hs-source-dirs: src+ build-depends: base <= 6, haskell98+ exposed-modules:+ Text.ParserCombinators.HuttonMeijer,+ Text.ParserCombinators.HuttonMeijerWallace,+ Text.ParserCombinators.Poly,+ Text.ParserCombinators.Poly.Base,+ Text.ParserCombinators.Poly.Plain,+ Text.ParserCombinators.Poly.Lazy,+ Text.ParserCombinators.Poly.State,+ Text.ParserCombinators.Poly.StateLazy,+ Text.Parse+ if impl(ghc)+ build-depends: bytestring+ exposed-modules:+ Text.ParserCombinators.Poly.ByteString,+ Text.Parse.ByteString+ cpp-options: -DVERSION="1.4"+ nhc98-options: -K6M+ extensions: CPP
− script/echo.c
@@ -1,20 +0,0 @@-#include <stdio.h>--int main (int argc, char** argv) {- int i=0;- if (argc>1) {- if (strcmp(argv[1],"-n")==0) {- for (i=2; i<argc; i++) {- fputs(argv[i],stdout);- if (i+1!=argc) putchar(' ');- }- } else {- for (i=1; i<argc; i++) {- fputs(argv[i],stdout);- if (i+1!=argc) putchar(' ');- }- putchar('\n');- }- } else putchar('\n');- exit(0);-}
− src/Makefile
@@ -1,86 +0,0 @@-SOFTWARE = polyparse-VERSION = 1.3--LIBSRCS = \- Text/ParserCombinators/HuttonMeijer.hs \- Text/ParserCombinators/HuttonMeijerWallace.hs \- Text/ParserCombinators/Poly.hs \- Text/ParserCombinators/Poly/Base.hs \- Text/ParserCombinators/Poly/Plain.hs \- Text/ParserCombinators/Poly/Lazy.hs \- Text/ParserCombinators/Poly/State.hs \- Text/ParserCombinators/Poly/StateLazy.hs \- Text/Parse.hs \--LIBOBJS = $(patsubst %.hs, %.o, $(LIBSRCS))--OUT = $(shell cat ../out)-INSTALLDIR = $(shell cat ../prefix)-WHOLEARCHIVE = $(shell cat ../ldopt)--# The caller *must* set the HC variable.-COMPILER := $(findstring ghc, $(HC))-ifeq "$(COMPILER)" "ghc"-COMPILE = $(HC) --make -cpp -i. $(shell cat ghcpkgs) \- -package-name $(SOFTWARE)-$(VERSION) -DVERSION=$(VERSION)-RENAME = mv $(OUT)-endif-COMPILER := $(findstring nhc98, $(HC))-ifeq "$(COMPILER)" "nhc98"-COMPILE = hmake -hc=$(HC) -I. -K4M +CTS -H8M -CTS -package base \- -DVERSION=$(VERSION)-RENAME = echo Built-endif--.PHONY: all libs--all: libs toolset-toolset:- #cp $(TOOLSET) $(INSTALLDIR)-libs: libHS$(SOFTWARE).a-install-filesonly-ghc: libs $(INSTALLDIR)- cp libHS$(SOFTWARE).a `cat ghclibdir`- -ranlib `cat ghclibdir`/libHS$(SOFTWARE).a # ignore if fails on Linux- -cp HS$(SOFTWARE).o `cat ghclibdir` # file may not exist on MacOS X- rm -rf `cat ghcincdir`/$(SOFTWARE)- mkdir -p `cat ghcincdir`/$(SOFTWARE)- cp interfaces.tar `cat ghcincdir`/$(SOFTWARE)- cd `cat ghcincdir`/$(SOFTWARE); tar xf interfaces.tar; rm interfaces.tar-install-filesonly-nhc98: libs $(INSTALLDIR)- cp libHS$(SOFTWARE).a `cat nhc98libdir`/`harch`- -ranlib `cat nhc98libdir`/`harch`/libHS$(SOFTWARE).a- rm -rf `cat nhc98incdir`/packages/$(SOFTWARE)- mkdir -p `cat nhc98incdir`/packages/$(SOFTWARE)- cp interfaces.tar `cat nhc98incdir`/packages/$(SOFTWARE)- cd `cat nhc98incdir`/packages/$(SOFTWARE); tar xf interfaces.tar; rm interfaces.tar-install-ghc: install-filesonly-ghc $(SOFTWARE).pkgconf- `cat ghcpkgcmd` --remove-package=$(SOFTWARE) || true # ignore any error- `cat ghcpkgcmd` --add-package <pkg.conf || \- `cat ghcpkgcmd` register $(SOFTWARE).pkgconf- @echo "you can safely ignore any errors from --add-package"-install-nhc98: install-filesonly-nhc98-install-tools-hugs: toolset-hugs $(INSTALLDIR)- cp $(patsubst ../../%, %, ${TOOLSET}) $(INSTALLDIR)--# update the sources if necessary-$(LIBSRCS) $(TOOLSRCS) Makefile: %: ../../src/%- cp $< $@-$(SOFTWARE).pkgconf: ../../$(SOFTWARE).cabal ghcincdirraw ghclibdirraw- cp ../../$(SOFTWARE).cabal $@- echo "import-dirs: `cat ghcincdirraw`$(SOFTWARE)" >>$@- echo "library-dirs: `cat ghclibdirraw`" >>$@- echo "depends: base, haskell98" >>$@- echo "hs-libraries: HS$(SOFTWARE)" >>$@----# packaged library-libHS$(SOFTWARE).a: $(LIBSRCS)- $(COMPILE) $(LIBSRCS)- ar r libHS$(SOFTWARE).a $(LIBOBJS)- -ld -r $(WHOLEARCHIVE) -o $(SOFTWARE).o libHS$(SOFTWARE).a # for GHCi only- tar cf interfaces.tar `find Text -name *.hi -print`--$(INSTALLDIR):- if [ ! -d $(INSTALLDIR) ] ; then mkdir -p $(INSTALLDIR); fi-
src/Text/Parse.hs view
@@ -5,6 +5,8 @@ , Parse(..) -- instances: (), (a,b), (a,b,c), Maybe a, Either a, [a], -- Int, Integer, Float, Double, Char, Bool , parseByRead -- :: Read a => String -> TextParser a+ , readByParse -- :: TextParser a -> ReadS a+ , readsPrecByParsePrec -- :: (Int->TextParser a) -> Int -> ReadS a -- ** Combinators specific to string input, lexed haskell-style , word -- :: TextParser String , isWord -- :: String -> TextParser ()@@ -26,7 +28,7 @@ ) where import Char (isSpace,toLower,isUpper,isDigit,isOctDigit,isHexDigit,digitToInt- ,ord,chr)+ ,isAlpha,isAlphaNum,ord,chr) import List (intersperse) import Ratio import Text.ParserCombinators.Poly@@ -78,9 +80,78 @@ _ -> Failure s ("ambiguous parse, expected a "++name) ) --- | One lexical chunk (Haskell-style lexing).+-- | If you have a TextParser for a type, you can easily make it into+-- a Read instance, by throwing away any error messages.+readByParse :: TextParser a -> ReadS a+readByParse p = \inp->+ case runParser p inp of+ (Left err, rest) -> []+ (Right val, rest) -> [(val,rest)]++-- | If you have a TextParser for a type, you can easily make it into+-- a Read instance, by throwing away any error messages.+readsPrecByParsePrec :: (Int -> TextParser a) -> Int -> ReadS a+readsPrecByParsePrec p = \prec inp->+ case runParser (p prec) inp of+ (Left err, rest) -> []+ (Right val, rest) -> [(val,rest)]++-- | One lexical chunk. This is Haskell'98-style lexing - the result+-- should match Prelude.lex apart from better error-reporting. word :: TextParser String-word = P (\s-> case lex s of+word = P p+ where+ p "" = Failure "" "end of input"+ p (c:s) | isSpace c = p (dropWhile isSpace s)+ p ('\'':s) = let (P lit) = parseLitChar in fmap show (lit ('\'':s))+ p ('"':s) = lexString "\"" s+ where lexString acc ('"':s) = Success s (reverse ('"':acc))+ lexString acc ('\\':'"':s) = lexString ("\"\\"++acc) s+ lexString acc (c:s) = lexString (c:acc) s+ lexString acc [] = Failure [] ("end of input in "+ ++"string literal "+ ++acc)+ p ('0':'x':s) = Success t ('0':'x':ds) where (ds,t) = span isHexDigit s+ p ('0':'X':s) = Success t ('0':'X':ds) where (ds,t) = span isHexDigit s+ p ('0':'o':s) = Success t ('0':'o':ds) where (ds,t) = span isOctDigit s+ p ('0':'O':s) = Success t ('0':'O':ds) where (ds,t) = span isOctDigit s+ p (c:s) | isSingle c = Success s [c]+ | isSym c = let (sym,t) = span isSym s in Success t (c:sym)+ | isIdInit c = let (nam,t) = span isIdChar s in Success t (c:nam)+ | isDigit c = let (ds,t) = span isDigit s in+ lexFracExp (c:ds) t+ | otherwise = Failure (c:s) ("Bad character: "++show c)+ where isSingle c = c `elem` ",;()[]{}`"+ isSym c = c `elem` "!@#$%&*+./<=>?\\^|:-~"+ isIdInit c = isAlpha c || c == '_'+ isIdChar c = isAlphaNum c || c `elem` "_'"+ lexFracExp acc ('.':d:s) | isDigit d =+ lexExp (acc++'.':d:ds) t+ where (ds,t) = span isDigit s+ lexFracExp acc s = lexExp acc s+ lexExp acc (e:s) | e`elem`"eE" =+ case s of+ ('+':d:t) | isDigit d ->+ let (ds,u)=span isDigit t in+ Success u (acc++"e+"++d:ds)+ ('-':d:t) | isDigit d ->+ let (ds,u)=span isDigit t in+ Success u (acc++"e-"++d:ds)+ (d:t) |isDigit d ->+ let (ds,u)=span isDigit t in+ Success u (acc++"e"++d:ds)+ _ -> Failure s ("missing +/-/digit "+ ++"after e in float "+ ++"literal: "+ ++show (acc++"e"++"..."))+ lexExp acc s = Success s acc++++-- | One lexical chunk (Haskell'98-style lexing - the result should match+-- Prelude.lex apart from error-reporting).+oldword :: TextParser String+oldword = P (\s-> case lex s of [] -> Failure s ("no input? (impossible)") [("","")] -> Failure "" ("no input?") [("",s')] -> Failure s ("lexing failed?")@@ -122,23 +193,6 @@ } ) -{---- | Parse an infix constructor.-infixConstructor :: (Parse a, Parse b) =>- String -> Int -> (a->b->c) -> Int -> TextParser c-infixConstructor name prec cons = \d->- parens (prec<d) (do a <- parsePrec (prec+1)- isWord name `adjustErr`- (++("expected infix constructor "++name))- b <- parsePrec (prec+1)- return (cons a b) )----infixLeftAssoc :: (Parse a, Parse b) =>--- String -> Int -> (a->b->a) -> Int -> TextParser a---infixLeftAssoc name prec cons = \d->--- parens (prec<d) (do a <- --}- -- | Parse one of the given nullary constructors (an enumeration). -- The string argument is the name of the type, and the list argument -- should contain all of the possible enumeration values.@@ -160,13 +214,13 @@ parseInt :: (Integral a) => String -> a -> (Char -> Bool) -> (Char -> Int) ->- a -> TextParser a-parseInt base radix isDigit digitToInt n = go n- where go acc = do cs <- many1 (satisfy isDigit)+ TextParser a+parseInt base radix isDigit digitToInt =+ do cs <- many1 (satisfy isDigit) return (foldl1 (\n d-> n*radix+d) (map (fromIntegral.digitToInt) cs)) `adjustErr` (++("\nexpected one or more "++base++" digits"))-parseDec, parseOct, parseHex :: (Integral a) => a -> TextParser a+parseDec, parseOct, parseHex :: (Integral a) => TextParser a parseDec = parseInt "decimal" 10 Char.isDigit Char.digitToInt parseOct = parseInt "octal" 8 Char.isOctDigit Char.digitToInt parseHex = parseInt "hex" 16 Char.isHexDigit Char.digitToInt@@ -177,11 +231,10 @@ many (satisfy isDigit) `adjustErrBad` (++"expected digit after .") `onFail` return [] )- exp <- if null frac then exponent- else exponent `onFail` return 0+ exp <- exponent `onFail` return 0 ( return . fromRational . (* (10^^(exp - length frac))) . (%1) . (\ (Right x)->x) . fst- . runParser (parseDec 0) ) (ds++frac)+ . runParser parseDec ) (ds++frac) `onFail` do w <- many (satisfy (not.isSpace)) case map toLower w of@@ -189,9 +242,9 @@ "infinity" -> return (1/0) _ -> fail "expected a floating point number" where exponent = do 'e' <- fmap toLower next- commit (do '+' <- next; parseDec 0+ commit (do '+' <- next; parseDec `onFail`- parseSigned (parseDec 0) )+ parseSigned parseDec ) parseLitChar :: TextParser Char parseLitChar = do '\'' <- next `adjustErr` (++"expected a literal char")@@ -219,9 +272,9 @@ else fail ("literal char ctrl-escape malformed: \\^" ++[ctrl]) escape d | isDigit d- = fmap chr $ parseDec (Char.digitToInt d)- escape 'o' = fmap chr $ parseOct 0- escape 'x' = fmap chr $ parseHex 0+ = fmap chr $ (reparse [d] >> parseDec)+ escape 'o' = fmap chr $ parseOct+ escape 'x' = fmap chr $ parseHex escape c | isUpper c = mnemonic c escape c = fail ("unrecognised escape sequence in literal char: \\"++[c])@@ -300,10 +353,10 @@ instance Parse Int where -- parse = parseByRead "Int" -- convert from Integer, deals with minInt parse = fmap fromInteger $- do many (satisfy isSpace); parseSigned (parseDec 0)+ do many (satisfy isSpace); parseSigned parseDec instance Parse Integer where -- parse = parseByRead "Integer"- parse = do many (satisfy isSpace); parseSigned (parseDec 0)+ parse = do many (satisfy isSpace); parseSigned parseDec instance Parse Float where -- parse = parseByRead "Float" parse = do many (satisfy isSpace); parseSigned parseFloat
+ src/Text/Parse/ByteString.hs view
@@ -0,0 +1,407 @@+module Text.Parse.ByteString+ ( -- * The Parse class is a replacement for the standard Read class. + -- This particular instance reads from ByteString rather than String.+ -- $parser+ TextParser -- synonym for Text.ParserCombinators.Poly.ByteString+ , Parse(..) -- instances: (), (a,b), (a,b,c), Maybe a, Either a, [a],+ -- Int, Integer, Float, Double, Char, Bool+ , parseByRead -- :: Read a => String -> TextParser a+ , readByParse -- :: TextParser a -> ReadS a+ , readsPrecByParsePrec -- :: (Int->TextParser a) -> Int -> ReadS a+ -- ** Combinators specific to string input, lexed haskell-style+ , word -- :: TextParser String+ , isWord -- :: String -> TextParser ()+ , optionalParens -- :: TextParser a -> TextParser a+ , parens -- :: Bool -> TextParser a -> TextParser a+ , field -- :: Parse a => String -> TextParser a+ , constructors-- :: [(String,TextParser a)] -> TextParser a+ , enumeration -- :: Show a => String -> [a] -> TextParser a+ -- ** Parsers for literal numerics and characters+ , parseSigned+ , parseInt+ , parseDec+ , parseOct+ , parseHex+ , parseUnsignedInteger+ , parseFloat+ , parseLitChar+ -- ** Re-export all the more general combinators from Poly too+ , module Text.ParserCombinators.Poly.ByteString+ -- ** ByteStrings and Strings as whole entities+ , allAsByteString+ , allAsString+ ) where++import Char (isSpace,toLower,isUpper,isDigit,isOctDigit,isHexDigit,digitToInt+ ,ord,chr)+import List (intersperse)+import Ratio+import qualified Data.ByteString.Lazy.Char8 as BS+import Data.ByteString.Lazy.Char8 (ByteString)+import Text.ParserCombinators.Poly.ByteString++------------------------------------------------------------------------+-- $parser+-- The Parse class is a replacement for the standard Read class. It is a+-- specialisation of the (poly) Parser monad for ByteString input.+-- There are instances defined for all Prelude types.+-- For user-defined types, you can write your own instance, or use+-- DrIFT to generate them automatically, e.g. {-! derive : Parse !-}++-- | A synonym for a ByteString Parser, i.e. bytestring input (no state)+type TextParser a = Parser a++-- | The class @Parse@ is a replacement for @Read@, operating over String input.+-- Essentially, it permits better error messages for why something failed to+-- parse. It is rather important that @parse@ can read back exactly what+-- is generated by the corresponding instance of @show@. To apply a parser+-- to some text, use @runParser@.+class Parse a where+ -- | A straightforward parser for an item. (A minimal definition of+ -- a class instance requires either |parse| or |parsePrec|.)+ parse :: TextParser a+ parse = parsePrec 0+ -- | A straightforward parser for an item, given the precedence of+ -- any surrounding expression. (Precedence determines whether+ -- parentheses are mandatory or optional.)+ parsePrec :: Int -> TextParser a+ parsePrec _ = parens False parse+ -- | Parsing a list of items by default accepts the [] and comma syntax,+ -- except when the list is really a character string using \"\".+ parseList :: TextParser [a] -- only to distinguish [] and ""+ parseList = do { isWord "[]"; return [] }+ `onFail`+ do { isWord "["; isWord "]"; return [] }+ `onFail`+ bracketSep (isWord "[") (isWord ",") (isWord "]") parse+ `adjustErr` ("Expected a list, but\n"++)++-- | If there already exists a Read instance for a type, then we can make+-- a Parser for it, but with only poor error-reporting. The string argument+-- is the expected type or value (for error-reporting only). Use of this+-- wrapper function is NOT recommended with ByteString, because there+-- is a lot of inefficiency in repeated conversions to/from String.+parseByRead :: Read a => String -> TextParser a+parseByRead name =+ P (\s-> case reads (BS.unpack s) of+ [] -> Failure s ("no parse, expected a "++name)+ [(a,s')] -> Success (BS.pack s') a+ _ -> Failure s ("ambiguous parse, expected a "++name)+ )++-- | If you have a TextParser for a type, you can easily make it into+-- a Read instance, by throwing away any error messages. Use of this+-- wrapper function is NOT recommended with ByteString, because there+-- is a lot of inefficiency in conversions to/from String.+readByParse :: TextParser a -> ReadS a+readByParse p = \inp->+ case runParser p (BS.pack inp) of+ (Left err, rest) -> []+ (Right val, rest) -> [(val, BS.unpack rest)]++-- | If you have a TextParser for a type, you can easily make it into+-- a Read instance, by throwing away any error messages. Use of this+-- wrapper function is NOT recommended with ByteString, because there+-- is a lot of inefficiency in conversions to/from String.+readsPrecByParsePrec :: (Int -> TextParser a) -> Int -> ReadS a+readsPrecByParsePrec p = \prec inp->+ case runParser (p prec) (BS.pack inp) of+ (Left err, rest) -> []+ (Right val, rest) -> [(val, BS.unpack rest)]+++-- | One lexical chunk (Haskell-style lexing).+word :: TextParser String+word = P (\s-> case lex (BS.unpack s) of+ [] -> Failure s ("no input? (impossible)")+ [("","")] -> Failure s ("no input?")+ [("",_)] -> Failure s ("lexing failed?")+ ((x,_):_) -> Success (BS.drop (fromIntegral (length x)) s) x+ )++-- | Ensure that the next input word is the given string. (Note the input+-- is lexed as haskell, so wordbreaks at spaces, symbols, etc.)+isWord :: String -> TextParser String+isWord w = do { w' <- word+ ; if w'==w then return w else fail ("expected "++w++" got "++w')+ }++-- | Allow true string parens around an item.+optionalParens :: TextParser a -> TextParser a+optionalParens p = bracket (isWord "(") (isWord ")") p `onFail` p++-- | Allow nested parens around an item (one set required when Bool is True).+parens :: Bool -> TextParser a -> TextParser a+parens True p = bracket (isWord "(") (isWord ")") (parens False p)+parens False p = parens True p `onFail` p++-- | Deal with named field syntax. The string argument is the field name,+-- and the parser returns the value of the field.+field :: Parse a => String -> TextParser a+field name = do { isWord name; commit $ do { isWord "="; parse } }++-- | Parse one of a bunch of alternative constructors. In the list argument,+-- the first element of the pair is the constructor name, and+-- the second is the parser for the rest of the value. The first matching+-- parse is returned.+constructors :: [(String,TextParser a)] -> TextParser a+constructors cs = oneOf' (map cons cs)+ where cons (name,p) =+ ( name+ , do { isWord name+ ; p `adjustErrBad` (("got constructor, but within "+ ++name++",\n")++)+ }+ )++-- | Parse one of the given nullary constructors (an enumeration).+-- The string argument is the name of the type, and the list argument+-- should contain all of the possible enumeration values.+enumeration :: (Show a) => String -> [a] -> TextParser a+enumeration typ cs = oneOf (map (\c-> do { isWord (show c); return c }) cs)+ `adjustErr`+ (++("\n expected "++typ++" value ("++e++")"))+ where e = concat (intersperse ", " (map show (init cs)))+ ++ ", or " ++ show (last cs)++------------------------------------------------------------------------+-- Instances for all the Standard Prelude types.++-- Numeric types+parseSigned :: Real a => TextParser a -> TextParser a+parseSigned p = do '-' <- next; commit (fmap negate p)+ `onFail`+ do p++parseInt :: (Integral a) => String ->+ a -> (Char -> Bool) -> (Char -> Int) ->+ TextParser a+parseInt base radix isDigit digitToInt =+ do cs <- many1 (satisfy isDigit)+ return (foldl1 (\n d-> n*radix+d)+ (map (fromIntegral.digitToInt) cs))+ `adjustErr` (++("\nexpected one or more "++base++" digits"))+parseDec, parseOct, parseHex :: (Integral a) => TextParser a+parseDec = parseInt "decimal" 10 Char.isDigit Char.digitToInt+parseOct = parseInt "octal" 8 Char.isOctDigit Char.digitToInt+parseHex = parseInt "hex" 16 Char.isHexDigit Char.digitToInt++-- | parseUnsignedInteger uses the underlying ByteString readInteger, so+-- will be a lot faster than the generic character-by-character parseInt.+parseUnsignedInteger :: TextParser Integer+parseUnsignedInteger = P (\bs -> case BS.uncons bs of+ Just (c, _)+ | Char.isDigit c ->+ case BS.readInteger bs of+ Just (i, bs') -> Success bs' i+ Nothing -> error "XXX Can't happen"+ _ -> Failure bs "parsing Integer: not a digit")+ `adjustErr` (++("\nexpected one or more decimal digits"))+++parseFloat :: (RealFrac a) => TextParser a+parseFloat = do ds <- many1 (satisfy isDigit)+ frac <- (do '.' <- next+ many (satisfy isDigit)+ `adjustErrBad` (++"expected digit after .")+ `onFail` return [] )+ exp <- exponent `onFail` return 0+ ( return . fromRational . (* (10^^(exp - length frac)))+ . (%1) . (\ (Right x)->x) . fst+ . runParser parseDec ) (BS.pack (ds++frac))+ `onFail`+ do w <- many (satisfy (not.isSpace))+ case map toLower w of+ "nan" -> return (0/0)+ "infinity" -> return (1/0)+ _ -> fail "expected a floating point number"+ where exponent = do 'e' <- fmap toLower next+ commit (do '+' <- next; parseDec+ `onFail`+ parseSigned parseDec )++parseLitChar :: TextParser Char+parseLitChar = do '\'' <- next `adjustErr` (++"expected a literal char")+ c <- next+ char <- case c of+ '\\' -> next >>= escape+ '\'' -> fail "expected a literal char, got ''"+ _ -> return c+ '\'' <- next `adjustErrBad` (++"literal char has no final '")+ return char+ where+ escape 'a' = return '\a'+ escape 'b' = return '\b'+ escape 'f' = return '\f'+ escape 'n' = return '\n'+ escape 'r' = return '\r'+ escape 't' = return '\t'+ escape 'v' = return '\v'+ escape '\\' = return '\\'+ escape '"' = return '"'+ escape '\'' = return '\''+ escape '^' = do ctrl <- next+ if ctrl >= '@' && ctrl <= '_'+ then return (chr (ord ctrl - ord '@'))+ else fail ("literal char ctrl-escape malformed: \\^"+ ++[ctrl])+ escape d | isDigit d+ = fmap chr $ (reparse (BS.pack [d]) >> parseDec)+ escape 'o' = fmap chr $ parseOct+ escape 'x' = fmap chr $ parseHex+ escape c | isUpper c+ = mnemonic c+ escape c = fail ("unrecognised escape sequence in literal char: \\"++[c])++ mnemonic 'A' = do 'C' <- next; 'K' <- next; return '\ACK'+ `wrap` "'\\ACK'"+ mnemonic 'B' = do 'E' <- next; 'L' <- next; return '\BEL'+ `onFail`+ do 'S' <- next; return '\BS'+ `wrap` "'\\BEL' or '\\BS'"+ mnemonic 'C' = do 'R' <- next; return '\CR'+ `onFail`+ do 'A' <- next; 'N' <- next; return '\CAN'+ `wrap` "'\\CR' or '\\CAN'"+ mnemonic 'D' = do 'E' <- next; 'L' <- next; return '\DEL'+ `onFail`+ do 'L' <- next; 'E' <- next; return '\DLE'+ `onFail`+ do 'C' <- next; ( do '1' <- next; return '\DC1'+ `onFail`+ do '2' <- next; return '\DC2'+ `onFail`+ do '3' <- next; return '\DC3'+ `onFail`+ do '4' <- next; return '\DC4' )+ `wrap` "'\\DEL' or '\\DLE' or '\\DC[1..4]'"+ mnemonic 'E' = do 'T' <- next; 'X' <- next; return '\ETX'+ `onFail`+ do 'O' <- next; 'T' <- next; return '\EOT'+ `onFail`+ do 'N' <- next; 'Q' <- next; return '\ENQ'+ `onFail`+ do 'T' <- next; 'B' <- next; return '\ETB'+ `onFail`+ do 'M' <- next; return '\EM'+ `onFail`+ do 'S' <- next; 'C' <- next; return '\ESC'+ `wrap` "one of '\\ETX' '\\EOT' '\\ENQ' '\\ETB' '\\EM' or '\\ESC'"+ mnemonic 'F' = do 'F' <- next; return '\FF'+ `onFail`+ do 'S' <- next; return '\FS'+ `wrap` "'\\FF' or '\\FS'"+ mnemonic 'G' = do 'S' <- next; return '\GS'+ `wrap` "'\\GS'"+ mnemonic 'H' = do 'T' <- next; return '\HT'+ `wrap` "'\\HT'"+ mnemonic 'L' = do 'F' <- next; return '\LF'+ `wrap` "'\\LF'"+ mnemonic 'N' = do 'U' <- next; 'L' <- next; return '\NUL'+ `onFail`+ do 'A' <- next; 'K' <- next; return '\NAK'+ `wrap` "'\\NUL' or '\\NAK'"+ mnemonic 'R' = do 'S' <- next; return '\RS'+ `wrap` "'\\RS'"+ mnemonic 'S' = do 'O' <- next; 'H' <- next; return '\SOH'+ `onFail`+ do 'O' <- next; return '\SO'+ `onFail`+ do 'T' <- next; 'X' <- next; return '\STX'+ `onFail`+ do 'I' <- next; return '\SI'+ `onFail`+ do 'Y' <- next; 'N' <- next; return '\SYN'+ `onFail`+ do 'U' <- next; 'B' <- next; return '\SUB'+ `onFail`+ do 'P' <- next; return '\SP'+ `wrap` "'\\SOH' '\\SO' '\\STX' '\\SI' '\\SYN' '\\SUB' or '\\SP'"+ mnemonic 'U' = do 'S' <- next; return '\US'+ `wrap` "'\\US'"+ mnemonic 'V' = do 'T' <- next; return '\VT'+ `wrap` "'\\VT'"+ wrap p s = p `onFail` fail ("expected literal char "++s)++-- Basic types+instance Parse Int where+ parse = fmap fromInteger $ -- convert from Integer, deals with minInt+ do many (satisfy isSpace); parseSigned parseUnsignedInteger+instance Parse Integer where+ parse = do many (satisfy isSpace); parseSigned parseUnsignedInteger+instance Parse Float where+ parse = do many (satisfy isSpace); parseSigned parseFloat+instance Parse Double where+ parse = do many (satisfy isSpace); parseSigned parseFloat+instance Parse Char where+ parse = do many (satisfy isSpace); parseLitChar+ -- not totally correct for strings...+ parseList = do { w <- word; if head w == '"' then return (init (tail w))+ else fail "not a string" }++instance Parse Bool where+ parse = enumeration "Bool" [False,True]++instance Parse Ordering where+ parse = enumeration "Ordering" [LT,EQ,GT]++-- Structural types+instance Parse () where+ parse = P (p . BS.uncons)+ where p Nothing = Failure BS.empty "no input: expected a ()"+ p (Just ('(',cs)) = case BS.uncons (BS.dropWhile isSpace cs) of+ Just (')',s) -> Success s ()+ _ -> Failure cs "Expected ) after ("+ p (Just (c,cs)) | isSpace c = p (BS.uncons cs)+ | otherwise = Failure (BS.cons c cs)+ ("Expected a (), got "++show c)++instance (Parse a, Parse b) => Parse (a,b) where+ parse = do{ isWord "(" `adjustErr` ("Opening a 2-tuple\n"++)+ ; x <- parse `adjustErr` ("In 1st item of a 2-tuple\n"++)+ ; isWord "," `adjustErr` ("Separating a 2-tuple\n"++)+ ; y <- parse `adjustErr` ("In 2nd item of a 2-tuple\n"++)+ ; isWord ")" `adjustErr` ("Closing a 2-tuple\n"++)+ ; return (x,y) }++instance (Parse a, Parse b, Parse c) => Parse (a,b,c) where+ parse = do{ isWord "(" `adjustErr` ("Opening a 3-tuple\n"++)+ ; x <- parse `adjustErr` ("In 1st item of a 3-tuple\n"++)+ ; isWord "," `adjustErr` ("Separating(1) a 3-tuple\n"++)+ ; y <- parse `adjustErr` ("In 2nd item of a 3-tuple\n"++)+ ; isWord "," `adjustErr` ("Separating(2) a 3-tuple\n"++)+ ; z <- parse `adjustErr` ("In 3rd item of a 3-tuple\n"++)+ ; isWord ")" `adjustErr` ("Closing a 3-tuple\n"++)+ ; return (x,y,z) }++instance Parse a => Parse (Maybe a) where+ parsePrec p =+ parens False (do { isWord "Nothing"; return Nothing })+ `onFail`+ parens (p>9) (do { isWord "Just"+ ; fmap Just $ parsePrec 10+ `adjustErrBad` ("but within Just, "++) })+ `adjustErr` (("expected a Maybe (Just or Nothing)\n"++).indent 2)++instance (Parse a, Parse b) => Parse (Either a b) where+ parsePrec p =+ parens (p>9) $+ constructors [ ("Left", do { fmap Left $ parsePrec 10 } )+ , ("Right", do { fmap Right $ parsePrec 10 } )+ ]++instance Parse a => Parse [a] where+ parse = parseList++------------------------------------------------------------------------+-- ByteStrings as a whole entity.++-- | Simply return the remaining input ByteString.+allAsByteString :: TextParser ByteString+allAsByteString = P (\bs-> Success BS.empty bs)++-- | Simply return the remaining input as a String.+allAsString :: TextParser String+allAsString = fmap BS.unpack allAsByteString++------------------------------------------------------------------------
src/Text/ParserCombinators/Poly/Base.hs view
@@ -96,7 +96,7 @@ -- | @x `discard` y@ parses both x and y, but discards the result of y. -- Rather like @const@ lifted into parsers. discard :: PolyParse p => p a -> p b -> p a-px `discard` py = do { x <- px; return (const x) `apply` py; }+px `discard` py = do { x <- px; x `seq` (return (const x) `apply` py); } -- | @adjustErrBad@ is just like @adjustErr@ except it also raises the -- severity of the error.
+ src/Text/ParserCombinators/Poly/ByteString.hs view
@@ -0,0 +1,114 @@+module Text.ParserCombinators.Poly.ByteString+ ( -- * The Parser datatype+ Parser(P)+ , Result(..)+ , runParser+ -- ** basic parsers+ , next+ , eof+ , satisfy+ -- ** re-parsing+ , reparse+ -- * Re-export all more general combinators+ , module Text.ParserCombinators.Poly.Base+ ) where+++import Text.ParserCombinators.Poly.Base+import qualified Data.ByteString.Lazy.Char8 as BS+import Data.ByteString.Lazy.Char8 (ByteString)++-- | This @Parser@ datatype is a fairly generic parsing monad with error+-- reporting. It can be used for arbitrary token types, not just+-- String input. (If you require a running state, use module PolyState+-- instead)+newtype Parser a = P (ByteString -> Result ByteString a)++-- | A return type like Either, that distinguishes not only between+-- right and wrong answers, but also has commitment, so that a failure+-- cannot be undone. This should only be used for writing very primitive+-- parsers - really it is an internal detail of the library.+data Result z a = Success z a+ | Failure z String+ | Committed (Result z a)++instance Functor (Result z) where+ fmap f (Success z a) = Success z (f a)+ fmap _ (Failure z e) = Failure z e+ fmap f (Committed r) = Committed (fmap f r)++-- | Apply a parser to an input token sequence.+runParser :: Parser a -> ByteString -> (Either String a, ByteString)+runParser (P p) = resultToEither . p+ where+ resultToEither :: Result z a -> (Either String a, z)+ resultToEither (Success z a) = (Right a, z)+ resultToEither (Failure z e) = (Left e, z)+ resultToEither (Committed r) = resultToEither r++instance Functor Parser where+ fmap f (P p) = P (fmap f . p)++instance Monad Parser where+ return x = P (\ts-> Success ts x)+ fail e = P (\ts-> Failure ts e)+ (P f) >>= g = P (continue . f)+ where+ continue (Success ts x) = let (P g') = g x in g' ts+ continue (Committed (Committed r)) = continue (Committed r)+ continue (Committed r) = Committed (continue r)+ continue (Failure ts e) = Failure ts e++instance PolyParse Parser where+ commit (P p) = P (Committed . p)+ (P p) `adjustErr` f = P (adjust . p)+ where+ adjust (Failure z e) = Failure z (f e)+ adjust (Committed r) = Committed (adjust r)+ adjust good = good++ (P p) `onFail` (P q) = P (\ts-> continue ts $ p ts)+ where+ continue ts (Failure _ _) = q ts+ -- continue _ (Committed r) = r -- no, remain Committed+ continue _ r = r++ oneOf' = accum []+ where accum errs [] =+ fail ("failed to parse any of the possible choices:\n"+ ++indent 2 (concatMap showErr (reverse errs)))+ accum errs ((e,P p):ps) =+ P (\ts-> case p ts of+ Failure _ err ->+ let (P p') = accum ((e,err):errs) ps+ in p' ts+ r@(Success _ _) -> r+ r@(Committed _) -> r )+ showErr (name,err) = name++":\n"++indent 2 err++------------------------------------------------------------------------+next :: Parser Char+next = P (\bs-> case BS.uncons bs of+ Nothing -> Failure bs "Ran out of input (EOF)"+ Just (c, bs') -> Success bs' c )++eof :: Parser ()+eof = P (\bs -> if BS.null bs+ then Success bs ()+ else Failure bs "Expected end of input (EOF)" )++satisfy :: (Char -> Bool) -> Parser Char+satisfy f = do { x <- next+ ; if f x then return x else fail "Parse.satisfy: failed"+ }++------------------------------------------------------------------------+-- | Push some tokens back onto the front of the input stream and reparse.+-- This is useful e.g. for recursively expanding macros. When the+-- user-parser recognises a macro use, it can lookup the macro+-- expansion from the parse state, lex it, and then stuff the+-- lexed expansion back down into the parser.+reparse :: ByteString -> Parser ()+reparse ts = P (\inp-> Success (ts `BS.append` inp) ())++------------------------------------------------------------------------
src/Text/ParserCombinators/Poly/Lazy.hs view
@@ -5,6 +5,7 @@ , runParser -- :: Parser t a -> [t] -> (Either String a, [t]) -- ** basic parsers , next -- :: Parser t t+ , eof -- :: Parser t () , satisfy -- :: (t->Bool) -> Parser t t -- ** re-parsing@@ -111,6 +112,11 @@ next = P (\ts-> case ts of [] -> Failure [] "Ran out of input (EOF)" (t:ts') -> Success ts' t )++eof :: Parser t ()+eof = P (\ts-> case ts of+ [] -> Success [] ()+ (t:ts') -> Failure ts "Expected end of input (EOF)" ) satisfy :: (t->Bool) -> Parser t t satisfy pred = do { x <- next
src/Text/ParserCombinators/Poly/Plain.hs view
@@ -5,6 +5,7 @@ , runParser -- :: Parser t a -> [t] -> (Either String a, [t]) -- ** basic parsers , next -- :: Parser t t+ , eof -- :: Parser t () , satisfy -- :: (t->Bool) -> Parser t t -- ** re-parsing@@ -89,6 +90,11 @@ next = P (\ts-> case ts of [] -> Failure [] "Ran out of input (EOF)" (t:ts') -> Success ts' t )++eof :: Parser t ()+eof = P (\ts-> case ts of+ [] -> Success [] ()+ (t:ts') -> Failure ts "Expected end of input (EOF)" ) satisfy :: (t->Bool) -> Parser t t satisfy pred = do { x <- next
src/Text/ParserCombinators/Poly/State.hs view
@@ -5,6 +5,7 @@ , runParser -- :: Parser s t a -> s -> [t] -> (Either String a, s, [t]) -- ** basic parsers , next -- :: Parser s t t+ , eof -- :: Parser s t () , satisfy -- :: (t->Bool) -> Parser s t t -- ** State-handling , stUpdate -- :: (s->s) -> Parser s t ()@@ -92,6 +93,12 @@ next = P (\s ts-> case ts of [] -> Failure [] s "Ran out of input (EOF)" (t:ts') -> Success ts' s t )++eof :: Parser s t ()+eof = P (\s ts-> case ts of+ [] -> Success [] s ()+ (t:ts') -> Failure ts s "Expected end of input (eof)" )+ satisfy :: (t->Bool) -> Parser s t t satisfy pred = do { x <- next
src/Text/ParserCombinators/Poly/StateLazy.hs view
@@ -5,6 +5,7 @@ , runParser -- :: Parser s t a -> s -> [t] -> (Either String a, s, [t]) -- ** basic parsers , next -- :: Parser s t t+ , eof -- :: Parser s t () , satisfy -- :: (t->Bool) -> Parser s t t , manyFinally -- :: Parser s t a -> Parser s t z -> Parser s t [a] -- ** State-handling@@ -143,6 +144,11 @@ next = P (\s ts-> case ts of [] -> Failure [] s "Ran out of input (EOF)" (t:ts') -> Success ts' s t )++eof :: Parser s t ()+eof = P (\s ts-> case ts of+ [] -> Success [] s ()+ (t:ts') -> Failure ts s "Expected end of input (eof)" ) satisfy :: (t->Bool) -> Parser s t t satisfy pred = do { x <- next
− src/pkg.conf
@@ -1,16 +0,0 @@-Package- { name = "polyparse"- , auto = True- , import_dirs = ["$libdir/imports/polyparse"]- , source_dirs = []- , library_dirs = ["$libdir"]- , hs_libraries = ["HSpolyparse" ]- , extra_libraries = []- , include_dirs = []- , c_includes = []- , package_deps = ["base"]- , extra_ghc_opts = []- , extra_cc_opts = []- , extra_ld_opts = []- }-