diff options
| author | Simon-Kor <52245124+Simon-Kor@users.noreply.github.com> | 2024-09-23 03:14:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 03:14:06 +0200 |
| commit | 8fd49ae84e8cc4524c19b20fa0aabb4e77a46cd5 (patch) | |
| tree | 9848da3e57979a5a7e14ec99ee103cfa079e6fcb /source/Syntax/Adapt.hs | |
| parent | 18c79bcb98fb376f15b2b3e00972530df61b26a9 (diff) | |
| parent | f6b22fd533bd61e9dbcb6374295df321de99b1f2 (diff) | |
Abgabe
Submission of Formalisation
Diffstat (limited to 'source/Syntax/Adapt.hs')
| -rw-r--r-- | source/Syntax/Adapt.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/Syntax/Adapt.hs b/source/Syntax/Adapt.hs index 3a8b3d6..4b43bc6 100644 --- a/source/Syntax/Adapt.hs +++ b/source/Syntax/Adapt.hs @@ -27,13 +27,15 @@ scanChunk ltoks = matchOrErr re env pos = match re toks ?? error ("could not find lexical pattern in " <> env <> " at " <> sourcePosPretty pos) in case ltoks of Located{startPos = pos, unLocated = BeginEnv "definition"} : _ -> - matchOrErr definition "definition" (pos) + matchOrErr definition "definition" pos Located{startPos = pos, unLocated = BeginEnv "abbreviation"} : _ -> matchOrErr abbreviation "abbreviation" pos Located{startPos = pos, unLocated = (BeginEnv "struct")} :_ -> matchOrErr struct "struct definition" pos Located{startPos = pos, unLocated = (BeginEnv "inductive")} :_ -> matchOrErr inductive "inductive definition" pos + --Located{startPos = pos, unLocated = (BeginEnv "signature")} :_ -> + -- matchOrErr signatureIntro "signature" pos _ -> [] adaptChunks :: [[Located Token]] -> Lexicon -> Lexicon @@ -85,6 +87,18 @@ abbreviation = do skipUntilNextLexicalEnv pure [lexicalItem m] +signatureIntro :: RE Token [ScannedLexicalItem] --since signiture is a used word of haskell we have to name it diffrentliy +signatureIntro = do + sym (BeginEnv "signature") + few notEndOfLexicalEnvToken + m <- label + few anySym + lexicalItem <- head + few anySym + sym (EndEnv "signature") + skipUntilNextLexicalEnv + pure [lexicalItem m] + label :: RE Token Marker label = msym \case Label m -> Just (Marker m) |
