Skip to content

Multiple

xtay2 edited this page Mar 15, 2023 · 2 revisions

Introduction

The Multiple-terminal tries to match one rule zero or more times.

Constructors

  • Multiple(boolean optional, Rule rule): If false is passed for "optional", the rule has to match once, if it's true, it can match the empty string.
  • Multiple(boolean optional, Rule... rules): Like the default constructor, but groups the passed into an Ordered-rule.
  • Multiple(boolean optional, Function<List<Token>, TokenList> tokenFactory, Rule rule): Like the default constructor, but allows for a token-factory-method that creates a TokenList.

Examples

new Multiple(false, new Word('a', 'z'));

Matches

"this wonderful sentence"
"only lowercase"

Fails

""
"No Uppercase"
"123"
Clone this wiki locally