File: token_type.rb

package info (click to toggle)
ruby-hocon 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ruby: 7,903; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# encoding: utf-8

require_relative '../../hocon/impl'

class Hocon::Impl::TokenType
  START = 0
  EOF = 1
  COMMA = 2
  EQUALS = 3
  COLON = 4
  OPEN_CURLY = 5
  CLOSE_CURLY = 6
  OPEN_SQUARE = 7
  CLOSE_SQUARE = 8
  VALUE = 9
  NEWLINE = 10
  UNQUOTED_TEXT = 11
  SUBSTITUTION = 12
  PROBLEM = 13
  COMMENT = 14
  PLUS_EQUALS = 15
  IGNORED_WHITESPACE = 16

  def self.token_type_name(token_type)
    case token_type
      when START then "START"
      when EOF then "EOF"
      when COMMA then "COMMA"
      when EQUALS then "EQUALS"
      when COLON then "COLON"
      when OPEN_CURLY then "OPEN_CURLY"
      when CLOSE_CURLY then "CLOSE_CURLY"
      when OPEN_SQUARE then "OPEN_SQUARE"
      when CLOSE_SQUARE then "CLOSE_SQUARE"
      when VALUE then "VALUE"
      when NEWLINE then "NEWLINE"
      when UNQUOTED_TEXT then "UNQUOTED_TEXT"
      when SUBSTITUTION then "SUBSTITUTION"
      when PROBLEM then "PROBLEM"
      when COMMENT then "COMMENT"
      when PLUS_EQUALS then "PLUS_EQUALS"
      when IGNORED_WHITESPACE then "IGNORED_WHITESPACE"
      else raise ConfigBugOrBrokenError, "Unrecognized token type #{token_type}"
    end
  end
end