From: Francis Russell Date: Thu, 13 Sep 2012 09:16:28 +0000 (+0100) Subject: Parse "target" line. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=fe10cdafc770470e63c9a1a8e7d2a7e797d9abe5;p=francis%2Fofc.git Parse "target" line. --- diff --git a/src/Parsing.hs b/src/Parsing.hs index 7e63b0e..87eacaa 100644 --- a/src/Parsing.hs +++ b/src/Parsing.hs @@ -12,7 +12,7 @@ oflIndexTypes = ["FunctionIndex", "SpinIndex", "SpatialIndex"] oflOperandTypes = ["Real", "Function", "Integer"] oflKeywords = oflIndexTypes ++ oflOperandTypes ++ - ["^", "+", "-", "*", "/", "laplacian", "inner", "sum", "derivative", "component"] + ["^", "+", "-", "*", "/", "laplacian", "inner", "sum", "derivative", "component", "target"] oflDef = emptyDef{ commentStart = "" , commentEnd = "" @@ -96,11 +96,16 @@ parseIdentifierAccess = do { identifier <- parseIdentifier; indices <- option [] (oflBrackets $ oflCommaSep parseIdentifier); return $ IndexedIdentifier identifier indices } "indexed identifier" - + +parseTarget = oflSymbol "target" >> oflIdentifier + parseOFL :: Parsec String OFL OFL parseOFL = do { oflWhiteSpace; many1 parseDeclaration; many1 parseAssignment; + target <- parseTarget; + many1 anyChar; + eof; getState } parseAsOFL string = runParser parseOFL emptyOFL "(unknown)" string