Sha256: 77299b3ce26edbcaae22e70d43e915bd63d02278ebe3a0c81c82b7f13111e4af

Contents?: true

Size: 722 Bytes

Versions: 6

Compression:

Stored size: 722 Bytes

Contents

class Code
  class Parser
    class AndOperator < Parslet::Parser
      rule(:greater_than) { ::Code::Parser::GreaterThan.new }

      rule(:ampersand) { str("&") }

      rule(:operator) { ampersand >> ampersand }

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

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

      root(:and_operator)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
template-ruby-0.4.0 lib/code/parser/and_operator.rb
code-ruby-0.4.0 lib/code/parser/and_operator.rb
template-ruby-0.3.1 lib/code/parser/and_operator.rb
code-ruby-0.3.1 lib/code/parser/and_operator.rb
template-ruby-0.3.0 lib/code/parser/and_operator.rb
code-ruby-0.3.0 lib/code/parser/and_operator.rb