Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delayed parsing function to use in flex-tasks parsing #252

Closed
wants to merge 10 commits into from
4 changes: 2 additions & 2 deletions .github/actions/spelling/advice.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ If items relate to a ...

Please add a file path to the `excludes.txt` file matching the containing file.

File paths are Perl 5 Regular Expressions - you can [test](https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
File paths are Perl 5 Regular Expressions - you can [test](https://www.regexplanet.com/advanced/perl) yours before committing to verify it will match your files.

`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude README.md (on whichever branch you're using).

Expand All @@ -15,7 +15,7 @@ If items relate to a ...
If you can write a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it,
try adding it to the `patterns.txt` file.

Patterns are Perl 5 Regular Expressions - you can [test](https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
Patterns are Perl 5 Regular Expressions - you can [test](https://www.regexplanet.com/advanced/perl) yours before committing to verify it will match your lines.

Note that patterns can't match multiline strings.

Expand Down
11 changes: 0 additions & 11 deletions src/Formula/Parsing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# OPTIONS_GHC -Wno-orphans #-}
module Formula.Parsing (
module Formula.Parsing.Type,
allSymbolParser,
formulaSymbolParser,
formulaListSymbolParser,
clauseSetParser,
Expand Down Expand Up @@ -104,10 +103,6 @@ instance (Parse a, Parse b) => Parse (a,b) where
pure (a,b)


instance Parse a => Parse (Maybe a) where
parser = (tokenSymbol "Nothing" >> pure Nothing) <|> (Just <$> lexeme parser)


instance Parse Number where
parser = (lexeme numParse <?> "Number") <|> fail "Could not parse a number"
where numParse = do
Expand Down Expand Up @@ -348,18 +343,12 @@ prologClauseFormulaParser = (lexeme (emptyClauseParser <|> clauseParse) <?> "Cla
listSymbolParser :: Parser ()
listSymbolParser = tokenSymbol "[" <|> tokenSymbol "," <|> tokenSymbol "]"

maybeSymbolParser :: Parser ()
maybeSymbolParser = tokenSymbol "Nothing"

formulaSymbolParser :: Parser ()
formulaSymbolParser = void $ many logicToken

formulaListSymbolParser :: Parser ()
formulaListSymbolParser = void $ many $ logicToken <|> listSymbolParser

allSymbolParser :: Parser ()
allSymbolParser = void $ many $ try maybeSymbolParser <|> logicToken <|> listSymbolParser


instance Parse PrologClause where
parser = prologClauseFormulaParser
Expand Down
9 changes: 8 additions & 1 deletion src/Formula/Parsing/Delayed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import Text.Parsec (ParseError, parse)
import Text.Parsec.String (Parser)
import ParsingHelpers (fully)

import Control.OutputCapable.Blocks (LangM, LangM', Language, OutputCapable, english, german)
import Control.OutputCapable.Blocks (
LangM,
LangM',
Language,
OutputCapable,
english,
german,
)
import Control.Monad.State (State)
import Data.Map (Map)

Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ extra-deps:
- minisat-solver-0.1
- latex-svg-image-0.2
- git: https://github.com/fmidue/output-blocks.git
commit: d155aa5a1978329ae5ab936a78ab6dd5f74919c2
commit: 77dd77fcbb8084a31c6633089605f7654af12ece
subdirs:
- output-blocks
- git: https://github.com/fmidue/flex-tasks.git
commit: b50ab20b157f3009835da0206e4bfe8872de6f81
commit: 26c7fe304007e78f669519bb62ae374cc85281a9
subdirs:
- flex-tasks
- flex-tasks-processing
Loading