]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Parse "target" line.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 13 Sep 2012 09:16:28 +0000 (10:16 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 13 Sep 2012 09:16:28 +0000 (10:16 +0100)
src/Parsing.hs

index 7e63b0e3406b9bef26c0c71c93d60e1c02ffe385..87eacaa415897529d01e10a154b3967e9b9a24d1 100644 (file)
@@ -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