Hets - the Heterogeneous Tool Set

Copyright(c) Christian Maeder and Uni Bremen 2002-2006
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellNone

Common.AnnoState

Contents

Description

Parsing of interspersed annotations

  • a parser state to collect annotations
  • parsing annoted keywords
  • parsing an annoted item list

Synopsis

Documentation

type AParser st = GenParser Char (AnnoState st)

parsers that can collect annotations via side effects

class TermParser a where

Minimal complete definition

Nothing

Methods

termParser

Arguments

:: Bool 
-> AParser st a

True for terms, formulas otherwise

aToTermParser :: AParser st a -> Bool -> AParser st a

data AnnoState st

just the list of currently collected annotations

Constructors

AnnoState 

Fields

toAnnos :: [Annotation]
 
_userState :: st
 

Instances

emptyAnnos :: st -> AnnoState st

no annotations

parseAnnos :: AnnoState a -> GenParser Char st (AnnoState a)

add further annotations to the input state

parseLineAnnos :: AnnoState a -> GenParser Char st (AnnoState a)

add only annotations on consecutive lines to the input state

addAnnos :: AParser st ()

add annotations to the internal state

addLineAnnos :: AParser st ()

add only annotations on consecutive lines to the internal state

getAnnos :: AParser st [Annotation]

extract all annotation from the internal state, resets the internal state to emptyAnnos

mLineAnnos :: GenParser Char st [Annotation]

annotations on consecutive lines

annos :: AParser st [Annotation]

explicitly parse annotations, reset internal state

lineAnnos :: AParser st [Annotation]

explicitly parse annotations on consecutive lines. reset internal state

tryItemEnd :: [String] -> AParser st ()

succeeds if the previous item is finished

startKeyword :: [String]

keywords that indicate a new item for tryItemEnd. the quantifier exists does not start a new item.

annoParser :: AParser st a -> AParser st (Annoted a)

parse preceding annotations and the following item

trailingAnnosParser :: AParser st a -> AParser st [Annoted a]

parse preceding and consecutive trailing annotations of an item in between. Unlike annosParser do not treat all trailing annotations as preceding annotations of the next item.

annosParser :: AParser st a -> AParser st [Annoted a]

parse an item list preceded and followed by annotations

itemList :: [String] -> String -> ([String] -> AParser st b) -> ([Annoted b] -> Range -> a) -> AParser st a

parse an item list preceded by a singular or plural keyword, interspersed with semicolons and an optional semicolon at the end

auxItemList :: [String] -> [Token] -> AParser st b -> ([Annoted b] -> Range -> a) -> AParser st a

generalized version of itemList for an other keyword list for tryItemEnd and without pluralKeyword

itemAux :: [String] -> AParser st a -> AParser st ([a], [Token], [[Annotation]])

parse an item list without a starting keyword

wrapAnnos :: AParser st a -> AParser st a

collect preceding and trailing annotations

asKey :: String -> AParser st Token

parse an annoted keyword

annoted keywords

trySemi :: AParser st Token

check for a semicolon beyond annotations

trySemiOrComma :: AParser st Token

check for a semicolon or comma beyond annotations and trailing line annos

optSemi :: AParser st ([Token], [Annotation])

optional semicolon followed by annotations on consecutive lines