diff options
| author | adelon <22380201+adelon@users.noreply.github.com> | 2024-05-16 15:59:04 +0200 |
|---|---|---|
| committer | adelon <22380201+adelon@users.noreply.github.com> | 2024-05-16 15:59:04 +0200 |
| commit | 59cec853a697a4dd793c216c9bd603bd775d6da2 (patch) | |
| tree | 03c2c4bca8af5c63d046a0ad0ca56fd89320addf /source/Syntax/Adapt.hs | |
| parent | 99c65219a7edd1e71b6af868734f77b8dd002f7c (diff) | |
Attach whitespace info to located token
Diffstat (limited to 'source/Syntax/Adapt.hs')
| -rw-r--r-- | source/Syntax/Adapt.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/Syntax/Adapt.hs b/source/Syntax/Adapt.hs index b1237d2..3a8b3d6 100644 --- a/source/Syntax/Adapt.hs +++ b/source/Syntax/Adapt.hs @@ -26,10 +26,14 @@ scanChunk ltoks = let toks = unLocated <$> ltoks matchOrErr re env pos = match re toks ?? error ("could not find lexical pattern in " <> env <> " at " <> sourcePosPretty pos) in case ltoks of - Located pos (BeginEnv "definition") : _ -> matchOrErr definition "definition" pos - Located pos (BeginEnv "abbreviation") : _ -> matchOrErr abbreviation "abbreviation" pos - Located pos (BeginEnv "struct") :_ -> matchOrErr struct "struct definition" pos - Located pos (BeginEnv "inductive") :_ -> matchOrErr inductive "inductive definition" pos + Located{startPos = pos, unLocated = BeginEnv "definition"} : _ -> + 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 _ -> [] adaptChunks :: [[Located Token]] -> Lexicon -> Lexicon |
