<NME> Syntax.hs
<BEF> -- This module is based on `Reporting.Error.Syntax` in the Elm compiler
-- https://github.com/elm/compiler/blob/94715a520f499591ac6901c8c822bc87cd1af24f/compiler/src/Reporting/Error/Syntax.hs

{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE OverloadedStrings #-}
module Reporting.Error.Syntax
  ( Error(..)
--  , toReport
  --
  , ParsecError(..)
  , Message(..)
  --
--  , Module(..)
--  , Exposing(..)
--  --
--  , Decl(..)
--  , DeclType(..)
--  , TypeAlias(..)
--  , CustomType(..)
--  , DeclDef(..)
--  , Port(..)
--  --
--  , Expr(..)
--  , Record(..)
--  , Tuple(..)
--  , List(..)
--  , Func(..)
--  , Case(..)
--  , If(..)
--  , Let(..)
--  , Def(..)
--  , Destruct(..)
--  --
--  , Pattern(..)
--  , PRecord(..)
--  , PTuple(..)
--  , PList(..)
--  --
--  , Type(..)
--  , TRecord(..)
--  , TTuple(..)
  --
  , Char(..)
  , String(..)
  , Escape(..)
  , Number(..)
  --
--  , Space(..)
--  , toSpaceReport
  --
  , newline
  , freshLine
  , whitespace
  , keyword
  )
  where


import Prelude hiding (Char, String)
import qualified Prelude as Prelude

--import qualified Data.Char as Char

--import qualified Elm.ModuleName as ModuleName
--import Parse.Primitives (Row, Col)
import qualified Parse.ParsecAdapter as ParsecAdapter
--import Parse.Symbol (BadOperator(..))
--import qualified Reporting.Annotation as A
--import qualified Reporting.Doc as D
--import Parse.Symbol (BadOperator(..))
--import qualified Reporting.Annotation as A
--import qualified Reporting.Doc as D
--import qualified Reporting.Report as Report
--import qualified Reporting.Render.Code as Code



data Error
    = Parse [ParsecAdapter.Message]
--  = ModuleNameUnspecified ModuleName.Raw
--  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)
--  | UnexpectedPort A.Region
--  = ModuleNameUnspecified ModuleName.Raw
--  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)
--  | UnexpectedPort A.Region
--  | NoPorts A.Region
--  | NoPortsInPackage (A.Located Name.Name)
    deriving (Eq, Show)


instance Show ParsecAdapter.Message where
   show _ = "<Text.Parsec.Error.Message>"


-- PARSEC ADAPTER


data ParsecError
  = Nil
  | Cons Message Row Col ParsecError
  | OneOf ParsecError ParsecError
  deriving (Eq, Show)


data Message
  = Message     !Prelude.String -- raw message
  | Expect      !Prelude.String -- expecting something
  | UnExpect    !Prelude.String -- unexpected something
  | CharError     Char
  | StringError   String
  | NumberError   Number
  deriving (Eq, Show)



-- MODULE


--data Module
--  = ModuleSpace Space Row Col
--  | ModuleBadEnd Row Col
--  --
--  | ModuleProblem Row Col
--  | ModuleName Row Col
--  | ModuleExposing Exposing Row Col
--  --
--  | PortModuleProblem Row Col
--  | PortModuleName Row Col
--  | PortModuleExposing Exposing Row Col
--  --
--  | Effect Row Col
--  --
--  | FreshLine Row Col
--  --
--  | ImportStart Row Col
--  | ImportName Row Col
--  | ImportAs Row Col
--  | ImportAlias Row Col
--  | ImportExposing Row Col
--  | ImportExposingList Exposing Row Col
--  | ImportEnd Row Col -- different based on col=1 or if greater
--  --
--  | ImportIndentName Row Col
--  | ImportIndentAlias Row Col
--  | ImportIndentExposingList Row Col
--  --
--  | Infix Row Col
--  --
--  | Declarations Decl Row Col


--data Exposing
--  = ExposingSpace Space Row Col
--  | ExposingStart Row Col
--  | ExposingValue Row Col
--  | ExposingOperator Row Col
--  | ExposingOperatorReserved BadOperator Row Col
--  | ExposingOperatorRightParen Row Col
--  | ExposingTypePrivacy Row Col
--  | ExposingEnd Row Col
--  --
--  | ExposingIndentEnd Row Col
--  | ExposingIndentValue Row Col



-- DECLARATIONS


--data Decl
--  = DeclStart Row Col
--  | DeclSpace Space Row Col
--  --
--  | Port Port Row Col
--  | DeclType DeclType Row Col
--  | DeclDef Name.Name DeclDef Row Col
--  --
--  | DeclFreshLineAfterDocComment Row Col


--data DeclDef
--  = DeclDefSpace Space Row Col
--  | DeclDefEquals Row Col
--  | DeclDefType Type Row Col
--  | DeclDefArg Pattern Row Col
--  | DeclDefBody Expr Row Col
--  | DeclDefNameRepeat Row Col
--  | DeclDefNameMatch Name.Name Row Col
--  --
--  | DeclDefIndentType Row Col
--  | DeclDefIndentEquals Row Col
--  | DeclDefIndentBody Row Col


--data Port
--  = PortSpace Space Row Col
--  | PortName Row Col
--  | PortColon Row Col
--  | PortType Type Row Col
--  | PortIndentName Row Col
--  | PortIndentColon Row Col
--  | PortIndentType Row Col



-- TYPE DECLARATIONS


--data DeclType
--  = DT_Space Space Row Col
--  | DT_Name Row Col
--  | DT_Alias TypeAlias Row Col
--  | DT_Union CustomType Row Col
--  --
--  | DT_IndentName Row Col


--data TypeAlias
--  = AliasSpace Space Row Col
--  | AliasName Row Col
--  | AliasEquals Row Col
--  | AliasBody Type Row Col
--  --
--  | AliasIndentEquals Row Col
--  | AliasIndentBody Row Col


--data CustomType
--  = CT_Space Space Row Col
--  | CT_Name Row Col
--  | CT_Equals Row Col
--  | CT_Bar Row Col
--  | CT_Variant Row Col
--  | CT_VariantArg Type Row Col
--  --
--  | CT_IndentEquals Row Col
--  | CT_IndentBar Row Col
--  | CT_IndentAfterBar Row Col
--  | CT_IndentAfterEquals Row Col



---- EXPRESSIONS


--data Expr
--  = Let Let Row Col
--  | Case Case Row Col
--  | If If Row Col
--  | List List Row Col
--  | Record Record Row Col
--  | Tuple Tuple Row Col
--  | Func Func Row Col
--  --
--  | Dot Row Col
--  | Access Row Col
--  | OperatorRight Name.Name Row Col
--  | OperatorReserved BadOperator Row Col
--  --
--  | Start Row Col
--  | Char Char Row Col
--  | String String Row Col
--  | Number Number Row Col
--  | Space Space Row Col
--  | EndlessShader Row Col
--  | ShaderProblem [Char.Char] Row Col
--  | IndentOperatorRight Name.Name Row Col


--data Record
--  = RecordOpen Row Col
--  | RecordEnd Row Col
--  | RecordField Row Col
--  | RecordEquals Row Col
--  | RecordExpr Expr Row Col
--  | RecordSpace Space Row Col
--  --
--  | RecordIndentOpen Row Col
--  | RecordIndentEnd Row Col
--  | RecordIndentField Row Col
--  | RecordIndentEquals Row Col
--  | RecordIndentExpr Row Col


--data Tuple
--  = TupleExpr Expr Row Col
--  | TupleSpace Space Row Col
--  | TupleEnd Row Col
--  | TupleOperatorClose Row Col
--  | TupleOperatorReserved BadOperator Row Col
--  --
--  | TupleIndentExpr1 Row Col
--  | TupleIndentExprN Row Col
--  | TupleIndentEnd Row Col


--data List
--  = ListSpace Space Row Col
--  | ListOpen Row Col
--  | ListExpr Expr Row Col
--  | ListEnd Row Col
--  --
--  | ListIndentOpen Row Col
--  | ListIndentEnd Row Col
--  | ListIndentExpr Row Col


--data Func
--  = FuncSpace Space Row Col
--  | FuncArg Pattern Row Col
--  | FuncBody Expr Row Col
--  | FuncArrow Row Col
--  --
--  | FuncIndentArg Row Col
--  | FuncIndentArrow Row Col
--  | FuncIndentBody Row Col


--data Case
--  = CaseSpace Space Row Col
--  | CaseOf Row Col
--  | CasePattern Pattern Row Col
--  | CaseArrow Row Col
--  | CaseExpr Expr Row Col
--  | CaseBranch Expr Row Col
--  --
--  | CaseIndentOf Row Col
--  | CaseIndentExpr Row Col
--  | CaseIndentPattern Row Col
--  | CaseIndentArrow Row Col
--  | CaseIndentBranch Row Col
--  | CasePatternAlignment Word16 Row Col


--data If
--  = IfSpace Space Row Col
--  | IfThen Row Col
--  | IfElse Row Col
--  | IfElseBranchStart Row Col
--  --
--  | IfCondition Expr Row Col
--  | IfThenBranch Expr Row Col
--  | IfElseBranch Expr Row Col
--  --
--  | IfIndentCondition Row Col
--  | IfIndentThen Row Col
--  | IfIndentThenBranch Row Col
--  | IfIndentElseBranch Row Col
--  | IfIndentElse Row Col


--data Let
--  = LetSpace Space Row Col
--  | LetIn Row Col
--  | LetDefAlignment Word16 Row Col
--  | LetDefName Row Col
--  | LetDef Name.Name Def Row Col
--  | LetDestruct Destruct Row Col
--  | LetBody Expr Row Col
--  | LetIndentDef Row Col
--  | LetIndentIn Row Col
--  | LetIndentBody Row Col


--data Def
--  = DefSpace Space Row Col
--  | DefType Type Row Col
--  | DefNameRepeat Row Col
--  | DefNameMatch Name.Name Row Col
--  | DefArg Pattern Row Col
--  | DefEquals Row Col
--  | DefBody Expr Row Col
--  | DefIndentEquals Row Col
--  | DefIndentType Row Col
--  | DefIndentBody Row Col
--  | DefAlignment Word16 Row Col


--data Destruct
--  = DestructSpace Space Row Col
--  | DestructPattern Pattern Row Col
--  | DestructEquals Row Col
--  | DestructBody Expr Row Col
--  | DestructIndentEquals Row Col
--  | DestructIndentBody Row Col



-- PATTERNS


--data Pattern
--  = PRecord PRecord Row Col
--  | PTuple PTuple Row Col
--  | PList PList Row Col
--  --
--  | PStart Row Col
--  | PChar Char Row Col
--  | PString String Row Col
--  | PNumber Number Row Col
--  | PFloat Word16 Row Col
--  | PAlias Row Col
--  | PWildcardNotVar Name.Name Int Row Col
--  | PSpace Space Row Col
--  --
--  | PIndentStart Row Col
--  | PIndentAlias Row Col


--data PRecord
--  = PRecordOpen Row Col
--  | PRecordEnd Row Col
--  | PRecordField Row Col
--  | PRecordSpace Space Row Col
--  --
--  | PRecordIndentOpen Row Col
--  | PRecordIndentEnd Row Col
--  | PRecordIndentField Row Col


--data PTuple
--  = PTupleOpen Row Col
--  | PTupleEnd Row Col
--  | PTupleExpr Pattern Row Col
--  | PTupleSpace Space Row Col
--  --
--  | PTupleIndentEnd Row Col
--  | PTupleIndentExpr1 Row Col
--  | PTupleIndentExprN Row Col


--data PList
--  = PListOpen Row Col
--  | PListEnd Row Col
--  | PListExpr Pattern Row Col
--  | PListSpace Space Row Col
--  --
--  | PListIndentOpen Row Col
--  | PListIndentEnd Row Col
--  | PListIndentExpr Row Col



-- TYPES


--data Type
--  = TRecord TRecord Row Col
--  | TTuple TTuple Row Col
--  --
--  | TStart Row Col
--  | TSpace Space Row Col
--  --
--  | TIndentStart Row Col


--data TRecord
--  = TRecordOpen Row Col
--  | TRecordEnd Row Col
--  --
--  | TRecordField Row Col
--  | TRecordColon Row Col
--  | TRecordType Type Row Col
--  --
--  | TRecordSpace Space Row Col
--  --
--  | TRecordIndentOpen Row Col
--  | TRecordIndentField Row Col
--  | TRecordIndentColon Row Col
--  | TRecordIndentType Row Col
--  | TRecordIndentEnd Row Col


--data TTuple
--  = TTupleOpen Row Col
--  | TTupleEnd Row Col
--  | TTupleType Type Row Col
--  | TTupleSpace Space Row Col
--  --
--  | TTupleIndentType1 Row Col
--  | TTupleIndentTypeN Row Col
--  | TTupleIndentEnd Row Col



-- LITERALS


data Char
  = CharEndless
  | CharEscape Escape
  | CharNotString Word16
  deriving (Eq, Show)


data String
  = StringEndless_Single
  | StringEndless_Multi
  | StringEscape Escape
  deriving (Eq, Show)


data Escape
  = EscapeUnknown
  | BadUnicodeFormat Word16
  | BadUnicodeCode Word16
  | BadUnicodeLength Word16 Int Int
  deriving (Eq, Show)


data Number
  = NumberEnd
  | NumberDot Int64
  | NumberHexDigit
  | NumberNoLeadingZero
  deriving (Eq, Show)



-- TAGGING PARSE ERRORS


newline :: Prelude.String
newline = "NEWLINE"


freshLine :: Prelude.String
freshLine = "FRESH_LINE"


whitespace :: Prelude.String
whitespace = "WHITESPACE"


keyword :: Prelude.String -> Prelude.String
keyword kwd =
  "KEYWORD=" ++ kwd



-- MISC


--data Space
--  = HasTab
--  | EndlessMultiComment

<MSG> Move `ParsecAdapter.Message` into separate module

Breaks an import cycle

<DFF> @@ -63,7 +63,7 @@ import Data.Word (Word16)
 
 --import qualified Elm.ModuleName as ModuleName
 --import Parse.Primitives (Row, Col)
-import qualified Parse.ParsecAdapter as ParsecAdapter
+import qualified Parse.ParsecAdapter.Message
 --import Parse.Symbol (BadOperator(..))
 --import qualified Reporting.Annotation as A
 --import qualified Reporting.Doc as D
@@ -76,7 +76,7 @@ import qualified Parse.ParsecAdapter as ParsecAdapter
 
 
 data Error
-    = Parse [ParsecAdapter.Message]
+    = Parse [Parse.ParsecAdapter.Message.Message]
 --  = ModuleNameUnspecified ModuleName.Raw
 --  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)
 --  | UnexpectedPort A.Region
@@ -88,7 +88,7 @@ data Error
     deriving (Eq, Show)
 
 
-instance Show ParsecAdapter.Message where
+instance Show Parse.ParsecAdapter.Message.Message where
    show _ = "<Text.Parsec.Error.Message>"
 
 

{'commit': 'diff --git a/elm-format-lib/elm-format-lib.cabal b/elm-format-lib/elm-format-lib.cabal\nindex 7105387b..d39230cb 100644\n--- a/elm-format-lib/elm-format-lib.cabal\n+++ b/elm-format-lib/elm-format-lib.cabal\n@@ -63,6 +63,7 @@ common common-options\n         Parse.Number\n         Parse.Parse\n         Parse.ParsecAdapter\n+        Parse.ParsecAdapter.Message\n         Parse.Pattern\n         Parse.Primitives\n         Parse.State\ndiff --git a/elm-format-lib/src/Parse/ParsecAdapter.hs b/elm-format-lib/src/Parse/ParsecAdapter.hs\nindex af52fa46..8fda499a 100644\n--- a/elm-format-lib/src/Parse/ParsecAdapter.hs\n+++ b/elm-format-lib/src/Parse/ParsecAdapter.hs\n@@ -38,7 +38,7 @@ module Parse.ParsecAdapter\n   -- Text.Parsec.Error\n   , ParseError\n   , newErrorUnknown\n-  , Message\n+  , module Parse.ParsecAdapter.Message\n   , errorPos\n   , errorMessages\n   -- Text.Parsec.Combinator\n@@ -75,6 +75,7 @@ module Parse.ParsecAdapter\n   )\n   where\n \n+import Parse.ParsecAdapter.Message (Message(..))\n import Parse.Primitives (Row, Col)\n import qualified Parse.Primitives as EP\n import Parse.State (State(..))\n@@ -373,30 +374,6 @@ instance Show SourcePos where\n -- Text.Parsec.Error\n \n \n-data Message\n-  = SysUnExpect !String -- @ library generated unexpect\n-  | UnExpect    !String -- @ unexpected something\n-  | Expect      !String -- @ expecting something\n-  | Message     !String -- @ raw message\n-  deriving ( Typeable )\n-\n-\n-instance Enum Message where\n-    fromEnum (SysUnExpect _) = 0\n-    fromEnum (UnExpect    _) = 1\n-    fromEnum (Expect      _) = 2\n-    fromEnum (Message     _) = 3\n-    toEnum _ = error "toEnum is undefined for Message"\n-\n-\n-instance Eq Message where\n-    m1 == m2 = fromEnum m1 == fromEnum m2\n-\n-\n-instance Ord Message where\n-    compare msg1 msg2 = compare (fromEnum msg1) (fromEnum msg2)\n-\n-\n messageString :: Message -> String\n messageString (SysUnExpect s) = s\n messageString (UnExpect    s) = s\ndiff --git a/elm-format-lib/src/Parse/ParsecAdapter/Message.hs b/elm-format-lib/src/Parse/ParsecAdapter/Message.hs\nnew file mode 100644\nindex 00000000..dedbd318\n--- /dev/null\n+++ b/elm-format-lib/src/Parse/ParsecAdapter/Message.hs\n@@ -0,0 +1,28 @@\n+module Parse.ParsecAdapter.Message where\n+\n+\n+import Data.Typeable (Typeable)\n+\n+\n+data Message\n+  = SysUnExpect !String -- @ library generated unexpect\n+  | UnExpect    !String -- @ unexpected something\n+  | Expect      !String -- @ expecting something\n+  | Message     !String -- @ raw message\n+  deriving ( Typeable )\n+\n+\n+instance Enum Message where\n+    fromEnum (SysUnExpect _) = 0\n+    fromEnum (UnExpect    _) = 1\n+    fromEnum (Expect      _) = 2\n+    fromEnum (Message     _) = 3\n+    toEnum _ = error "toEnum is undefined for Message"\n+\n+\n+instance Eq Message where\n+    m1 == m2 = fromEnum m1 == fromEnum m2\n+\n+\n+instance Ord Message where\n+    compare msg1 msg2 = compare (fromEnum msg1) (fromEnum msg2)\ndiff --git a/elm-format-lib/src/Reporting/Error/Syntax.hs b/elm-format-lib/src/Reporting/Error/Syntax.hs\nindex 6290b91e..38ee7454 100644\n--- a/elm-format-lib/src/Reporting/Error/Syntax.hs\n+++ b/elm-format-lib/src/Reporting/Error/Syntax.hs\n@@ -63,7 +63,7 @@ import Data.Word (Word16)\n \n --import qualified Elm.ModuleName as ModuleName\n --import Parse.Primitives (Row, Col)\n-import qualified Parse.ParsecAdapter as ParsecAdapter\n+import qualified Parse.ParsecAdapter.Message\n --import Parse.Symbol (BadOperator(..))\n --import qualified Reporting.Annotation as A\n --import qualified Reporting.Doc as D\n@@ -76,7 +76,7 @@ import qualified Parse.ParsecAdapter as ParsecAdapter\n \n \n data Error\n-    = Parse [ParsecAdapter.Message]\n+    = Parse [Parse.ParsecAdapter.Message.Message]\n --  = ModuleNameUnspecified ModuleName.Raw\n --  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)\n --  | UnexpectedPort A.Region\n@@ -88,7 +88,7 @@ data Error\n     deriving (Eq, Show)\n \n \n-instance Show ParsecAdapter.Message where\n+instance Show Parse.ParsecAdapter.Message.Message where\n    show _ = "<Text.Parsec.Error.Message>"\n \n \n', 'commit_subject': 'Move `ParsecAdapter.Message` into separate module', 'repo_name': 'avh4/elm-format', 'committer': {'name': 'emmabastas', 'email': '7a902351eb19e50796c6086621207ffaa1d957fe@protonmail.com', 'time_sec': '1628004545', 'tz_offset': '120', 'date': {'seconds': '1628004545'}}, 'commit_tree': '47541238dba771b53622eeeedd4d5d53d5474af5', 'commit_message': 'Move `ParsecAdapter.Message` into separate module\n\nBreaks an import cycle\n', 'language_name': 'JavaScript', 'license': 'bsd-3-clause', 'hunks': '@@ -63,7 +63,7 @@ import Data.Word (Word16)\n \n --import qualified Elm.ModuleName as ModuleName\n --import Parse.Primitives (Row, Col)\n-import qualified Parse.ParsecAdapter as ParsecAdapter\n+import qualified Parse.ParsecAdapter.Message\n --import Parse.Symbol (BadOperator(..))\n --import qualified Reporting.Annotation as A\n --import qualified Reporting.Doc as D\n@@ -76,7 +76,7 @@ import qualified Parse.ParsecAdapter as ParsecAdapter\n \n \n data Error\n-    = Parse [ParsecAdapter.Message]\n+    = Parse [Parse.ParsecAdapter.Message.Message]\n --  = ModuleNameUnspecified ModuleName.Raw\n --  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)\n --  | UnexpectedPort A.Region\n@@ -88,7 +88,7 @@ data Error\n     deriving (Eq, Show)\n \n \n-instance Show ParsecAdapter.Message where\n+instance Show Parse.ParsecAdapter.Message.Message where\n    show _ = "<Text.Parsec.Error.Message>"\n \n \n', 'addition_count': 3, 'deletion_count': 3, 'src_file': 'a/elm-format-lib/src/Reporting/Error/Syntax.hs', 'tgt_file': 'b/elm-format-lib/src/Reporting/Error/Syntax.hs', 'file_extension': '.hs', 'before_file': '-- This module is based on `Reporting.Error.Syntax` in the Elm compiler\n-- https://github.com/elm/compiler/blob/94715a520f499591ac6901c8c822bc87cd1af24f/compiler/src/Reporting/Error/Syntax.hs\n\n{-# OPTIONS_GHC -Wall #-}\n{-# LANGUAGE OverloadedStrings #-}\nmodule Reporting.Error.Syntax\n  ( Error(..)\n--  , toReport\n  --\n  , ParsecError(..)\n  , Message(..)\n  --\n--  , Module(..)\n--  , Exposing(..)\n--  --\n--  , Decl(..)\n--  , DeclType(..)\n--  , TypeAlias(..)\n--  , CustomType(..)\n--  , DeclDef(..)\n--  , Port(..)\n--  --\n--  , Expr(..)\n--  , Record(..)\n--  , Tuple(..)\n--  , List(..)\n--  , Func(..)\n--  , Case(..)\n--  , If(..)\n--  , Let(..)\n--  , Def(..)\n--  , Destruct(..)\n--  --\n--  , Pattern(..)\n--  , PRecord(..)\n--  , PTuple(..)\n--  , PList(..)\n--  --\n--  , Type(..)\n--  , TRecord(..)\n--  , TTuple(..)\n  --\n  , Char(..)\n  , String(..)\n  , Escape(..)\n  , Number(..)\n  --\n--  , Space(..)\n--  , toSpaceReport\n  --\n  , newline\n  , freshLine\n  , whitespace\n  , keyword\n  )\n  where\n\n\nimport Prelude hiding (Char, String)\nimport qualified Prelude as Prelude\n\n--import qualified Data.Char as Char\n\n--import qualified Elm.ModuleName as ModuleName\n--import Parse.Primitives (Row, Col)\nimport qualified Parse.ParsecAdapter as ParsecAdapter\n--import Parse.Symbol (BadOperator(..))\n--import qualified Reporting.Annotation as A\n--import qualified Reporting.Doc as D\n--import Parse.Symbol (BadOperator(..))\n--import qualified Reporting.Annotation as A\n--import qualified Reporting.Doc as D\n--import qualified Reporting.Report as Report\n--import qualified Reporting.Render.Code as Code\n\n\n\ndata Error\n    = Parse [ParsecAdapter.Message]\n--  = ModuleNameUnspecified ModuleName.Raw\n--  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)\n--  | UnexpectedPort A.Region\n--  = ModuleNameUnspecified ModuleName.Raw\n--  | ModuleNameMismatch ModuleName.Raw (A.Located ModuleName.Raw)\n--  | UnexpectedPort A.Region\n--  | NoPorts A.Region\n--  | NoPortsInPackage (A.Located Name.Name)\n    deriving (Eq, Show)\n\n\ninstance Show ParsecAdapter.Message where\n   show _ = "<Text.Parsec.Error.Message>"\n\n\n-- PARSEC ADAPTER\n\n\ndata ParsecError\n  = Nil\n  | Cons Message Row Col ParsecError\n  | OneOf ParsecError ParsecError\n  deriving (Eq, Show)\n\n\ndata Message\n  = Message     !Prelude.String -- raw message\n  | Expect      !Prelude.String -- expecting something\n  | UnExpect    !Prelude.String -- unexpected something\n  | CharError     Char\n  | StringError   String\n  | NumberError   Number\n  deriving (Eq, Show)\n\n\n\n-- MODULE\n\n\n--data Module\n--  = ModuleSpace Space Row Col\n--  | ModuleBadEnd Row Col\n--  --\n--  | ModuleProblem Row Col\n--  | ModuleName Row Col\n--  | ModuleExposing Exposing Row Col\n--  --\n--  | PortModuleProblem Row Col\n--  | PortModuleName Row Col\n--  | PortModuleExposing Exposing Row Col\n--  --\n--  | Effect Row Col\n--  --\n--  | FreshLine Row Col\n--  --\n--  | ImportStart Row Col\n--  | ImportName Row Col\n--  | ImportAs Row Col\n--  | ImportAlias Row Col\n--  | ImportExposing Row Col\n--  | ImportExposingList Exposing Row Col\n--  | ImportEnd Row Col -- different based on col=1 or if greater\n--  --\n--  | ImportIndentName Row Col\n--  | ImportIndentAlias Row Col\n--  | ImportIndentExposingList Row Col\n--  --\n--  | Infix Row Col\n--  --\n--  | Declarations Decl Row Col\n\n\n--data Exposing\n--  = ExposingSpace Space Row Col\n--  | ExposingStart Row Col\n--  | ExposingValue Row Col\n--  | ExposingOperator Row Col\n--  | ExposingOperatorReserved BadOperator Row Col\n--  | ExposingOperatorRightParen Row Col\n--  | ExposingTypePrivacy Row Col\n--  | ExposingEnd Row Col\n--  --\n--  | ExposingIndentEnd Row Col\n--  | ExposingIndentValue Row Col\n\n\n\n-- DECLARATIONS\n\n\n--data Decl\n--  = DeclStart Row Col\n--  | DeclSpace Space Row Col\n--  --\n--  | Port Port Row Col\n--  | DeclType DeclType Row Col\n--  | DeclDef Name.Name DeclDef Row Col\n--  --\n--  | DeclFreshLineAfterDocComment Row Col\n\n\n--data DeclDef\n--  = DeclDefSpace Space Row Col\n--  | DeclDefEquals Row Col\n--  | DeclDefType Type Row Col\n--  | DeclDefArg Pattern Row Col\n--  | DeclDefBody Expr Row Col\n--  | DeclDefNameRepeat Row Col\n--  | DeclDefNameMatch Name.Name Row Col\n--  --\n--  | DeclDefIndentType Row Col\n--  | DeclDefIndentEquals Row Col\n--  | DeclDefIndentBody Row Col\n\n\n--data Port\n--  = PortSpace Space Row Col\n--  | PortName Row Col\n--  | PortColon Row Col\n--  | PortType Type Row Col\n--  | PortIndentName Row Col\n--  | PortIndentColon Row Col\n--  | PortIndentType Row Col\n\n\n\n-- TYPE DECLARATIONS\n\n\n--data DeclType\n--  = DT_Space Space Row Col\n--  | DT_Name Row Col\n--  | DT_Alias TypeAlias Row Col\n--  | DT_Union CustomType Row Col\n--  --\n--  | DT_IndentName Row Col\n\n\n--data TypeAlias\n--  = AliasSpace Space Row Col\n--  | AliasName Row Col\n--  | AliasEquals Row Col\n--  | AliasBody Type Row Col\n--  --\n--  | AliasIndentEquals Row Col\n--  | AliasIndentBody Row Col\n\n\n--data CustomType\n--  = CT_Space Space Row Col\n--  | CT_Name Row Col\n--  | CT_Equals Row Col\n--  | CT_Bar Row Col\n--  | CT_Variant Row Col\n--  | CT_VariantArg Type Row Col\n--  --\n--  | CT_IndentEquals Row Col\n--  | CT_IndentBar Row Col\n--  | CT_IndentAfterBar Row Col\n--  | CT_IndentAfterEquals Row Col\n\n\n\n---- EXPRESSIONS\n\n\n--data Expr\n--  = Let Let Row Col\n--  | Case Case Row Col\n--  | If If Row Col\n--  | List List Row Col\n--  | Record Record Row Col\n--  | Tuple Tuple Row Col\n--  | Func Func Row Col\n--  --\n--  | Dot Row Col\n--  | Access Row Col\n--  | OperatorRight Name.Name Row Col\n--  | OperatorReserved BadOperator Row Col\n--  --\n--  | Start Row Col\n--  | Char Char Row Col\n--  | String String Row Col\n--  | Number Number Row Col\n--  | Space Space Row Col\n--  | EndlessShader Row Col\n--  | ShaderProblem [Char.Char] Row Col\n--  | IndentOperatorRight Name.Name Row Col\n\n\n--data Record\n--  = RecordOpen Row Col\n--  | RecordEnd Row Col\n--  | RecordField Row Col\n--  | RecordEquals Row Col\n--  | RecordExpr Expr Row Col\n--  | RecordSpace Space Row Col\n--  --\n--  | RecordIndentOpen Row Col\n--  | RecordIndentEnd Row Col\n--  | RecordIndentField Row Col\n--  | RecordIndentEquals Row Col\n--  | RecordIndentExpr Row Col\n\n\n--data Tuple\n--  = TupleExpr Expr Row Col\n--  | TupleSpace Space Row Col\n--  | TupleEnd Row Col\n--  | TupleOperatorClose Row Col\n--  | TupleOperatorReserved BadOperator Row Col\n--  --\n--  | TupleIndentExpr1 Row Col\n--  | TupleIndentExprN Row Col\n--  | TupleIndentEnd Row Col\n\n\n--data List\n--  = ListSpace Space Row Col\n--  | ListOpen Row Col\n--  | ListExpr Expr Row Col\n--  | ListEnd Row Col\n--  --\n--  | ListIndentOpen Row Col\n--  | ListIndentEnd Row Col\n--  | ListIndentExpr Row Col\n\n\n--data Func\n--  = FuncSpace Space Row Col\n--  | FuncArg Pattern Row Col\n--  | FuncBody Expr Row Col\n--  | FuncArrow Row Col\n--  --\n--  | FuncIndentArg Row Col\n--  | FuncIndentArrow Row Col\n--  | FuncIndentBody Row Col\n\n\n--data Case\n--  = CaseSpace Space Row Col\n--  | CaseOf Row Col\n--  | CasePattern Pattern Row Col\n--  | CaseArrow Row Col\n--  | CaseExpr Expr Row Col\n--  | CaseBranch Expr Row Col\n--  --\n--  | CaseIndentOf Row Col\n--  | CaseIndentExpr Row Col\n--  | CaseIndentPattern Row Col\n--  | CaseIndentArrow Row Col\n--  | CaseIndentBranch Row Col\n--  | CasePatternAlignment Word16 Row Col\n\n\n--data If\n--  = IfSpace Space Row Col\n--  | IfThen Row Col\n--  | IfElse Row Col\n--  | IfElseBranchStart Row Col\n--  --\n--  | IfCondition Expr Row Col\n--  | IfThenBranch Expr Row Col\n--  | IfElseBranch Expr Row Col\n--  --\n--  | IfIndentCondition Row Col\n--  | IfIndentThen Row Col\n--  | IfIndentThenBranch Row Col\n--  | IfIndentElseBranch Row Col\n--  | IfIndentElse Row Col\n\n\n--data Let\n--  = LetSpace Space Row Col\n--  | LetIn Row Col\n--  | LetDefAlignment Word16 Row Col\n--  | LetDefName Row Col\n--  | LetDef Name.Name Def Row Col\n--  | LetDestruct Destruct Row Col\n--  | LetBody Expr Row Col\n--  | LetIndentDef Row Col\n--  | LetIndentIn Row Col\n--  | LetIndentBody Row Col\n\n\n--data Def\n--  = DefSpace Space Row Col\n--  | DefType Type Row Col\n--  | DefNameRepeat Row Col\n--  | DefNameMatch Name.Name Row Col\n--  | DefArg Pattern Row Col\n--  | DefEquals Row Col\n--  | DefBody Expr Row Col\n--  | DefIndentEquals Row Col\n--  | DefIndentType Row Col\n--  | DefIndentBody Row Col\n--  | DefAlignment Word16 Row Col\n\n\n--data Destruct\n--  = DestructSpace Space Row Col\n--  | DestructPattern Pattern Row Col\n--  | DestructEquals Row Col\n--  | DestructBody Expr Row Col\n--  | DestructIndentEquals Row Col\n--  | DestructIndentBody Row Col\n\n\n\n-- PATTERNS\n\n\n--data Pattern\n--  = PRecord PRecord Row Col\n--  | PTuple PTuple Row Col\n--  | PList PList Row Col\n--  --\n--  | PStart Row Col\n--  | PChar Char Row Col\n--  | PString String Row Col\n--  | PNumber Number Row Col\n--  | PFloat Word16 Row Col\n--  | PAlias Row Col\n--  | PWildcardNotVar Name.Name Int Row Col\n--  | PSpace Space Row Col\n--  --\n--  | PIndentStart Row Col\n--  | PIndentAlias Row Col\n\n\n--data PRecord\n--  = PRecordOpen Row Col\n--  | PRecordEnd Row Col\n--  | PRecordField Row Col\n--  | PRecordSpace Space Row Col\n--  --\n--  | PRecordIndentOpen Row Col\n--  | PRecordIndentEnd Row Col\n--  | PRecordIndentField Row Col\n\n\n--data PTuple\n--  = PTupleOpen Row Col\n--  | PTupleEnd Row Col\n--  | PTupleExpr Pattern Row Col\n--  | PTupleSpace Space Row Col\n--  --\n--  | PTupleIndentEnd Row Col\n--  | PTupleIndentExpr1 Row Col\n--  | PTupleIndentExprN Row Col\n\n\n--data PList\n--  = PListOpen Row Col\n--  | PListEnd Row Col\n--  | PListExpr Pattern Row Col\n--  | PListSpace Space Row Col\n--  --\n--  | PListIndentOpen Row Col\n--  | PListIndentEnd Row Col\n--  | PListIndentExpr Row Col\n\n\n\n-- TYPES\n\n\n--data Type\n--  = TRecord TRecord Row Col\n--  | TTuple TTuple Row Col\n--  --\n--  | TStart Row Col\n--  | TSpace Space Row Col\n--  --\n--  | TIndentStart Row Col\n\n\n--data TRecord\n--  = TRecordOpen Row Col\n--  | TRecordEnd Row Col\n--  --\n--  | TRecordField Row Col\n--  | TRecordColon Row Col\n--  | TRecordType Type Row Col\n--  --\n--  | TRecordSpace Space Row Col\n--  --\n--  | TRecordIndentOpen Row Col\n--  | TRecordIndentField Row Col\n--  | TRecordIndentColon Row Col\n--  | TRecordIndentType Row Col\n--  | TRecordIndentEnd Row Col\n\n\n--data TTuple\n--  = TTupleOpen Row Col\n--  | TTupleEnd Row Col\n--  | TTupleType Type Row Col\n--  | TTupleSpace Space Row Col\n--  --\n--  | TTupleIndentType1 Row Col\n--  | TTupleIndentTypeN Row Col\n--  | TTupleIndentEnd Row Col\n\n\n\n-- LITERALS\n\n\ndata Char\n  = CharEndless\n  | CharEscape Escape\n  | CharNotString Word16\n  deriving (Eq, Show)\n\n\ndata String\n  = StringEndless_Single\n  | StringEndless_Multi\n  | StringEscape Escape\n  deriving (Eq, Show)\n\n\ndata Escape\n  = EscapeUnknown\n  | BadUnicodeFormat Word16\n  | BadUnicodeCode Word16\n  | BadUnicodeLength Word16 Int Int\n  deriving (Eq, Show)\n\n\ndata Number\n  = NumberEnd\n  | NumberDot Int64\n  | NumberHexDigit\n  | NumberNoLeadingZero\n  deriving (Eq, Show)\n\n\n\n-- TAGGING PARSE ERRORS\n\n\nnewline :: Prelude.String\nnewline = "NEWLINE"\n\n\nfreshLine :: Prelude.String\nfreshLine = "FRESH_LINE"\n\n\nwhitespace :: Prelude.String\nwhitespace = "WHITESPACE"\n\n\nkeyword :: Prelude.String -> Prelude.String\nkeyword kwd =\n  "KEYWORD=" ++ kwd\n\n\n\n-- MISC\n\n\n--data Space\n--  = HasTab\n--  | EndlessMultiComment\n', 'message': 'Move `ParsecAdapter.Message` into separate module\n\nBreaks an import cycle\n', 'author_name': 'emmabastas', 'lang': 'hs'}