cvs commit: fptools/happy/alex/examples haskell.x fptools/happy/a lex/src ParseMonad.hs AbsSyn.hs Main.hs Makefile NFA.hs Parser.y Scan.hs Scan.x fptools/happy/alex/templates wrappers.hs GenericTemplate.hs Makefile fptools/happy/alex/tests Makefile simple.x
Simon Marlow <[email protected]> Mon, 31 Mar 2003 08:52:26 -0800
| Newsgroups | gmane.comp.lang.haskell.cvs.happy |
|---|---|
| Message-ID | <[email protected]> |
simonmar 2003/03/31 08:52:26 PST
Modified files: (Branch: simonm-hackery-branch)
happy/alex/examples haskell.x
happy/alex/src AbsSyn.hs Main.hs Makefile NFA.hs
Parser.y Scan.hs Scan.x
happy/alex/templates GenericTemplate.hs Makefile
happy/alex/tests Makefile simple.x
Added files: (Branch: simonm-hackery-branch)
happy/alex/src ParseMonad.hs
happy/alex/templates wrappers.hs
Log:
Some changes to the programmer's interface to a generated scanner.
Now you get a bare-bones scanner where Alex supplies
type StartCode
alexScan :: AlexInput -- The current input
-> StartCode -- The "start code"
-> Maybe ( -- Nothing on error or EOF
AlexInput, -- The remaining input
Int, -- Length of this token
action -- The action (unknown type)
)
You can use this scanner by supplying the following:
type AlexInput
alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
alexPrevChar :: AlexInput -> Char
or there is a selection of "wrappers" which provide suitable
definitions for the above. eg. saying
%wrapper "monad"
in the grammer file gets you a default monad which keeps track of the
input and can handle parse errors, and
%wrapper "gscan"
gets you an interface similar to the old Alex.
Or alternatively you can build your own monad on top of the bare-bones
scanner, which is what Alex itself now does. As a result it can now
report lexical errors in the grammar file properly.
Revision Changes Path
1.1.2.3 +68 -65 fptools/happy/alex/examples/Attic/haskell.x
1.1.2.6 +29 -6 fptools/happy/alex/src/Attic/AbsSyn.hs
1.1.1.1.2.8 +67 -27 fptools/happy/alex/src/Main.hs
1.2.2.7 +8 -3 fptools/happy/alex/src/Makefile
1.1.1.1.2.6 +1 -1 fptools/happy/alex/src/NFA.hs
1.1.2.9 +15 -49 fptools/happy/alex/src/Attic/Parser.y
1.1.1.1.2.9 +140 -196 fptools/happy/alex/src/Scan.hs
1.1.1.1.2.7 +96 -73 fptools/happy/alex/src/Scan.x
1.1.2.6 +41 -154 fptools/happy/alex/templates/Attic/GenericTemplate.hs
1.1.2.3 +10 -11 fptools/happy/alex/templates/Attic/Makefile
1.1.2.4 +0 -2 fptools/happy/alex/tests/Attic/Makefile
1.1.2.4 +25 -18 fptools/happy/alex/tests/Attic/simple.x