plutus-core-1.69.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

getVersion ∷ Parser (Maybe Version) Source #

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

withVersion ∷ Version → Parser a → Parser a Source #

Set the version of the program being parsed.

whenVersion ∷ (Version → Bool) → 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.

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

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

whitespace ∷ Parser () Source #

Space consumer.

reachOffsetNoLine' Source #

Arguments

∷ ∀ s. Stream s 
⇒ (Int → s → (Tokens s, s))

How to split input stream at given offset

→ (∀ b. (b → Token s → b) → b → Tokens s → b)

How to fold over input stream

→ (Token s, Token s)

Newline token and tab token

→ (Token s → Pos)

Offset to reach | Increment in column position for a token

→ Int 
→ PosState s

Initial PosState to use

→ PosState s

Updated PosState

withSpan' ∷ (SrcSpan → Parser 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 ∷ (SrcSpan → Parser a) → Parser a Source #

Like withSpan', but the result parser consumes whitespaces.

withSpan = (<* whitespace) . withSpan'

name ∷ Parser 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

liftQuote ∷ Quote a → ParsecT e s m a Source #