Sha256: 8e25e0183e0c75eb66f79dcdd6190d7e1788985df539188bea05b10ef61ee3f1

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 KB

Contents

class Code
  class Parser
    class Name < Language
      def space
        str(" ")
      end

      def newline
        str("\n")
      end

      def comma
        str(",")
      end

      def equal
        str("=")
      end

      def colon
        str(":")
      end

      def opening_curly_bracket
        str("{")
      end

      def closing_curly_bracket
        str("}")
      end

      def opening_square_bracket
        str("[")
      end

      def closing_square_bracket
        str("]")
      end

      def opening_parenthesis
        str("(")
      end

      def closing_parenthesis
        str(")")
      end

      def single_quote
        str("'")
      end

      def double_quote
        str('"')
      end

      def dot
        str(".")
      end

      def pipe
        str("|")
      end

      def ampersand
        str("&")
      end

      def do_keyword
        str("do")
      end

      def end_keyword
        str("end")
      end

      def elsif_keyword
        str("elsif")
      end

      def else_keyword
        str("else")
      end

      def special_character
        ampersand | equal | pipe | dot | colon | comma | space | newline |
          opening_curly_bracket | closing_curly_bracket | opening_parenthesis |
          closing_parenthesis | opening_square_bracket |
          closing_square_bracket | single_quote | double_quote
      end

      def character
        special_character.absent << any
      end

      def separator
        special_character
      end

      def root
        (do_keyword << separator).absent <<
          (else_keyword << separator).absent <<
          (elsif_keyword << separator).absent <<
          (end_keyword << separator).absent << character.repeat(1)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
template-ruby-0.5.6 lib/code/parser/name.rb
language-ruby-0.5.6 lib/code/parser/name.rb
code-ruby-0.5.6 lib/code/parser/name.rb
template-ruby-0.5.5 lib/code/parser/name.rb
language-ruby-0.5.5 lib/code/parser/name.rb
code-ruby-0.5.5 lib/code/parser/name.rb