Class Parslet::Atoms::Alternative
In: lib/parslet/atoms/alternative.rb
lib/parslet/atoms/visitor.rb
Parent: Parslet::Atoms::Base

Alternative during matching. Contains a list of parslets that is tried each one in turn. Only fails if all alternatives fail.

Example:

  str('a') | str('b')   # matches either 'a' or 'b'

Methods

accept   new  

Attributes

alternatives  [R] 

Public Class methods

Constructs an Alternative instance using all given parslets in the order given. This is what happens if you call ’|’ on existing parslets, like this:

  str('a') | str('b')

Public Instance methods

Call back visitors visit_alternative method. See parslet/export for an example.

[Validate]