literal {parcr}R Documentation

Matching parser input with a literal string

Description

literal tests whether a supplied string literally equals a desired value.

Usage

literal(string)

Arguments

string

string, a single-element character vector, or an object that can be coerced to a character vector.

Value

A parser.

Pseudocode

literal(a)(x): satisfy(F(y): y==a)(x)

where F is equivalent to the function declarator in R. So, we have an anonymous function in the argument of satisfy.

Examples

literal("ab") (c("ab", "cdef")) # success
literal("ab") (c("abc", "cdef")) # failure


[Package parcr version 0.5.2 Index]