dtpowl
changed the title
Warnings
optionally warn when encountering tabs in whitespace
Merged
5 tasks
Comment on lines +103 to +107
| let (warnings, res) = runConfiguredParser defaultParserSettings initialExtraState (some anyToken) "" s | ||
| case res of | ||
| Left peb -> | ||
| (warnings, Left peb) | ||
| Right (tokens, _acc) -> (warnings, Right tokens) |
| let cpr = parse ps s | ||
| case cpr of | ||
| let (warnings, res) = parse ps s | ||
| _ <- reportWarning $ renderWarnings warnings |
Comment on lines +10 to +11
| renderWarnings :: [ParserWarning] -> String | ||
| renderWarnings warnings = intercalate "\n" $ fmap parserWarningMessage warnings | ||
|
|
||
| -- Attempts to parse with a provided parser. If it fails with an error matching |
| -> Parser a | ||
| -> Parser a | ||
| -> Parser a | ||
| tryOrRegisterError msg f l r = do |
Comment on lines +179 to +183
| -- Due to backtracking, it is possible that we have accumulated duplicate warnings. | ||
| -- For example, if two parsers which depend on the same subparser both attempt to | ||
| -- parse the same span of input, any warnings generated by that subparser will be | ||
| -- registered twice. | ||
| filteredWarnings = Set.toList $ Set.fromList warnings |
Comment on lines +28 to +29
dtpowl marked this pull request as ready for review
May 16, 2025 18:28| let cpr = parse ps s | ||
| case cpr of | ||
| let (warnings, res) = parse ps s | ||
| _ <- traverse_ (reportWarning . parserWarningMessage) $ warnings |
Comment on lines +110 to +112
| :: (Monoid a) => [ParseResult a] -> CumulativeParseResult a | ||
| toCumulativeParseResult prs = do | ||
| let | ||
| (warnings, eithers) = sequence prs |
Comment on lines +778 to +780
| , upperCaseSettings | ||
| , lowerCaseSettings | ||
| -- ** Getters and Setters | ||
| , module Database.Persist.Quasi |
| then parserWarningMessage l <= parserWarningMessage r | ||
| else warningPos l <= warningPos r | ||
|
|
||
| -- @since 2.16.0.0 |