Sha256: 155635ad18989e4bdf2737fb1b0a589de70d70baee09fe2faea480f7cc3c3843

Contents?: true

Size: 779 Bytes

Versions: 38

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

class Code
  class Parser
    class While < Language
      def statement
        If
      end

      def whitespace
        Whitespace
      end

      def code
        Code
      end

      def while_keyword
        str("while")
      end

      def until_keyword
        str("until")
      end

      def end_keyword
        str("end")
      end

      def loop_keyword
        str("loop")
      end

      def root
        (
          (
            (
              (while_keyword | until_keyword).aka(:operator) << whitespace <<
                statement.aka(:statement)
            ) | (loop_keyword.aka(:operator) << whitespace)
          ) << code.aka(:body) << end_keyword.maybe
        ).aka(:while) | statement
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
code-ruby-0.14.9 lib/code/parser/while.rb
code-ruby-0.14.8 lib/code/parser/while.rb
code-ruby-0.14.6 lib/code/parser/while.rb
code-ruby-0.14.5 lib/code/parser/while.rb
code-ruby-0.14.4 lib/code/parser/while.rb
code-ruby-0.14.3 lib/code/parser/while.rb
code-ruby-0.14.2 lib/code/parser/while.rb
code-ruby-0.14.1 lib/code/parser/while.rb
code-ruby-0.14.0 lib/code/parser/while.rb
code-ruby-0.13.1 lib/code/parser/while.rb
code-ruby-0.13.0 lib/code/parser/while.rb
code-ruby-0.12.0 lib/code/parser/while.rb
code-ruby-0.11.0 lib/code/parser/while.rb
code-ruby-0.10.4 lib/code/parser/while.rb
code-ruby-0.10.3 lib/code/parser/while.rb
code-ruby-0.10.2 lib/code/parser/while.rb
code-ruby-0.10.1 lib/code/parser/while.rb
code-ruby-0.10.0 lib/code/parser/while.rb