Sha256: 7f9c0ea7492de1d6c0596117eed8d84a489a780d70a00260b031eb4155cdcad9

Contents?: true

Size: 585 Bytes

Versions: 12

Compression:

Stored size: 585 Bytes

Contents

class Code
  class Parser
    class Power < Parslet::Parser
      rule(:negation) { ::Code::Parser::Negation.new }

      rule(:asterisk) { str("*") }

      rule(:operator) { asterisk >> asterisk }

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

      rule(:power) do
        (
          negation.as(:left) >> whitespace? >> operator >> whitespace? >>
            power.as(:right)
        ).as(:power) | negation
      end

      root(:power)
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

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