Sha256: 83db795261bbbf3c9302397be57b3c76b58b6fb9ca09baea3e1e382c964980b5

Contents?: true

Size: 1.6 KB

Versions: 15

Compression:

Stored size: 1.6 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 root
        do_keyword.absent << end_keyword.absent << elsif_keyword.absent <<
          else_keyword.absent << character.repeat(1)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

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