plutus-core-1.38.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Parser.ParserCommon

Description

Common functions for parsers of UPLC, PLC, and PIR.

Synopsis

Documentation

newtype ParserState Source #

Constructors

ParserState 

Instances

Instances details
Show ParserState Source # 
Instance details

Defined in PlutusCore.Parser.ParserCommon

getVersionParser (Maybe Version) Source #

Get the version of the program being parsed, if we know it.

withVersionVersionParser a → Parser a Source #

Set the version of the program being parsed.

whenVersion ∷ (VersionBool) → Parser () → Parser () Source #

Run an action conditionally based on a predicate on the version. If we don't know the version then the predicate is assumed to be false, i.e. we act if we _know_ the predicate is satisfied.

parse ∷ (AsParserErrorBundle e, MonadError e m, MonadQuote m) ⇒ Parser a → StringText → m a Source #

parseGen ∷ (AsParserErrorBundle e, MonadError e m, MonadQuote m) ⇒ Parser a → Text → m a Source #

Generic parser function in which the file path is just "test".

whitespaceParser () Source #

Space consumer.

withSpan' ∷ (SrcSpanParser a) → Parser a Source #

Returns a parser for a by calling the supplied function on the starting and ending positions of a.

The supplied function should usually return a parser that does not consume trailing whitespaces. Otherwise, the end position will be the first character after the trailing whitespaces.

withSpan ∷ (SrcSpanParser a) → Parser a Source #

Like withSpan', but the result parser consumes whitespaces.

@withSpan = (<* whitespace) . withSpan'

nameParser Name Source #

Parses a Name. Does not consume leading or trailing whitespaces.

Orphan instances

(Stream s, MonadQuote m) ⇒ MonadQuote (ParsecT e s m) Source # 
Instance details

Methods

liftQuoteQuote a → ParsecT e s m a Source #