Skip to content

Optional

xtay2 edited this page Feb 16, 2023 · 1 revision

Introduction

Optional is a terminal that combines the effect of another rule with the ability to match a blank string.

Constructors

  • Optional(Rule rule): The passed rule has to be a non optional rule.

Examples

new Optional(new Literal("abc"));

Matches

""
"   "
" abc "

Fails

"ab"
Clone this wiki locally