{-# Language FlexibleContexts, FlexibleInstances, OverloadedStrings, Rank2Types, RecordWildCards, ScopedTypeVariables,
             TypeFamilies, TypeSynonymInstances, TemplateHaskell #-}
-- | Modula-2 grammar adapted from the ISO specification of the language.

module Language.Modula2.ISO.Grammar where

import Control.Applicative
import Control.Monad (guard, void)
import Data.Char (isAlphaNum, isDigit, isHexDigit, isLetter, isOctDigit, isSpace)
import Data.List.NonEmpty (NonEmpty, toList)
import Data.Maybe (catMaybes)
import Data.Monoid ((<>))
import Data.Text (Text, unpack)
import Numeric (readOct, readDec, readHex, readFloat)
import Text.Grampa
import Text.Grampa.ContextFree.LeftRecursive.Transformer (lift, tmap)
import Text.Parser.Combinators (sepBy, sepBy1, sepByNonEmpty, try)
import Text.Parser.Token (braces, brackets, parens)

import qualified Rank2
import qualified Rank2.TH
import Transformation.Deep as Deep (Product(Pair))

import Language.Oberon.Grammar (TokenType(..))

import qualified Language.Modula2.Abstract as Abstract
import qualified Language.Modula2.ISO.Abstract as ISO.Abstract
import qualified Language.Modula2.ISO.AST as AST
import qualified Language.Modula2.Grammar as ReportGrammar
import           Language.Modula2.Grammar (delimiter, wrap)

type Parser = ReportGrammar.Parser

-- | The names and types of all the new grammar productions in the ISO specification
data ISOMixin l f p = ISOMixin{
   ISOMixin l f p -> p (f (ConstExpression l l f f))
machineAddress :: p (f (Abstract.ConstExpression l l f f)),
   ISOMixin l f p -> p (Type l l f f)
packedSetType :: p (Abstract.Type l l f f),
   ISOMixin l f p -> p (Block l l f f)
moduleBody :: p (Abstract.Block l l f f),
   ISOMixin l f p -> p (NonEmpty (f (AddressedIdent l l f f)))
variableIdentifierList :: p (NonEmpty (f (ISO.Abstract.AddressedIdent l l f f))),
   ISOMixin l f p -> p (Statement l l f f)
retryStatement :: p (Abstract.Statement l l f f),
   ISOMixin l f p -> p (Expression l l f f)
arrayConstructor :: p (Abstract.Expression l l f f),
   ISOMixin l f p -> p (Expression l l f f)
recordConstructor :: p (Abstract.Expression l l f f),
   ISOMixin l f p -> p [f (Item l l f f)]
arrayConstructedValue :: p [f (ISO.Abstract.Item l l f f)],
   ISOMixin l f p -> p [f (Expression l l f f)]
recordConstructedValue :: p [f (Abstract.Expression l l f f)],
   ISOMixin l f p -> p [f (Element l l f f)]
setConstructedValue :: p [f (Abstract.Element l l f f)],
   ISOMixin l f p -> p (Item l l f f)
arrayPart :: p (ISO.Abstract.Item l l f f),
   ISOMixin l f p -> p (f (Expression l l f f))
structureComponent  :: p (f (Abstract.Expression l l f f))}

-- | The new grammar productions in the ISO specification
isoMixin :: (ISO.Abstract.Modula2 l, LexicalParsing (Parser g Text))
         => ReportGrammar.Modula2Grammar l ReportGrammar.NodeWrap (Parser g Text)
         -> ISOMixin l ReportGrammar.NodeWrap (Parser g Text)
         -> ISOMixin l ReportGrammar.NodeWrap (Parser g Text)
isoMixin :: Modula2Grammar l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
isoMixin ReportGrammar.Modula2Grammar{Parser g Text [NodeWrap (FieldList l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Definition l l NodeWrap NodeWrap)]
Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
Parser g Text (NodeWrap (Module l l NodeWrap NodeWrap))
Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
Parser g Text Text
Parser
  g Text (NonEmpty (NodeWrap (CaseLabels l l NodeWrap NodeWrap)))
Parser
  g Text (NonEmpty (NodeWrap (Expression l l NodeWrap NodeWrap)))
Parser g Text (IdentList l)
Parser g Text RelOp
Parser g Text (QualIdent l)
Parser g Text (Import l)
Parser g Text (Element l l NodeWrap NodeWrap)
Parser g Text (CaseLabels l l NodeWrap NodeWrap)
Parser g Text (Case l l NodeWrap NodeWrap)
Parser g Text (Block l l NodeWrap NodeWrap)
Parser g Text (FPSection l l NodeWrap NodeWrap)
Parser g Text (FormalParameters l l NodeWrap NodeWrap)
Parser g Text (FieldList l l NodeWrap NodeWrap)
Parser g Text (Value l l NodeWrap NodeWrap)
Parser g Text (Designator l l NodeWrap NodeWrap)
Parser g Text (Expression l l NodeWrap NodeWrap)
Parser g Text (Statement l l NodeWrap NodeWrap)
Parser g Text (Type l l NodeWrap NodeWrap)
Parser g Text (Declaration l l NodeWrap NodeWrap)
Parser g Text (Module l l NodeWrap NodeWrap)
Parser g Text (Export l)
Parser g Text (Definition l l NodeWrap NodeWrap)
Parser g Text (Variant l l NodeWrap NodeWrap)
Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
compilationUnit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (Module l l f f))
programModule :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Module l l f f)
definitionSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (Definition l l f f)]
definitionModule :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Module l l f f)
import_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Import l)
export :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Export l)
priority :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
moduleDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
formalType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
fPSection :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FPSection l l f f)
formalParameters :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FormalParameters l l f f)
declarationSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (Declaration l l f f)]
block :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Block l l f f)
procedureHeading :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Text, ProcedureHeading l l f f)
procedureDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
withStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
loopStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
forStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
repeatStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
whileStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
case_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Case l l f f)
caseStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
ifStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
statementSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (StatementSequence l l f f))
procedureCall :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
assignment :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
statement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
actualParameters :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (ConstExpression l l f f)]
factor :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
term :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
simpleExpression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
expression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
expList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NonEmpty (f (ConstExpression l l f f)))
designator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Designator l l f f)
variableDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
variableDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
formalTypeList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FormalParameters l l f f)
procedureType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
pointerType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
setType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
caseLabels :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (CaseLabels l l f f)
caseLabelList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NonEmpty (f (CaseLabels l l f f)))
variant :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Variant l l f f)
fieldList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FieldList l l f f)
fieldListSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (FieldList l l f f)]
recordType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
arrayType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
subrangeType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
identList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (IdentList l)
enumeration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
simpleType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
type_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
typeDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
typeDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
element :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Element l l f f)
set :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (ConstExpression l l f f)
mulOperator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p
-> p (f (ConstExpression l l f f)
      -> f (ConstExpression l l f f) -> ConstExpression l l f f)
addOperator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p
-> p (f (ConstExpression l l f f)
      -> f (ConstExpression l l f f) -> ConstExpression l l f f)
relation :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p RelOp
constExpression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
constantDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
constantDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
qualident :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (QualIdent l)
string_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
octalDigit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
digit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
hexDigit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
scaleFactor :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
real :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
integer :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
number :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
ident :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
compilationUnit :: Parser g Text (NodeWrap (Module l l NodeWrap NodeWrap))
programModule :: Parser g Text (Module l l NodeWrap NodeWrap)
definitionSequence :: Parser g Text [NodeWrap (Definition l l NodeWrap NodeWrap)]
definitionModule :: Parser g Text (Module l l NodeWrap NodeWrap)
import_prod :: Parser g Text (Import l)
export :: Parser g Text (Export l)
priority :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
moduleDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
formalType :: Parser g Text (Type l l NodeWrap NodeWrap)
fPSection :: Parser g Text (FPSection l l NodeWrap NodeWrap)
formalParameters :: Parser g Text (FormalParameters l l NodeWrap NodeWrap)
declarationSequence :: Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
block :: Parser g Text (Block l l NodeWrap NodeWrap)
procedureHeading :: Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
procedureDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
withStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
loopStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
forStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
repeatStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
whileStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
case_prod :: Parser g Text (Case l l NodeWrap NodeWrap)
caseStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
ifStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
statementSequence :: Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
procedureCall :: Parser g Text (Statement l l NodeWrap NodeWrap)
assignment :: Parser g Text (Statement l l NodeWrap NodeWrap)
statement :: Parser g Text (Statement l l NodeWrap NodeWrap)
actualParameters :: Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
factor :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
term :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
simpleExpression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expList :: Parser
  g Text (NonEmpty (NodeWrap (Expression l l NodeWrap NodeWrap)))
designator :: Parser g Text (Designator l l NodeWrap NodeWrap)
variableDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
variableDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
formalTypeList :: Parser g Text (FormalParameters l l NodeWrap NodeWrap)
procedureType :: Parser g Text (Type l l NodeWrap NodeWrap)
pointerType :: Parser g Text (Type l l NodeWrap NodeWrap)
setType :: Parser g Text (Type l l NodeWrap NodeWrap)
caseLabels :: Parser g Text (CaseLabels l l NodeWrap NodeWrap)
caseLabelList :: Parser
  g Text (NonEmpty (NodeWrap (CaseLabels l l NodeWrap NodeWrap)))
variant :: Parser g Text (Variant l l NodeWrap NodeWrap)
fieldList :: Parser g Text (FieldList l l NodeWrap NodeWrap)
fieldListSequence :: Parser g Text [NodeWrap (FieldList l l NodeWrap NodeWrap)]
recordType :: Parser g Text (Type l l NodeWrap NodeWrap)
arrayType :: Parser g Text (Type l l NodeWrap NodeWrap)
subrangeType :: Parser g Text (Type l l NodeWrap NodeWrap)
identList :: Parser g Text (IdentList l)
enumeration :: Parser g Text (Type l l NodeWrap NodeWrap)
simpleType :: Parser g Text (Type l l NodeWrap NodeWrap)
type_prod :: Parser g Text (Type l l NodeWrap NodeWrap)
typeDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
typeDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
element :: Parser g Text (Element l l NodeWrap NodeWrap)
set :: Parser g Text (Expression l l NodeWrap NodeWrap)
mulOperator :: Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
addOperator :: Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
relation :: Parser g Text RelOp
constExpression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constantDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
constantDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
qualident :: Parser g Text (QualIdent l)
string_prod :: Parser g Text Text
octalDigit :: Parser g Text Text
digit :: Parser g Text Text
hexDigit :: Parser g Text Text
scaleFactor :: Parser g Text Text
real :: Parser g Text (Value l l NodeWrap NodeWrap)
integer :: Parser g Text (Value l l NodeWrap NodeWrap)
number :: Parser g Text (Value l l NodeWrap NodeWrap)
ident :: Parser g Text Text
..} ISOMixin{Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
Parser g Text (Block l l NodeWrap NodeWrap)
Parser g Text (Expression l l NodeWrap NodeWrap)
Parser g Text (Statement l l NodeWrap NodeWrap)
Parser g Text (Type l l NodeWrap NodeWrap)
Parser g Text (Item l l NodeWrap NodeWrap)
structureComponent :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
arrayPart :: Parser g Text (Item l l NodeWrap NodeWrap)
setConstructedValue :: Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
recordConstructedValue :: Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
arrayConstructedValue :: Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
recordConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
arrayConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
retryStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
variableIdentifierList :: Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
moduleBody :: Parser g Text (Block l l NodeWrap NodeWrap)
packedSetType :: Parser g Text (Type l l NodeWrap NodeWrap)
machineAddress :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (f (ConstExpression l l f f))
arrayPart :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Item l l f f)
setConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (Element l l f f)]
recordConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (ConstExpression l l f f)]
arrayConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (Item l l f f)]
recordConstructor :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (ConstExpression l l f f)
arrayConstructor :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (ConstExpression l l f f)
retryStatement :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Statement l l f f)
variableIdentifierList :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (NonEmpty (f (AddressedIdent l l f f)))
moduleBody :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Block l l f f)
packedSetType :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Type l l f f)
machineAddress :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (f (ConstExpression l l f f))
..} = ISOMixin :: forall l (f :: * -> *) (p :: * -> *).
p (f (ConstExpression l l f f))
-> p (Type l l f f)
-> p (Block l l f f)
-> p (NonEmpty (f (AddressedIdent l l f f)))
-> p (Statement l l f f)
-> p (ConstExpression l l f f)
-> p (ConstExpression l l f f)
-> p [f (Item l l f f)]
-> p [f (ConstExpression l l f f)]
-> p [f (Element l l f f)]
-> p (Item l l f f)
-> p (f (ConstExpression l l f f))
-> ISOMixin l f p
ISOMixin{
   machineAddress :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
machineAddress = Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (m :: * -> *) a. TokenParsing m => m a -> m a
brackets Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constExpression,
   variableIdentifierList :: Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
variableIdentifierList =
        Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (AddressedIdent l l NodeWrap NodeWrap))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
forall (m :: * -> *) a sep.
Alternative m =>
m a -> m sep -> m (NonEmpty a)
sepByNonEmpty (Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (AddressedIdent l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap (Text -> AddressedIdent l l NodeWrap NodeWrap
forall l l' (f' :: * -> *) (f :: * -> *).
Modula2 l =>
Text -> AddressedIdent l l' f' f
ISO.Abstract.unaddressedIdent (Text -> AddressedIdent l l NodeWrap NodeWrap)
-> Parser g Text Text
-> Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text Text
ident
                             Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
-> Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
-> Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text
-> NodeWrap (Expression l l NodeWrap NodeWrap)
-> AddressedIdent l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
Text -> f (ConstExpression l' l' f' f') -> AddressedIdent l l' f' f
ISO.Abstract.addressedIdent (Text
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> AddressedIdent l l NodeWrap NodeWrap)
-> Parser g Text Text
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> AddressedIdent l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text Text
ident Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> AddressedIdent l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (AddressedIdent l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (m :: * -> *) a. TokenParsing m => m a -> m a
brackets Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constExpression))
                      (Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
","),
   packedSetType :: Parser g Text (Type l l NodeWrap NodeWrap)
packedSetType = ((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
-> Type l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
f (Type l' l' f' f') -> Type l l' f' f
ISO.Abstract.packedSetType (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
 -> Type l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
      -> Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"PACKED" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
   -> Type l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
      -> Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"SET" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
   -> Type l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
      -> Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"OF" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
   -> Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
-> Parser g Text (Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Type l l NodeWrap NodeWrap)
simpleType,
   moduleBody :: Parser g Text (Block l l NodeWrap NodeWrap)
moduleBody = [NodeWrap (Declaration l l NodeWrap NodeWrap)]
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Block l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
[f (Declaration l' l' f' f')]
-> Maybe (f (StatementSequence l' l' f' f'))
-> Maybe (f (StatementSequence l' l' f' f'))
-> Maybe (f (StatementSequence l' l' f' f'))
-> Block l l' f' f
ISO.Abstract.exceptionHandlingBlock ([NodeWrap (Declaration l l NodeWrap NodeWrap)]
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Block l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
declarationSequence
                Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"BEGIN" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence)
                Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"EXCEPT" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence)
                Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Parser g Text (Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"FINALLY" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence) Parser g Text (Block l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"END",
   retryStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
retryStatement = Statement l l NodeWrap NodeWrap
forall l l' (f' :: * -> *) (f :: * -> *).
Modula2 l =>
Statement l l' f' f
ISO.Abstract.retryStatement Statement l l NodeWrap NodeWrap
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"RETRY",
   arrayConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
arrayConstructor = Maybe (QualIdent l)
-> [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Item l' l' f' f')] -> Expression l l' f' f
ISO.Abstract.array (Maybe (QualIdent l)
 -> [NodeWrap (Item l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> (QualIdent l -> Maybe (QualIdent l))
-> QualIdent l
-> [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QualIdent l -> Maybe (QualIdent l)
forall a. a -> Maybe a
Just (QualIdent l
 -> [NodeWrap (Item l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text (QualIdent l)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ([NodeWrap (Item l l NodeWrap NodeWrap)]
      -> Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (QualIdent l)
qualident Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ([NodeWrap (Item l l NodeWrap NodeWrap)]
   -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
arrayConstructedValue,
   arrayConstructedValue :: Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
arrayConstructedValue = Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
forall (m :: * -> *) a. TokenParsing m => m a -> m a
braces (Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Item l l NodeWrap NodeWrap))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1 (Parser g Text (Item l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Item l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Item l l NodeWrap NodeWrap)
arrayPart) (Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
",")),
   arrayPart :: Parser g Text (Item l l NodeWrap NodeWrap)
arrayPart = NodeWrap (Expression l l NodeWrap NodeWrap)
-> Item l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
f (Expression l' l' f' f') -> Item l l' f' f
ISO.Abstract.single (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> Item l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (Item l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent
               Parser g Text (Item l l NodeWrap NodeWrap)
-> Parser g Text (Item l l NodeWrap NodeWrap)
-> Parser g Text (Item l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> NodeWrap (Expression l l NodeWrap NodeWrap)
-> NodeWrap (Expression l l NodeWrap NodeWrap)
-> Item l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
f (Expression l' l' f' f')
-> f (Expression l' l' f' f') -> Item l l' f' f
ISO.Abstract.repeated (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> Item l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Item l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Item l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Item l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"BY" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Item l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (Item l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constExpression,
   structureComponent :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent = Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expression Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap (Maybe (QualIdent l)
-> [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Item l' l' f' f')] -> Expression l l' f' f
ISO.Abstract.array Maybe (QualIdent l)
forall a. Maybe a
Nothing ([NodeWrap (Item l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
arrayConstructedValue
                                             Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe (QualIdent l)
-> [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Expression l' l' f' f')] -> Expression l l' f' f
ISO.Abstract.record Maybe (QualIdent l)
forall a. Maybe a
Nothing ([NodeWrap (Expression l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
recordConstructedValue
                                             Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe (QualIdent l)
-> [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Element l' l' f' f')] -> Expression l l' f' f
Abstract.set Maybe (QualIdent l)
forall a. Maybe a
Nothing ([NodeWrap (Element l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
setConstructedValue),
   recordConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
recordConstructor = Maybe (QualIdent l)
-> [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Expression l' l' f' f')] -> Expression l l' f' f
ISO.Abstract.record (Maybe (QualIdent l)
 -> [NodeWrap (Expression l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> (QualIdent l -> Maybe (QualIdent l))
-> QualIdent l
-> [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QualIdent l -> Maybe (QualIdent l)
forall a. a -> Maybe a
Just (QualIdent l
 -> [NodeWrap (Expression l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text (QualIdent l)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ([NodeWrap (Expression l l NodeWrap NodeWrap)]
      -> Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (QualIdent l)
qualident Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ([NodeWrap (Expression l l NodeWrap NodeWrap)]
   -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
recordConstructedValue,
   recordConstructedValue :: Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
recordConstructedValue = Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
-> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
forall (m :: * -> *) a. TokenParsing m => m a -> m a
braces (Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent (Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
",")),
   setConstructedValue :: Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
setConstructedValue = Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
forall (m :: * -> *) a. TokenParsing m => m a -> m a
braces (Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Element l l NodeWrap NodeWrap))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy (Parser g Text (Element l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Element l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Element l l NodeWrap NodeWrap)
element) (Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
","))
   }

type ISOGrammar l = Rank2.Product (ISOMixin l ReportGrammar.NodeWrap) (ReportGrammar.Modula2Grammar l ReportGrammar.NodeWrap)

modula2ISOgrammar :: Grammar (ISOGrammar AST.Language) Parser Text
modula2ISOgrammar :: Grammar (ISOGrammar Language) Parser Text
modula2ISOgrammar = (Grammar (ISOGrammar Language) Parser Text
 -> Grammar (ISOGrammar Language) Parser Text)
-> Grammar (ISOGrammar Language) Parser Text
forall (m :: * -> *) (g :: (* -> *) -> *).
(GrammarParsing m, g ~ ParserGrammar m, GrammarConstraint m g,
 Distributive g) =>
(g m -> g m) -> g m
fixGrammar Grammar (ISOGrammar Language) Parser Text
-> Grammar (ISOGrammar Language) Parser Text
forall l (g :: (* -> *) -> *).
(Modula2 l, LexicalParsing (Parser g Text)) =>
GrammarBuilder (ISOGrammar l) g Parser Text
isoGrammar

-- | All the productions of the ISO Modula-2 grammar
isoGrammar :: forall l g. (ISO.Abstract.Modula2 l, LexicalParsing (Parser g Text))
           => GrammarBuilder (ISOGrammar l) g Parser Text
isoGrammar :: GrammarBuilder (ISOGrammar l) g Parser Text
isoGrammar (Rank2.Pair iso :: ISOMixin l NodeWrap (Parser g Text)
iso@ISOMixin{Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
Parser g Text (Block l l NodeWrap NodeWrap)
Parser g Text (Expression l l NodeWrap NodeWrap)
Parser g Text (Statement l l NodeWrap NodeWrap)
Parser g Text (Type l l NodeWrap NodeWrap)
Parser g Text (Item l l NodeWrap NodeWrap)
structureComponent :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
arrayPart :: Parser g Text (Item l l NodeWrap NodeWrap)
setConstructedValue :: Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
recordConstructedValue :: Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
arrayConstructedValue :: Parser g Text [NodeWrap (Item l l NodeWrap NodeWrap)]
recordConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
arrayConstructor :: Parser g Text (Expression l l NodeWrap NodeWrap)
retryStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
variableIdentifierList :: Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
moduleBody :: Parser g Text (Block l l NodeWrap NodeWrap)
packedSetType :: Parser g Text (Type l l NodeWrap NodeWrap)
machineAddress :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
structureComponent :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (f (ConstExpression l l f f))
arrayPart :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Item l l f f)
setConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (Element l l f f)]
recordConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (ConstExpression l l f f)]
arrayConstructedValue :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p [f (Item l l f f)]
recordConstructor :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (ConstExpression l l f f)
arrayConstructor :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (ConstExpression l l f f)
retryStatement :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Statement l l f f)
variableIdentifierList :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (NonEmpty (f (AddressedIdent l l f f)))
moduleBody :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Block l l f f)
packedSetType :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (Type l l f f)
machineAddress :: forall l (f :: * -> *) (p :: * -> *).
ISOMixin l f p -> p (f (ConstExpression l l f f))
..} report :: Modula2Grammar l NodeWrap (Parser g Text)
report@ReportGrammar.Modula2Grammar{Parser g Text [NodeWrap (FieldList l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
Parser g Text [NodeWrap (Definition l l NodeWrap NodeWrap)]
Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
Parser g Text (NodeWrap (Module l l NodeWrap NodeWrap))
Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
Parser g Text Text
Parser
  g Text (NonEmpty (NodeWrap (CaseLabels l l NodeWrap NodeWrap)))
Parser
  g Text (NonEmpty (NodeWrap (Expression l l NodeWrap NodeWrap)))
Parser g Text (IdentList l)
Parser g Text RelOp
Parser g Text (QualIdent l)
Parser g Text (Import l)
Parser g Text (Element l l NodeWrap NodeWrap)
Parser g Text (CaseLabels l l NodeWrap NodeWrap)
Parser g Text (Case l l NodeWrap NodeWrap)
Parser g Text (Block l l NodeWrap NodeWrap)
Parser g Text (FPSection l l NodeWrap NodeWrap)
Parser g Text (FormalParameters l l NodeWrap NodeWrap)
Parser g Text (FieldList l l NodeWrap NodeWrap)
Parser g Text (Value l l NodeWrap NodeWrap)
Parser g Text (Designator l l NodeWrap NodeWrap)
Parser g Text (Expression l l NodeWrap NodeWrap)
Parser g Text (Statement l l NodeWrap NodeWrap)
Parser g Text (Type l l NodeWrap NodeWrap)
Parser g Text (Declaration l l NodeWrap NodeWrap)
Parser g Text (Module l l NodeWrap NodeWrap)
Parser g Text (Export l)
Parser g Text (Definition l l NodeWrap NodeWrap)
Parser g Text (Variant l l NodeWrap NodeWrap)
Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
compilationUnit :: Parser g Text (NodeWrap (Module l l NodeWrap NodeWrap))
programModule :: Parser g Text (Module l l NodeWrap NodeWrap)
definitionSequence :: Parser g Text [NodeWrap (Definition l l NodeWrap NodeWrap)]
definitionModule :: Parser g Text (Module l l NodeWrap NodeWrap)
import_prod :: Parser g Text (Import l)
export :: Parser g Text (Export l)
priority :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
moduleDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
formalType :: Parser g Text (Type l l NodeWrap NodeWrap)
fPSection :: Parser g Text (FPSection l l NodeWrap NodeWrap)
formalParameters :: Parser g Text (FormalParameters l l NodeWrap NodeWrap)
declarationSequence :: Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
block :: Parser g Text (Block l l NodeWrap NodeWrap)
procedureHeading :: Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
procedureDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
withStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
loopStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
forStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
repeatStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
whileStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
case_prod :: Parser g Text (Case l l NodeWrap NodeWrap)
caseStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
ifStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
statementSequence :: Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
procedureCall :: Parser g Text (Statement l l NodeWrap NodeWrap)
assignment :: Parser g Text (Statement l l NodeWrap NodeWrap)
statement :: Parser g Text (Statement l l NodeWrap NodeWrap)
actualParameters :: Parser g Text [NodeWrap (Expression l l NodeWrap NodeWrap)]
factor :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
term :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
simpleExpression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expList :: Parser
  g Text (NonEmpty (NodeWrap (Expression l l NodeWrap NodeWrap)))
designator :: Parser g Text (Designator l l NodeWrap NodeWrap)
variableDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
variableDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
formalTypeList :: Parser g Text (FormalParameters l l NodeWrap NodeWrap)
procedureType :: Parser g Text (Type l l NodeWrap NodeWrap)
pointerType :: Parser g Text (Type l l NodeWrap NodeWrap)
setType :: Parser g Text (Type l l NodeWrap NodeWrap)
caseLabels :: Parser g Text (CaseLabels l l NodeWrap NodeWrap)
caseLabelList :: Parser
  g Text (NonEmpty (NodeWrap (CaseLabels l l NodeWrap NodeWrap)))
variant :: Parser g Text (Variant l l NodeWrap NodeWrap)
fieldList :: Parser g Text (FieldList l l NodeWrap NodeWrap)
fieldListSequence :: Parser g Text [NodeWrap (FieldList l l NodeWrap NodeWrap)]
recordType :: Parser g Text (Type l l NodeWrap NodeWrap)
arrayType :: Parser g Text (Type l l NodeWrap NodeWrap)
subrangeType :: Parser g Text (Type l l NodeWrap NodeWrap)
identList :: Parser g Text (IdentList l)
enumeration :: Parser g Text (Type l l NodeWrap NodeWrap)
simpleType :: Parser g Text (Type l l NodeWrap NodeWrap)
type_prod :: Parser g Text (Type l l NodeWrap NodeWrap)
typeDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
typeDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
element :: Parser g Text (Element l l NodeWrap NodeWrap)
set :: Parser g Text (Expression l l NodeWrap NodeWrap)
mulOperator :: Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
addOperator :: Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
relation :: Parser g Text RelOp
constExpression :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constantDefinition :: Parser g Text (Definition l l NodeWrap NodeWrap)
constantDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
qualident :: Parser g Text (QualIdent l)
string_prod :: Parser g Text Text
octalDigit :: Parser g Text Text
digit :: Parser g Text Text
hexDigit :: Parser g Text Text
scaleFactor :: Parser g Text Text
real :: Parser g Text (Value l l NodeWrap NodeWrap)
integer :: Parser g Text (Value l l NodeWrap NodeWrap)
number :: Parser g Text (Value l l NodeWrap NodeWrap)
ident :: Parser g Text Text
compilationUnit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (Module l l f f))
programModule :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Module l l f f)
definitionSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (Definition l l f f)]
definitionModule :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Module l l f f)
import_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Import l)
export :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Export l)
priority :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
moduleDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
formalType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
fPSection :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FPSection l l f f)
formalParameters :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FormalParameters l l f f)
declarationSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (Declaration l l f f)]
block :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Block l l f f)
procedureHeading :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Text, ProcedureHeading l l f f)
procedureDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
withStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
loopStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
forStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
repeatStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
whileStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
case_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Case l l f f)
caseStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
ifStatement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
statementSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (StatementSequence l l f f))
procedureCall :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
assignment :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
statement :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
actualParameters :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (ConstExpression l l f f)]
factor :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
term :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
simpleExpression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
expression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
expList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NonEmpty (f (ConstExpression l l f f)))
designator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Designator l l f f)
variableDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
variableDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
formalTypeList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FormalParameters l l f f)
procedureType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
pointerType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
setType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
caseLabels :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (CaseLabels l l f f)
caseLabelList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NonEmpty (f (CaseLabels l l f f)))
variant :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Variant l l f f)
fieldList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (FieldList l l f f)
fieldListSequence :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p [f (FieldList l l f f)]
recordType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
arrayType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
subrangeType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
identList :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (IdentList l)
enumeration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
simpleType :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
type_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
typeDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
typeDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
element :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Element l l f f)
set :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (ConstExpression l l f f)
mulOperator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p
-> p (f (ConstExpression l l f f)
      -> f (ConstExpression l l f f) -> ConstExpression l l f f)
addOperator :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p
-> p (f (ConstExpression l l f f)
      -> f (ConstExpression l l f f) -> ConstExpression l l f f)
relation :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p RelOp
constExpression :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
constantDefinition :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Definition l l f f)
constantDeclaration :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
qualident :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (QualIdent l)
string_prod :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
octalDigit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
digit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
hexDigit :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
scaleFactor :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
real :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
integer :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
number :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Value l l f f)
ident :: forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p Text
..}) =
   ISOMixin l NodeWrap (Parser g Text)
-> Modula2Grammar l NodeWrap (Parser g Text)
-> Product
     (ISOMixin l NodeWrap) (Modula2Grammar l NodeWrap) (Parser g Text)
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Rank2.Pair (Modula2Grammar l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
forall l (g :: (* -> *) -> *).
(Modula2 l, LexicalParsing (Parser g Text)) =>
Modula2Grammar l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
-> ISOMixin l NodeWrap (Parser g Text)
isoMixin Modula2Grammar l NodeWrap (Parser g Text)
report ISOMixin l NodeWrap (Parser g Text)
iso) (Modula2Grammar l NodeWrap (Parser g Text)
 -> Product
      (ISOMixin l NodeWrap) (Modula2Grammar l NodeWrap) (Parser g Text))
-> Modula2Grammar l NodeWrap (Parser g Text)
-> Product
     (ISOMixin l NodeWrap) (Modula2Grammar l NodeWrap) (Parser g Text)
forall a b. (a -> b) -> a -> b
$
   Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar{
      variableDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
ReportGrammar.variableDeclaration =
           NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap))
-> ((Position, ParsedLexemes, Position),
    Type l l NodeWrap NodeWrap)
-> Declaration l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
NonEmpty (f (AddressedIdent l' l' f' f'))
-> f (Type l' l' f' f') -> Declaration l l' f' f
ISO.Abstract.addressedVariableDeclaration (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap))
 -> ((Position, ParsedLexemes, Position),
     Type l l NodeWrap NodeWrap)
 -> Declaration l l NodeWrap NodeWrap)
-> Parser
     g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
      -> Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser
  g Text (NonEmpty (NodeWrap (AddressedIdent l l NodeWrap NodeWrap)))
variableIdentifierList Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
   -> Declaration l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
      -> Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
":" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
   -> Declaration l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Type l l NodeWrap NodeWrap)
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Type l l NodeWrap NodeWrap)
type_prod,
      procedureDeclaration :: Parser g Text (Declaration l l NodeWrap NodeWrap)
ReportGrammar.procedureDeclaration =
           Modula2Grammar l NodeWrap (Parser g Text)
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Declaration l l f f)
ReportGrammar.procedureDeclaration Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar
           Parser g Text (Declaration l l NodeWrap NodeWrap)
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ((Position, ParsedLexemes, Position),
 ProcedureHeading l l NodeWrap NodeWrap)
-> Declaration l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
f (ProcedureHeading l' l' f' f') -> Declaration l l' f' f
ISO.Abstract.forwardProcedureDeclaration (((Position, ParsedLexemes, Position),
  ProcedureHeading l l NodeWrap NodeWrap)
 -> Declaration l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position),
      ProcedureHeading l l NodeWrap NodeWrap)
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (ProcedureHeading l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position),
      ProcedureHeading l l NodeWrap NodeWrap)
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap ((Text, ProcedureHeading l l NodeWrap NodeWrap)
-> ProcedureHeading l l NodeWrap NodeWrap
forall a b. (a, b) -> b
snd ((Text, ProcedureHeading l l NodeWrap NodeWrap)
 -> ProcedureHeading l l NodeWrap NodeWrap)
-> Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
-> Parser g Text (ProcedureHeading l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (Text, ProcedureHeading l l NodeWrap NodeWrap)
procedureHeading)
               Parser g Text (Declaration l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
";" Parser g Text (Declaration l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Declaration l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"FORWARD",
      type_prod :: Parser g Text (Type l l NodeWrap NodeWrap)
ReportGrammar.type_prod = Modula2Grammar l NodeWrap (Parser g Text)
-> Parser g Text (Type l l NodeWrap NodeWrap)
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Type l l f f)
ReportGrammar.type_prod Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar Parser g Text (Type l l NodeWrap NodeWrap)
-> Parser g Text (Type l l NodeWrap NodeWrap)
-> Parser g Text (Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser g Text (Type l l NodeWrap NodeWrap)
packedSetType,
      subrangeType :: Parser g Text (Type l l NodeWrap NodeWrap)
ReportGrammar.subrangeType = (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> Type l l NodeWrap NodeWrap)
-> (NodeWrap (Expression l l NodeWrap NodeWrap),
    NodeWrap (Expression l l NodeWrap NodeWrap))
-> Type l l NodeWrap NodeWrap
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((NodeWrap (Expression l l NodeWrap NodeWrap)
  -> NodeWrap (Expression l l NodeWrap NodeWrap)
  -> Type l l NodeWrap NodeWrap)
 -> (NodeWrap (Expression l l NodeWrap NodeWrap),
     NodeWrap (Expression l l NodeWrap NodeWrap))
 -> Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((NodeWrap (Expression l l NodeWrap NodeWrap),
       NodeWrap (Expression l l NodeWrap NodeWrap))
      -> Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Maybe (QualIdent l)
-> NodeWrap (Expression l l NodeWrap NodeWrap)
-> NodeWrap (Expression l l NodeWrap NodeWrap)
-> Type l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> f (ConstExpression l' l' f' f')
-> f (ConstExpression l' l' f' f')
-> Type l l' f' f
Abstract.subRange (Maybe (QualIdent l)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> Type l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text (Maybe (QualIdent l))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (QualIdent l)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text (Maybe (QualIdent l))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional Parser g Text (QualIdent l)
qualident)
                                   Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ((NodeWrap (Expression l l NodeWrap NodeWrap),
    NodeWrap (Expression l l NodeWrap NodeWrap))
   -> Type l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap),
      NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (Type l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap),
   NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap),
      NodeWrap (Expression l l NodeWrap NodeWrap))
forall (m :: * -> *) a. TokenParsing m => m a -> m a
brackets ((,) (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> (NodeWrap (Expression l l NodeWrap NodeWrap),
     NodeWrap (Expression l l NodeWrap NodeWrap)))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> (NodeWrap (Expression l l NodeWrap NodeWrap),
          NodeWrap (Expression l l NodeWrap NodeWrap)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constExpression Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> (NodeWrap (Expression l l NodeWrap NodeWrap),
       NodeWrap (Expression l l NodeWrap NodeWrap)))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> (NodeWrap (Expression l l NodeWrap NodeWrap),
          NodeWrap (Expression l l NodeWrap NodeWrap)))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
".." Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> (NodeWrap (Expression l l NodeWrap NodeWrap),
       NodeWrap (Expression l l NodeWrap NodeWrap)))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap),
      NodeWrap (Expression l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
constExpression),
      variant :: Parser g Text (Variant l l NodeWrap NodeWrap)
ReportGrammar.variant = Modula2Grammar l NodeWrap (Parser g Text)
-> Parser g Text (Variant l l NodeWrap NodeWrap)
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Variant l l f f)
ReportGrammar.variant Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar Parser g Text (Variant l l NodeWrap NodeWrap)
-> Parser g Text (Variant l l NodeWrap NodeWrap)
-> Parser g Text (Variant l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Variant l l NodeWrap NodeWrap
-> Parser g Text (Variant l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Variant l l NodeWrap NodeWrap
forall l l' (f' :: * -> *) (f :: * -> *).
Modula2 l =>
Variant l l' f' f
ISO.Abstract.emptyVariant,
      block :: Parser g Text (Block l l NodeWrap NodeWrap)
ReportGrammar.block = [NodeWrap (Declaration l l NodeWrap NodeWrap)]
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Block l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
[f (Declaration l' l' f' f')]
-> Maybe (f (StatementSequence l' l' f' f'))
-> Maybe (f (StatementSequence l' l' f' f'))
-> Maybe (f (StatementSequence l' l' f' f'))
-> Block l l' f' f
ISO.Abstract.exceptionHandlingBlock ([NodeWrap (Declaration l l NodeWrap NodeWrap)]
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Block l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text [NodeWrap (Declaration l l NodeWrap NodeWrap)]
declarationSequence
                            Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"BEGIN" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence)
                            Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"EXCEPT" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence) Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Block l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Parser g Text (Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall a. Maybe a
Nothing Parser g Text (Block l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Block l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"END",
      statement :: Parser g Text (Statement l l NodeWrap NodeWrap)
ReportGrammar.statement = Modula2Grammar l NodeWrap (Parser g Text)
-> Parser g Text (Statement l l NodeWrap NodeWrap)
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (Statement l l f f)
ReportGrammar.statement Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar Parser g Text (Statement l l NodeWrap NodeWrap)
-> Parser g Text (Statement l l NodeWrap NodeWrap)
-> Parser g Text (Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser g Text (Statement l l NodeWrap NodeWrap)
retryStatement,
      caseStatement :: Parser g Text (Statement l l NodeWrap NodeWrap)
ReportGrammar.caseStatement = NodeWrap (Expression l l NodeWrap NodeWrap)
-> [((Position, ParsedLexemes, Position),
     Case l l NodeWrap NodeWrap)]
-> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Statement l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Wirthy l =>
f (Expression l' l' f' f')
-> [f (Case l' l' f' f')]
-> Maybe (f (StatementSequence l' l' f' f'))
-> Statement l l' f' f
Abstract.caseStatement (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> [((Position, ParsedLexemes, Position),
      Case l l NodeWrap NodeWrap)]
 -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
 -> Statement l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> [((Position, ParsedLexemes, Position),
           Case l l NodeWrap NodeWrap)]
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"CASE" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> [((Position, ParsedLexemes, Position),
        Case l l NodeWrap NodeWrap)]
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Statement l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ([((Position, ParsedLexemes, Position),
        Case l l NodeWrap NodeWrap)]
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
expression
       Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ([((Position, ParsedLexemes, Position),
     Case l l NodeWrap NodeWrap)]
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Statement l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ([((Position, ParsedLexemes, Position),
        Case l l NodeWrap NodeWrap)]
      -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<*  ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"OF" Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ([((Position, ParsedLexemes, Position),
     Case l l NodeWrap NodeWrap)]
   -> Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Statement l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     [((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
      -> Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([Maybe
   ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
-> [((Position, ParsedLexemes, Position),
     Case l l NodeWrap NodeWrap)]
forall a. [Maybe a] -> [a]
catMaybes ([Maybe
    ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
 -> [((Position, ParsedLexemes, Position),
      Case l l NodeWrap NodeWrap)])
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     [Maybe
        ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     [((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe
     ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap))
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     [Maybe
        ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)]
forall (m :: * -> *) a sep. Alternative m => m a -> m sep -> m [a]
sepBy1 (Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe
        ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (Fixed
   (ParserT ((,) [[Lexeme]]))
   g
   Text
   ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)
 -> Fixed
      (ParserT ((,) [[Lexeme]]))
      g
      Text
      (Maybe
         ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe
        ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap))
forall a b. (a -> b) -> a -> b
$ Parser g Text (Case l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ((Position, ParsedLexemes, Position), Case l l NodeWrap NodeWrap)
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Case l l NodeWrap NodeWrap)
case_prod) (Text -> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Text -> Parser g Text ()
delimiter Text
"|"))
       Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
   -> Statement l l NodeWrap NodeWrap)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
-> Parser g Text (Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     (Maybe (NodeWrap (StatementSequence l l NodeWrap NodeWrap)))
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
optional (ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"ELSE" Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
-> Parser
     g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser g Text (NodeWrap (StatementSequence l l NodeWrap NodeWrap))
statementSequence) Parser g Text (Statement l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser g Text (Statement l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"END",
      factor :: Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
ReportGrammar.factor = Modula2Grammar l NodeWrap (Parser g Text)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p -> p (NodeWrap (ConstExpression l l f f))
ReportGrammar.factor Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (m :: * -> *) a. DeterministicParsing m => m a -> m a -> m a
<<|> Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Expression l l NodeWrap NodeWrap)
arrayConstructor Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (m :: * -> *) a. DeterministicParsing m => m a -> m a -> m a
<<|> Parser g Text (Expression l l NodeWrap NodeWrap)
-> Parser g Text (NodeWrap (Expression l l NodeWrap NodeWrap))
forall (g :: (* -> *) -> *) a.
Parser g Text a -> Parser g Text (NodeWrap a)
wrap Parser g Text (Expression l l NodeWrap NodeWrap)
recordConstructor,
      set :: Parser g Text (Expression l l NodeWrap NodeWrap)
ReportGrammar.set = Maybe (QualIdent l)
-> [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall l l' (f :: * -> *) (f' :: * -> *).
Modula2 l =>
Maybe (QualIdent l')
-> [f (Element l' l' f' f')] -> Expression l l' f' f
Abstract.set (Maybe (QualIdent l)
 -> [NodeWrap (Element l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> (QualIdent l -> Maybe (QualIdent l))
-> QualIdent l
-> [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Expression l l NodeWrap NodeWrap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QualIdent l -> Maybe (QualIdent l)
forall a. a -> Maybe a
Just (QualIdent l
 -> [NodeWrap (Element l l NodeWrap NodeWrap)]
 -> Expression l l NodeWrap NodeWrap)
-> Parser g Text (QualIdent l)
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     g
     Text
     ([NodeWrap (Element l l NodeWrap NodeWrap)]
      -> Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser g Text (QualIdent l)
qualident Fixed
  (ParserT ((,) [[Lexeme]]))
  g
  Text
  ([NodeWrap (Element l l NodeWrap NodeWrap)]
   -> Expression l l NodeWrap NodeWrap)
-> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
-> Parser g Text (Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser g Text [NodeWrap (Element l l NodeWrap NodeWrap)]
setConstructedValue,
      mulOperator :: Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
ReportGrammar.mulOperator = Modula2Grammar l NodeWrap (Parser g Text)
-> Parser
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Expression l l NodeWrap NodeWrap)
forall l (f :: * -> *) (p :: * -> *).
Modula2Grammar l f p
-> p (f (ConstExpression l l f f)
      -> f (ConstExpression l l f f) -> ConstExpression l l f f)
ReportGrammar.mulOperator Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar
                                  Parser
  g
  Text
  (NodeWrap (Expression l l NodeWrap NodeWrap)
   -> NodeWrap (Expression l l NodeWrap NodeWrap)
   -> Expression l l NodeWrap NodeWrap)
-> Parser
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Expression l l NodeWrap NodeWrap)
-> Parser
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> NodeWrap (Expression l l NodeWrap NodeWrap)
-> NodeWrap (Expression l l NodeWrap NodeWrap)
-> Expression l l NodeWrap NodeWrap
forall l (f :: * -> *) l' (f' :: * -> *).
Modula2 l =>
f (Expression l' l' f' f')
-> f (Expression l' l' f' f') -> Expression l l' f' f
ISO.Abstract.remainder (NodeWrap (Expression l l NodeWrap NodeWrap)
 -> NodeWrap (Expression l l NodeWrap NodeWrap)
 -> Expression l l NodeWrap NodeWrap)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
-> Parser
     g
     Text
     (NodeWrap (Expression l l NodeWrap NodeWrap)
      -> NodeWrap (Expression l l NodeWrap NodeWrap)
      -> Expression l l NodeWrap NodeWrap)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParserInput (Parser g Text)
-> Fixed (ParserT ((,) [[Lexeme]])) g Text ()
forall (m :: * -> *). LexicalParsing m => ParserInput m -> m ()
keyword ParserInput (Parser g Text)
"REM"}
   where reportGrammar :: Modula2Grammar l NodeWrap (Parser g Text)
reportGrammar = GrammarBuilder (Modula2Grammar l NodeWrap) g Parser Text
forall l (g :: (* -> *) -> *).
(Modula2 l, LexicalParsing (Parser g Text)) =>
GrammarBuilder (Modula2Grammar l NodeWrap) g Parser Text
ReportGrammar.grammar Modula2Grammar l NodeWrap (Parser g Text)
report

instance TokenParsing (Parser (ISOGrammar l) Text) where
   someSpace :: Parser (ISOGrammar l) Text ()
someSpace = Parser (ISOGrammar l) Text ()
forall (m :: * -> *). LexicalParsing m => m ()
someLexicalSpace
   token :: Parser (ISOGrammar l) Text a -> Parser (ISOGrammar l) Text a
token = Parser (ISOGrammar l) Text a -> Parser (ISOGrammar l) Text a
forall (m :: * -> *) a. LexicalParsing m => m a -> m a
lexicalToken

instance LexicalParsing (Parser (ISOGrammar l) Text) where
   lexicalComment :: Parser (ISOGrammar l) Text ()
lexicalComment = do Text
c <- Parser (ISOGrammar l) Text Text
forall (g :: (* -> *) -> *). Parser g Text Text
ReportGrammar.comment
                       ([[Lexeme]], ()) -> Parser (ISOGrammar l) Text ()
forall (m :: * -> *) a (g :: (* -> *) -> *) s.
Applicative m =>
m a -> ParserT m g s a
lift ([[Text -> Lexeme
ReportGrammar.Comment Text
c]], ())
   lexicalWhiteSpace :: Parser (ISOGrammar l) Text ()
lexicalWhiteSpace = Parser (ISOGrammar l) Text ()
forall (g :: (* -> *) -> *).
LexicalParsing (Parser g Text) =>
Parser g Text ()
ReportGrammar.whiteSpace
   isIdentifierStartChar :: Char -> Bool
isIdentifierStartChar = Char -> Bool
isLetter
   isIdentifierFollowChar :: Char -> Bool
isIdentifierFollowChar Char
c = Char -> Bool
isAlphaNum Char
c Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'_'
   identifierToken :: Parser
  (ISOGrammar l) Text (ParserInput (Parser (ISOGrammar l) Text))
-> Parser
     (ISOGrammar l) Text (ParserInput (Parser (ISOGrammar l) Text))
identifierToken Parser
  (ISOGrammar l) Text (ParserInput (Parser (ISOGrammar l) Text))
word = Parser (ISOGrammar l) Text Text -> Parser (ISOGrammar l) Text Text
forall (m :: * -> *) a. LexicalParsing m => m a -> m a
lexicalToken (do Text
w <- Parser (ISOGrammar l) Text Text
Parser
  (ISOGrammar l) Text (ParserInput (Parser (ISOGrammar l) Text))
word
                                           Bool -> Parser (ISOGrammar l) Text ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (Text
w Text -> [Text] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Text]
reservedWords)
                                           Text -> Parser (ISOGrammar l) Text Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
w)
   lexicalToken :: Parser (ISOGrammar l) Text a -> Parser (ISOGrammar l) Text a
lexicalToken Parser (ISOGrammar l) Text a
p = (Text, a) -> a
forall a b. (a, b) -> b
snd ((Text, a) -> a)
-> Fixed (ParserT ((,) [[Lexeme]])) (ISOGrammar l) Text (Text, a)
-> Parser (ISOGrammar l) Text a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (([[Lexeme]], (Text, a)) -> ([[Lexeme]], (Text, a)))
-> Fixed (ParserT ((,) [[Lexeme]])) (ISOGrammar l) Text (Text, a)
-> Fixed (ParserT ((,) [[Lexeme]])) (ISOGrammar l) Text (Text, a)
forall (m :: * -> *) a (g :: (* -> *) -> *) s.
(m a -> m a) -> ParserT m g s a -> ParserT m g s a
tmap ([[Lexeme]], (Text, a)) -> ([[Lexeme]], (Text, a))
forall b. ([[Lexeme]], (Text, b)) -> ([[Lexeme]], (Text, b))
addOtherToken (Parser (ISOGrammar l) Text a
-> Fixed
     (ParserT ((,) [[Lexeme]]))
     (ISOGrammar l)
     Text
     (ParserInput (Parser (ISOGrammar l) Text), a)
forall (m :: * -> *) a.
ConsumedInputParsing m =>
m a -> m (ParserInput m, a)
match Parser (ISOGrammar l) Text a
p) Parser (ISOGrammar l) Text a
-> Parser (ISOGrammar l) Text () -> Parser (ISOGrammar l) Text a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser (ISOGrammar l) Text ()
forall (m :: * -> *). LexicalParsing m => m ()
lexicalWhiteSpace
      where addOtherToken :: ([[Lexeme]], (Text, b)) -> ([[Lexeme]], (Text, b))
addOtherToken ([], (Text
i, b
x)) = ([[TokenType -> Text -> Lexeme
ReportGrammar.Token TokenType
Other Text
i]], (Text
i, b
x))
            addOtherToken ([[Lexeme]]
t, (Text
i, b
x)) = ([[Lexeme]]
t, (Text
i, b
x))
   keyword :: ParserInput (Parser (ISOGrammar l) Text)
-> Parser (ISOGrammar l) Text ()
keyword ParserInput (Parser (ISOGrammar l) Text)
s = Parser (ISOGrammar l) Text () -> Parser (ISOGrammar l) Text ()
forall (m :: * -> *) a. LexicalParsing m => m a -> m a
lexicalToken (ParserInput (Parser (ISOGrammar l) Text)
-> Parser
     (ISOGrammar l) Text (ParserInput (Parser (ISOGrammar l) Text))
forall (m :: * -> *).
InputParsing m =>
ParserInput m -> m (ParserInput m)
string ParserInput (Parser (ISOGrammar l) Text)
s
                             Parser (ISOGrammar l) Text Text
-> Parser (ISOGrammar l) Text () -> Parser (ISOGrammar l) Text ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Char -> Bool) -> Parser (ISOGrammar l) Text ()
forall (m :: * -> *). InputCharParsing m => (Char -> Bool) -> m ()
notSatisfyChar Char -> Bool
isAlphaNum
                             Parser (ISOGrammar l) Text ()
-> Parser (ISOGrammar l) Text () -> Parser (ISOGrammar l) Text ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ([[Lexeme]], ()) -> Parser (ISOGrammar l) Text ()
forall (m :: * -> *) a (g :: (* -> *) -> *) s.
Applicative m =>
m a -> ParserT m g s a
lift ([[TokenType -> Text -> Lexeme
ReportGrammar.Token TokenType
Keyword Text
ParserInput (Parser (ISOGrammar l) Text)
s]], ()))
               Parser (ISOGrammar l) Text ()
-> String -> Parser (ISOGrammar l) Text ()
forall (m :: * -> *) a. Parsing m => m a -> String -> m a
<?> (String
"keyword " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Text -> String
forall a. Show a => a -> String
show Text
ParserInput (Parser (ISOGrammar l) Text)
s)

reservedWords :: [Text]
reservedWords = [Text]
ReportGrammar.reservedWords [Text] -> [Text] -> [Text]
forall a. Semigroup a => a -> a -> a
<> [Text
"EXCEPT", Text
"FINALLY", Text
"FORWARD", Text
"PACKEDSET", Text
"REM", Text
"RETRY"]

$(Rank2.TH.deriveAll ''ISOMixin)

{-
compilation module = program module | definition module | implementation module,
program module =
   "MODULE", module identifier, [protection], semicolon,
   import lists, module block, module identifier, period,
module identifier = identifier,
protection = left bracket, protection expression, right bracket,
protection expression = constant expression,
definition module =
   "DEFINITION", "MODULE", module identifier, semicolon,
   import lists, definitions, "END", module identifier, period,
implementation module =
   "IMPLEMENTATION", "MODULE", module identifier, [protection], 
   semicolon, import lists, module block, module identifier, period,
import lists = {import list},
import list = simple import | unqualified import,
simple import = "IMPORT", identifier list, semicolon,
unqualified import = "FROM", module identifier, "IMPORT", identifier list, semicolon,
export list = unqualified export | qualified export,
unqualified export = "EXPORT", identifier list, semicolon,
qualified export = "EXPORT", "QUALIFIED", identifier list, semicolon,
qualified identifier = {module identifier, period}, identifier,
definitions = {definition},
definition =
   "CONST", {constant declaration, semicolon} |
   "TYPE", {type definition, semicolon} |
   "VAR", {variable declaration, semicolon} |
   procedure heading, semicolon,
procedure heading = proper procedure heading | function procedure heading,
type definition = type declaration | opaque type definition,
opaque type definition = identifier,
proper procedure heading = "PROCEDURE", procedure identifier, [formal parameters],
formal parameters = left parenthesis, [formal parameter list], right parenthesis,
formal parameter list = formal parameter, {semicolon, formal parameter},
function procedure heading = "PROCEDURE", procedure identifier, formal parameters,
   colon, function result type,
function result type = type identifier,
formal parameter = value parameter specification | variable parameter specification,
value parameter specification = identifier list, colon, formal type,
variable parameter specification = "VAR", identifier list, colon, formal type,
declarations = {declaration},
declaration =
   "CONST", {constant declaration, semicolon} |
   "TYPE", {type declaration, semicolon} |
   "VAR", {variable declaration, semicolon} |
   procedure declaration, semicolon |
   local module declaration, semicolon,
constant declaration = identifier, equals, constant expression,
type declaration = identifier, equals, type denoter,
variable declaration = variable identifier list, colon, type denoter,

variable identifier list =
   identifier, [ machine address], {comma, identifier, 
   [machine address] },
machine address =
   left bracket, value of address type, right bracket,
value of address type =
   constant expression,
procedure declaration = proper procedure declaration | function procedure declaration,
proper procedure declaration =
   proper procedure heading, semicolon, (proper procedure block, 
   procedure identifier | "FORWARD"),
procedure identifier =
   identifier,
function procedure declaration =
   function procedure heading, semicolon, (function procedure block,
    procedure identifier | "FORWARD"),
local module declaration =
   "MODULE", module identifier, [protection], semicolon,
   import lists, [export list], module block, module identifier,
type denoter =
   type identifier |new type,
ordinal type denoter =
   ordinal type identifier | new ordinal type,
type identifier =
   qualified identifier,
ordinal type identifier =
   type identifier,
new type =
   new ordinal type | set type | packedset type | pointer type |
   procedure type | array type | record type,
new ordinal type =
   enumeration type | subrange type,
enumeration type =
   left parenthesis, identifier list, right parenthesis,
identifier list =
   identifier, {comma, identifier},
subrange type =
   [range type], left bracket, constant expression, ellipsis,
   constant expression, right bracket,
range type =
   ordinal type identifier,
set type =
   "SET", "OF", base type,
base type =
   ordinal type denoter,
packedset type =
   "PACKEDSET", "OF", base type,
pointer type =
   "POINTER", "TO", bound type,
bound type =
   type denoter,
procedure type =
   proper procedure type | function procedure type,
proper procedure type =
   "PROCEDURE", [left parenthesis, [formal parameter type list],
    right parenthesis],
function procedure type =
   "PROCEDURE", left parenthesis, [formal parameter type list],
    right parenthesis, colon, function result type,
formal parameter type list =
   formal parameter type, {comma, formal parameter type},
formal parameter type =
   variable formal type | value formal type,
variable formal type =
   "VAR", formal type,
value formal type =
   formal type,
formal type =
   type identifier | open array formal type,
open array formal type =
   "ARRAY", "OF", {"ARRAY", "OF"}, type identifier,
array type =
   "ARRAY", index type, {comma, index type}, "OF", component type,
index type =
   ordinal type denoter,
component type =
   type denoter,
record type =
   "RECORD", field list, "END",
field list =
   fields, {semicolon, fields},
fields =
   [fixed fields | variant fields],
fixed fields =
   identifier list, colon, field type,
field type =
   type denoter,
variant fields =
   "CASE", [tag identifier], colon, tag type, "OF",
   variant list, "END",
tag identifier =
   identifier,
tag type =
   ordinal type identifier,
variant list =
   variant, {case separator, variant}, [variant else part],
variant else part =
   "ELSE", field list,
variant =
   [variant label list, colon, field list],
variant label list =
   variant label, {comma, variant label},
variant label =
   constant expression, [ellipsis, constant expression],
proper procedure block =
   declarations, [procedure body], "END",
procedure body =
   "BEGIN", block body,
function procedure block =
   declarations, function body, "END",
function body =
   "BEGIN", block body,
module block =
   declarations, [module body], "END",
module body =
   initialization body, [finalization body],,
initialization body =
   "BEGIN", block body,
finalization body =
   "FINALLY", block body,
block body =
   normal part, ["EXCEPT", exceptional part],
normal part =
   statement sequence,
exceptional part =
   statement sequence,
statement =
   empty statement | assignment statement | procedure call |
    return statement |retry statement | with statement |
    if statement | case statement |while statement |
    repeat statement | loop statement |exit statement |for statement,
statement sequence =
   statement, {semicolon, statement},
empty statement =
  ,
assignment statement =
   variable designator, assignment operator, expression,
procedure call =
   procedure designator, [actual parameters],
procedure designator =
   value designator,
return statement =
   simple return statement | function return statement,
simple return statement =
   "RETURN",
function return statement =
   "RETURN", expression,
retry statement =
   "RETRY",
with statement =
   "WITH", record designator, "DO", statement sequence, "END",
record designator =
   variable designator | value designator,
if statement =
   guarded statements, [if else part], "END",
guarded statements =
   "IF", boolean expression, "THEN", statement sequence,
   {"ELSIF", boolean expression, "THEN", statement sequence},
if else part =
   "ELSE", statement sequence,
boolean expression =
   expression,
case statement =
   "CASE", case selector, "OF", case list, "END",
case selector =
   ordinal expression,
case list =
   case alternative, {case separator, case alternative},
   [case else part],
case else part =
   "ELSE", statement sequence,
case alternative =
   [case label list, colon, statement sequence],
case label list =
   case label, {comma, case label},
case label =
   constant expression, [ellipsis, constant expression],
while statement =
   "WHILE", boolean expression, "DO", statement sequence, "END",
repeat statement =
   "REPEAT", statement sequence, "UNTIL", boolean expression,
loop statement =
   "LOOP", statement sequence, "END",
exit statement =
   "EXIT",
for statement =
   "FOR", control variable identifier, assignment operator, 
   initial value, "TO", final value, ["BY", step size], "DO",
   statement sequence, "END",
control variable identifier =
   identifier,
initial value =
   ordinal expression,
final value =
   ordinal expression,
step size =
   constant expression,
variable designator =
   entire designator | indexed designator |
   selected designator | dereferenced designator,
entire designator =
   qualified identifier,
indexed designator =
   array variable designator, left bracket, index expression,
   {comma, index expression}, right bracket,
array variable designator =
   variable designator,
index expression =
   ordinal expression,
selected designator =
   record variable designator, period, field identifier,
record variable designator =
   variable designator,
field identifier =
   identifier,
dereferenced designator =
   pointer variable designator, dereferencing operator,
pointer variable designator =
   variable designator,
expression =
   simple expression, [relational operator, simple expression],
simple expression =
   [sign], term, {term operator, term},
term =
   factor, {factor operator, factor},
factor =
   left parenthesis, expression, right parenthesis | 
   logical negation operator, factor |
   value designator | function call |
   value constructor | constant literal,
ordinal expression =
   expression,
relational operator =
   equals operator | inequality operator | less than operator |
   greater than operator | less than or equal operator |
   subset operator | greater than or equal operator | 
   superset operator | set membership operator,
term operator =
   plus operator | set union operator | minus operator |
   set difference operator | logical disjunction operator | 
   string catenate symbol,
factor operator =
   multiplication operator | set intersection operator | 
   division operator | symmetric set difference operator |
   rem operator | div operator | mod operator |
   logical conjunction operator,
value designator =
  entire value | indexed value | selected value | dereferenced value,
entire value =
   qualified identifier,
indexed value =
   array value, left bracket, index expression,
   {comma, index expression}, right bracket,
array value =
   value designator,
selected value =
   record value, period, field identifier,
record value =
   value designator,
dereferenced value =
   pointer value, dereferencing operator,
pointer value =
   value designator,
function call =
   function designator, actual parameters,
function designator =
   value designator,
value constructor =
   array constructor | record constructor | set constructor,
array constructor =
   array type identifier, array constructed value,
array type identifier =
   type identifier,
array constructed value =
   left brace, repeated structure component,
   {comma, repeated structure component}, right brace,
repeated structure component =
   structure component, ["BY", repetition factor],
repetition factor =
   constant expression,
structure component =
   expression | array constructed value |
   record constructed value | set constructed value,
record constructor =
   record type identifier, record constructed value,
record type identifier =
   type identifier,
record constructed value =
   left brace, [structure component, {comma, structure component}],
   right brace,

set constructor =
   set type identifier, set constructed value,
set type identifier =
   type identifier,
set constructed value =
   left brace, [member, {comma, member}], right brace,
member =
   interval | singleton,
interval =
   ordinal expression, ellipsis, ordinal expression,
singleton =
   ordinal expression,
constant literal =
   whole number literal | real literal |
   string literal | pointer literal,
constant expression =
   expression,
actual parameters =
   left parenthesis, [actual parameter list], right parenthesis,
actual parameter list =
   actual parameter, {comma, actual parameter},
actual parameter =
   variable designator | expression | type parameter,
type parameter =
   type identifier,
   -}