-- parsing --
-instruction :: Dict -> Parser Word32
-instruction dict = foldl1 (<|>) (fmap (\x -> try (x dict)) instructions) <* char '\n'
+instruction :: LineNo -> Dict -> Parser Word32
+instruction lno dict = foldl1 (<|>) (fmap (\x -> try (x dict)) instructions) <* char '\n' <?> (". something at line " ++ show lno ++ " is wrong (ignore line 1 hint above, but pay attention for possible line offset due to #include).")
testins :: String -> IO ()
testins input =
- case (parse (instruction dict) "" (input++"\n")) of
+ case (parse (instruction 0 dict) "" (input++"\n")) of
Left err -> do { putStr "fail :/\n"; print err}
Right x -> do { printf "0x%08X\n" x }
where