~ubuntu-branches/ubuntu/oneiric/haskell-uulib/oneiric

« back to all changes in this revision

Viewing changes to src/UU/Parsing/MachineInterface.hs

  • Committer: Bazaar Package Importer
  • Author(s): Marco Túlio Gontijo e Silva
  • Date: 2009-04-08 20:01:10 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090408200110-96hu9fr918e1wsr1
Tags: 0.9.10-0.1
* Non-maintainer upload.
* New upstream version.  Closes: #523214.
* Use new version of haskell-devscripts.
* debian/control:
  - Use new Standards-Version.
  - cpphs is not Indep.
* debian/patches: Remove directory.
* debian/haskell-uulib-doc.doc-base: haddock's file are stored now in
  /usr/share/libghc6-uulib-doc/html/.
* debian/haskell-uulib-doc.examples: Create file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
1
3
module UU.Parsing.MachineInterface where
 
4
import GHC.Prim
2
5
 
3
6
-- | The 'InputState' class contains the interface that the AnaParser
4
7
-- parsers expect for the input. A minimal complete instance definition
8
11
 --   can be split off and 'Right'' if none can
9
12
 splitStateE :: state             -> Either' state s
10
13
 -- | Splits the state in the first symbol and the remaining state
11
 
 splitState  :: state             -> ({-#L-} s, state  {-L#-})
 
14
 splitState  :: state             -> (# s, state #)
12
15
 -- | Gets the current position in the input
13
16
 getPosition :: state             -> pos
14
17
 -- | Reports an error
36
39
  {-# INLINE nextR   #-}
37
40
 
38
41
class Symbol s where
39
 
 deleteCost :: s -> Int{-#L-}
 
42
 deleteCost :: s -> Int#
40
43
 symBefore  :: s -> s
41
44
 symAfter   :: s -> s
42
 
 deleteCost b = 5{-#L-}
 
45
 deleteCost b = 5#
43
46
 symBefore  = error "You should have made your token type an instance of the Class Symbol. eg by defining symBefore = pred"
44
47
 symAfter   = error "You should have made your token type an instance of the Class Symbol. eg by defining symAfter  = succ"
45
48
 
52
55
data Steps val s p 
53
56
             = forall a . OkVal           (a -> val)                                (Steps a   s p)
54
57
             |            Ok         {                                       rest :: Steps val s p}
55
 
             |            Cost       {costing::Int{-#L-}                   , rest :: Steps val s p}
56
 
             |            StRepair   {costing::Int{-#L-}, m :: !(Message s p) , rest :: Steps val s p}
 
58
             |            Cost       {costing::Int#                        , rest :: Steps val s p}
 
59
             |            StRepair   {costing::Int#  , m :: !(Message s p) , rest :: Steps val s p}
57
60
             |            Best       (Steps val s p) (Steps val s p) ( Steps val s p)
58
61
             |            NoMoreSteps val
59
62
data Action s  =  Insert s