| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Michelson.Parser
Synopsis
- type Parser = ReaderT LetEnv (Parsec CustomParserException Text)
- program :: Parsec CustomParserException Text (Contract' ParsedOp)
- value :: Parser ParsedValue
- data CustomParserException
- data ParseErrorBundle s e
- data ParserException = ParserException (ParseErrorBundle Text CustomParserException)
- data StringLiteralParserException
- parseNoEnv :: Parser a -> String -> Text -> Either (ParseErrorBundle Text CustomParserException) a
- parseValue :: Text -> Either ParserException ParsedValue
- parseExpandValue :: Text -> Either ParserException Value
- codeEntry :: Parser [ParsedOp]
- ops :: Parser [ParsedOp]
- type_ :: Parser Type
- letInner :: Parser ParsedOp -> Parser LetEnv
- letType :: Parser LetType
- stringLiteral :: Parser ParsedValue
- bytesLiteral :: Parser (Value' op)
- intLiteral :: Parser (Value' op)
- parsedOp :: Parser ParsedOp
- printComment :: Parser PrintComment
- utypeQ :: QuasiQuoter
- uparamTypeQ :: QuasiQuoter
- errorBundlePretty :: (Stream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
Main parser type
Parsers
program :: Parsec CustomParserException Text (Contract' ParsedOp) Source #
Michelson contract with let definitions
Errors
data CustomParserException Source #
Constructors
Instances
data ParseErrorBundle s e #
A non-empty collection of ParseErrors equipped with PosState that
allows to pretty-print the errors efficiently and correctly.
Since: megaparsec-7.0.0
Instances
data ParserException Source #
Constructors
| ParserException (ParseErrorBundle Text CustomParserException) |
Instances
| Eq ParserException Source # | |
Defined in Michelson.Parser.Error Methods (==) :: ParserException -> ParserException -> Bool # (/=) :: ParserException -> ParserException -> Bool # | |
| Show ParserException Source # | |
Defined in Michelson.Parser.Error Methods showsPrec :: Int -> ParserException -> ShowS # show :: ParserException -> String # showList :: [ParserException] -> ShowS # | |
| Exception ParserException Source # | |
Defined in Michelson.Parser.Error Methods toException :: ParserException -> SomeException # | |
| Buildable ParserException Source # | |
Defined in Michelson.Parser.Error Methods build :: ParserException -> Builder # | |
data StringLiteralParserException Source #
Constructors
| InvalidEscapeSequence Char | |
| InvalidChar Char |
Instances
Additional helpers
parseNoEnv :: Parser a -> String -> Text -> Either (ParseErrorBundle Text CustomParserException) a Source #
Parse with empty environment
parseValue :: Text -> Either ParserException ParsedValue Source #
Parse untyped value from text which comes from something that is not a file (which is often the case). So we assume it does not need any parsing environment.
parseExpandValue :: Text -> Either ParserException Value Source #
Like parseValue, but also expands macros.
For tests
codeEntry :: Parser [ParsedOp] Source #
Parses code block after "code" keyword of a contract.
This function is part of the module API, its semantics should not change.
bytesLiteral :: Parser (Value' op) Source #
intLiteral :: Parser (Value' op) Source #
Quoters
utypeQ :: QuasiQuoter Source #
Creates Type by its Morley representation.
>>>[utypeQ| (int :a | nat :b) |]Type (TOr % % (Type (Tc CInt) :a) (Type (Tc CNat) :b)) :
uparamTypeQ :: QuasiQuoter Source #
Creates ParameterType by its Morley representation.
Re-exports
Arguments
| :: (Stream s, ShowErrorComponent e) | |
| => ParseErrorBundle s e | Parse error bundle to display |
| -> String | Textual rendition of the bundle |
Pretty-print a ParseErrorBundle. All ParseErrors in the bundle will
be pretty-printed in order together with the corresponding offending
lines by doing a single efficient pass over the input stream. The
rendered String always ends with a newline.
Since: megaparsec-7.0.0