Skip to content

Commit

Permalink
Merge pull request #45 from osvita-io/oleks-clarify-parser-impl-disti…
Browse files Browse the repository at this point in the history
…nction

Clarify relation between Parser and Parser.Impl(Mega)parsec
  • Loading branch information
oleks authored Jul 20, 2024
2 parents 922dae4 + 36b0ca0 commit 2ce277f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion remarks.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ library
, Invalid
, MergeAsts
, Parser
, Parser.ImplParsec
, Parser.ImplMegaparsec
, Pending
, PointsChecker
, PrettyPrinter
Expand Down
15 changes: 13 additions & 2 deletions src/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{-|
A wrapper module, exposing the main parsing types and functions.
For a concrete implementation, see "Parser.ImplMegaparsec".
This wrapping allows to both treat the parser as a black box (e.g.,
[Parser.BlackBoxTests](https://github.com/DIKU-EDU/remarks/blob/master/test/Parser/BlackBoxTests.hs)),
as well as import and use (i.e., test or debug)
implementation-specific details.
-}
module Parser
( ParseError
, parseString
, parseFile
) where

import Parser.ImplParsec
-- import Parser.Impl
import Parser.ImplMegaparsec
( ParseError
, parseString
, parseFile
Expand Down
11 changes: 10 additions & 1 deletion src/Parser/ImplParsec.hs → src/Parser/ImplMegaparsec.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{-# LANGUAGE DeriveGeneric #-}

module Parser.ImplParsec (parseString, parseFile, ParseError) where
{-|
An implementation of "Parser" using
[megaparsec](https://hackage.haskell.org/package/megaparsec).
The module declaration does not limit its exports to enable white-box
testing and debugging.
-}
module Parser.ImplMegaparsec where

import Ast
import Config
Expand Down

0 comments on commit 2ce277f

Please sign in to comment.