summaryrefslogtreecommitdiff
path: root/source/Api.hs
diff options
context:
space:
mode:
authorSimon-Kor <52245124+Simon-Kor@users.noreply.github.com>2024-09-23 03:14:06 +0200
committerGitHub <noreply@github.com>2024-09-23 03:14:06 +0200
commit8fd49ae84e8cc4524c19b20fa0aabb4e77a46cd5 (patch)
tree9848da3e57979a5a7e14ec99ee103cfa079e6fcb /source/Api.hs
parent18c79bcb98fb376f15b2b3e00972530df61b26a9 (diff)
parentf6b22fd533bd61e9dbcb6374295df321de99b1f2 (diff)
Abgabe
Submission of Formalisation
Diffstat (limited to 'source/Api.hs')
-rw-r--r--source/Api.hs21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/Api.hs b/source/Api.hs
index 95d5c8c..1bdf615 100644
--- a/source/Api.hs
+++ b/source/Api.hs
@@ -17,6 +17,7 @@ module Api
, dumpTask
, verify, ProverAnswer(..), VerificationResult(..)
, exportMegalodon
+ , showFailedTask
, WithCache(..)
, WithFilter(..)
, WithOmissions(..)
@@ -29,6 +30,7 @@ module Api
, WithParseOnly(..)
, Options(..)
, WithDumpPremselTraining(..)
+ , WithFailList(..)
) where
@@ -65,6 +67,7 @@ import Text.Megaparsec hiding (parse, Token)
import UnliftIO
import UnliftIO.Directory
import UnliftIO.Environment
+import Syntax.Abstract (Formula)
-- | Follow all @\\import@ statements recursively and build a theory graph from them.
-- The @\\import@ statements should be on their own separate line and precede all
@@ -200,7 +203,9 @@ describeToken = \case
EndEnv _ -> "end of environment"
_ -> "delimiter"
-
+-- | gloss generates internal represantation of the LaTeX files.
+-- First the file will be parsed and therefore checkt for grammer.
+-- 'meaning' then transfer the raw parsed grammer to the internal semantics.
gloss :: MonadIO io => FilePath -> io ([Internal.Block], Lexicon)
gloss file = do
(blocks, lexicon) <- parse file
@@ -285,6 +290,17 @@ exportMegalodon file = do
pure (Megalodon.encodeBlocks lexicon blocks)
+
+-- | This could be expandend with the dump case, with dump off just this and if dump is on it could show the number off the task. For quick use
+showFailedTask :: (a, ProverAnswer) -> IO()
+showFailedTask (_, Yes ) = Text.putStrLn ""
+showFailedTask (_, No tptp) = Text.putStrLn (Text.pack ("\ESC[31mProver found countermodel: \ESC[0m" ++ Text.unpack(Text.unlines (take 1 (Text.splitOn "." tptp)))))
+showFailedTask (_, ContradictoryAxioms tptp) = Text.putStrLn (Text.pack ("\ESC[31mContradictory axioms: \ESC[0m" ++ Text.unpack(Text.unlines (take 1 (Text.splitOn "." tptp)))))
+showFailedTask (_, Uncertain tptp) = Text.putStrLn (Text.pack ("\ESC[31mOut of resources: \ESC[0m" ++ Text.unpack(Text.unlines (take 1 (Text.splitOn "." tptp)))))
+showFailedTask (_, Error _ tptp _) = Text.putStrLn (Text.pack ("\ESC[31mError at: \ESC[0m" ++ Text.unpack(Text.unlines (take 1 (Text.splitOn "." tptp)))))
+--showFailedTask (_, _) = Text.putStrLn "Error!"
+
+
-- | Should we use caching?
data WithCache = WithoutCache | WithCache deriving (Show, Eq)
@@ -312,6 +328,8 @@ pattern WithoutDump = WithDump ""
data WithParseOnly = WithoutParseOnly | WithParseOnly deriving (Show, Eq)
+data WithFailList = WithoutFailList | WithFailList deriving (Show, Eq)
+
data Options = Options
{ inputPath :: FilePath
@@ -327,4 +345,5 @@ data Options = Options
, withVersion :: WithVersion
, withMegalodon :: WithMegalodon
, withDumpPremselTraining :: WithDumpPremselTraining
+ , withFailList :: WithFailList
}