sifflet-lib-1.2.5.1: Library of modules shared by sifflet and its tests and its exporters.

Safe HaskellSafe-Infered

Sifflet.Language.Parser

Description

A parser for Sifflet input values. This is not a parser for all Sifflet expressions, but just those that might be input in textual form through the function call dialog that asks for the argument values. So, it is limited (deliberately) to data types of expressions: that is, Exprs using the constructors: ELit EList That means excluding Exprs constructed with EUndefined, ESymbol, EIf, and ECall.

Synopsis

Documentation

parseExpr :: String -> SuccFail ExprSource

Parse a Sifflet data literal (number, string, char, bool, or list), returning an Expr

parseValue :: String -> SuccFail ValueSource

Parse a Sifflet literal expression and return its Value

parseTest :: (Stream s Identity t, Show a) => Parsec s () a -> s -> IO ()

The expression parseTest p input applies a parser p against input input and prints the result to stdout. Used for testing parsers.

parseTypedInput2 :: (String, VpType) -> SuccFail ValueSource

Try to parse an input value of a specific type

parseTypedInputs2Source

Arguments

:: [String]

input strings

-> [VpType]

expected types

-> SuccFail [Value] 

Try to parse input values of specific types

parseTypedInput3 :: (String, String, VpType) -> SuccFail ValueSource

Try to parse an input value for a named variable of a specific type

parseTypedInputs3Source

Arguments

:: [String]

inputs

-> [String]

variable names

-> [VpType]

variable types

-> SuccFail [Value] 

Try to parse input values for named variables of specific types

nothingBut :: Parser a -> Parser aSource

'nothingBut p is like p, but consumes the entire input, so there must be no extraneous characters (except space) after whatever p parses.

expr :: Parser ExprSource

Parse a Sifflet data expression -- actually only a literal or a list of literals.

value :: Parser ValueSource

Parser for a Value of any type (any VpType), except that we cannot parse as VpTypeVar or VpTypeFunction.

typedValue :: VpType -> Parser ValueSource

Parser for a value with a specific VpType expected. Again, we cannot do this for VpTypeVar (why not?) or VpTypeFunction