Sha256: 8aa9a3c69660993a735cab3db7bae02ea74e8f7fe355643edb833f23c7930155

Contents?: true

Size: 703 Bytes

Versions: 12

Compression:

Stored size: 703 Bytes

Contents

class Code
  class Parser
    class OrOperator < Parslet::Parser
      rule(:and_operator) { ::Code::Parser::AndOperator.new }

      rule(:pipe) { str("|") }

      rule(:operator) { pipe >> pipe }

      rule(:space) { str(" ") }
      rule(:newline) { str("\n") }
      rule(:whitespace) { (space | newline).repeat(1) }
      rule(:whitespace?) { whitespace.maybe }

      rule(:or_operator) do
        (
          and_operator.as(:first) >>
            (
              whitespace? >> operator.as(:operator) >> whitespace? >>
                and_operator.as(:statement)
            ).repeat(1).as(:rest)
        ).as(:or_operator) | and_operator
      end

      root(:or_operator)
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-0.4.0 lib/code/parser/or_operator.rb
code-ruby-0.4.0 lib/code/parser/or_operator.rb
template-ruby-0.3.1 lib/code/parser/or_operator.rb
code-ruby-0.3.1 lib/code/parser/or_operator.rb
template-ruby-0.3.0 lib/code/parser/or_operator.rb
code-ruby-0.3.0 lib/code/parser/or_operator.rb
code-ruby-0.2.4 lib/code/parser/or_operator.rb
template-ruby-0.2.4 lib/code/parser/or_operator.rb
template-ruby-0.2.3 lib/code/parser/or_operator.rb
template-ruby-0.2.2 lib/code/parser/or_operator.rb
template-ruby-0.2.1 lib/code/parser/or_operator.rb
template-ruby-0.2.0 lib/code/parser/or_operator.rb