Skip to content

Alteration

xtay2 edited this page Feb 16, 2023 · 1 revision

Introduction

The Alteration is a non-terminal that matches zero or one of the passed tokens, depending on wether true was passed for "optional" in the constructor.

Constructors

  • Alteration(boolean optional, String... literals): Maps the passed strings to literals. The optional tells if a blank string should get matched.
  • Alteration(boolean optional, Rule... rules): Takes at least 2 rules. The optional tells if a blank string should get matched.

Examples

new Alteration(new Word('a', 'z'), new Word('A', 'Z'));

Matches

"hello "
" HELLO"

Fails

"Hello"
"123"
Clone this wiki locally