]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Shorten some line lengths.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 20 Sep 2012 15:18:16 +0000 (16:18 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 20 Sep 2012 15:18:16 +0000 (16:18 +0100)
src/Parser.hs
src/TopLevel.hs

index 472e0b7def528638051e540d7cf4114ed356fdb7..13dd462d9e8f36f26671431d92acde2aa70ef5a7 100644 (file)
@@ -203,18 +203,40 @@ parseFortranParam = do
 
 parseFortranParamProperty :: OFLParser FortranParameterProperty
 parseFortranParamProperty =
-  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
-  parseSpaceInfo = do
-    _ <- lSymbol "psinc_fine_grid"; indices <- lParens $ lCommaSep1 lIdentifier; return $ FinePsinc indices
-    <|> do _ <- lSymbol "psinc_coarse_grid"; indices <- lParens $ lCommaSep1 lIdentifier; return $ CoarsePsinc indices
-  parseIndexedProperty = do _ <- lSymbol "indexed"; indices <- lParens $ lCommaSep1 lIdentifier; return $ Indexed indices
+  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
+  parseSpaceInfo = parseFineGrid <|> parseCoarseGrid
+  parseFineGrid = do
+    _ <- lSymbol "psinc_fine_grid"
+    indices <- lParens $ lCommaSep1 lIdentifier
+    return $ FinePsinc indices
+  parseCoarseGrid = do 
+    _ <- lSymbol "psinc_coarse_grid"
+    indices <- lParens $ lCommaSep1 lIdentifier
+    return $ CoarsePsinc indices
+  parseIndexedProperty = do 
+    _ <- lSymbol "indexed"
+    indices <- lParens $ lCommaSep1 lIdentifier
+    return $ Indexed indices
 
 parseFortranType :: OFLParser FortranType
 parseFortranType = do
-  baseType <- parseBaseType;
+  baseType <- parseBaseType
   maybeIndices <- optionMaybe parseArrayIndices
   case maybeIndices of
     Nothing -> return baseType
@@ -241,9 +263,17 @@ parsePPDFunctionSet = do
 
 parsePPDFunctionSetProperty :: OFLParser PPDFunctionSetProperty
 parsePPDFunctionSetProperty =
-  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
+  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
 
 runOFLParser :: String -> Either ParseError OFL
 runOFLParser inputString = runParser parseOFL emptyOFL "" inputString
index 9d1e0f594b5e389f0498e0495fb2f0530d7e255f..c11e687954a118c7e5faeacbb0464549885b2687 100644 (file)
@@ -220,7 +220,9 @@ indexIsType ofl name indexType = if indexType == (getIndexType ofl name)
   else validationFailure $ "Expected index " ++ name ++ " to be be of type " ++ show indexType
 
 valueExists :: OFL -> String -> ValidationResult
-valueExists ofl name = if (hasValue ofl name) then validationSuccess else validationFailure $ "Unknown value " ++ name
+valueExists ofl name = if (hasValue ofl name) 
+  then validationSuccess 
+  else validationFailure $ "Unknown value " ++ name
 
 isFunction :: OFL -> Expression -> ValidationResult
 isFunction ofl e = case (getType ofl e) of