Sha256: cb48cc7aac7bb67a4653f6d66571970ae355c0bb2723622a6ea0d946ca2b1e35

Contents?: true

Size: 774 Bytes

Versions: 21

Compression:

Stored size: 774 Bytes

Contents

class Code
  class Parser
    class Power < Language
      def power
        ::Code::Parser::Power
      end

      def statement
        ::Code::Parser::Negation
      end

      def whitespace
        ::Code::Parser::Whitespace
      end

      def whitespace?
        whitespace.maybe
      end

      def asterisk
        str("*")
      end

      def operator
        asterisk << asterisk
      end

      def root
        (
          statement.aka(:left) <<
            (
              whitespace? << operator.aka(:operator) << whitespace? <<
                power.aka(:right)
            ).maybe
        )
          .aka(:power)
          .then do |output|
            output[:power][:right] ? output : output[:power][:left]
          end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
template-ruby-0.5.6 lib/code/parser/power.rb
language-ruby-0.5.6 lib/code/parser/power.rb
code-ruby-0.5.6 lib/code/parser/power.rb
template-ruby-0.5.5 lib/code/parser/power.rb
language-ruby-0.5.5 lib/code/parser/power.rb
code-ruby-0.5.5 lib/code/parser/power.rb
template-ruby-0.5.4 lib/code/parser/power.rb
language-ruby-0.5.4 lib/code/parser/power.rb
code-ruby-0.5.4 lib/code/parser/power.rb
template-ruby-0.5.3 lib/code/parser/power.rb
language-ruby-0.5.3 lib/code/parser/power.rb
code-ruby-0.5.3 lib/code/parser/power.rb
template-ruby-0.5.2 lib/code/parser/power.rb
language-ruby-0.5.2 lib/code/parser/power.rb
code-ruby-0.5.2 lib/code/parser/power.rb
language-ruby-0.5.1 lib/code/parser/power.rb
template-ruby-0.5.1 lib/code/parser/power.rb
code-ruby-0.5.1 lib/code/parser/power.rb
template-ruby-0.5.0 lib/code/parser/power.rb
language-ruby-0.5.0 lib/code/parser/power.rb