by_symbol {parcr}R Documentation

Applying a parser to individual symbols of a string

Description

Splits a string to individual symbols and then applies the parser p to the resulting character vector, otherwise the parser fails. If finish = TRUE then the parser should completely consume its input. If finish = FALSE then any remaining part of the string is discarded.

This function is identical to by_split(p, "", finish).

Usage

by_symbol(p, finish = TRUE)

Arguments

p

A parser.

finish

logical. Should the parser completely consume the string? Defaults to TRUE.

Value

A parser.

See Also

by_split()

Examples

by_symbol(exactly(3,literal("a"))) (c("aaa", "bb")) # success
by_symbol(exactly(3,literal("a"))) (c("aaaa", "bb")) # failure

[Package parcr version 0.5.2 Index]