parseIndex = foldl1' (<|>) [do lReserved $ show t; return t | t <- [minBound::IndexType ..]]
parseDeclaration :: Parsec String OFL ()
-parseDeclaration = parseValueDeclaration <|> parseIndexDeclaration
+parseDeclaration = parseValueDeclaration <|> parseIndexDeclaration <?> "declaration"
parseValueDeclaration :: Parsec String OFL ()
parseValueDeclaration = do
modifyState(\x -> addAssignment x lhs rhs)
<?> "assignment"
-parseExpression = buildExpressionParser oflOperatorTable parseTerm
+parseExpression = buildExpressionParser oflOperatorTable parseTerm <?> "expression"
parseTerm = do
lReserved "laplacian"; operand <- lParens parseExpression; return $ Laplacian operand
return $ Derivative e1 index
<?> "derivative"
-parseIdentifierAccess = do
+parseIdentifierAccess = do
ident <- parseIdentifier
indices <- option [] (lBrackets $ lCommaSep parseIdentifier)
return $ IndexedIdentifier ident indices
return $ FortranParameter properties
parseFortranParamProperty =
- parseNameProperty <|> parseTypeProperty <|> parseSpaceProperty <|> parseIndexedProperty where
+ parseNameProperty <|> parseTypeProperty <|> parseSpaceProperty <|> parseIndexedProperty <?> "Fortran parameter property" where
parseNameProperty = do _ <- lSymbol "name"; name <- lParens lStringLiteral; return $ ParamName name
parseTypeProperty = do _ <- lSymbol "type"; fType <- lParens parseFortranType; return $ ParamType fType
parseSpaceProperty = do _ <- lSymbol "space"; info <- lParens parseSpaceInfo; return $ Space info
return $ PPDFunctionSet properties
parsePPDFunctionSetProperty =
- parseBasisProperty <|> parseDataProperty where
+ parseBasisProperty <|> parseDataProperty <?> "PPD function set property" where
parseBasisProperty = do _ <- lSymbol "basis"; ident <- lParens lIdentifier; return $ PPDBasis ident
parseDataProperty = do _ <- lSymbol "data"; ident <- lParens lIdentifier; return $ PPDData ident