Class: Code::Parser::Name

Inherits:
Language show all
Defined in:
lib/code/parser/name.rb

Instance Method Summary collapse

Methods inherited from Language

<<, >>, absent, aka, #any, ignore, #inspect, maybe, parse, #parse, repeat, #str, then, #to_s, |

Instance Method Details

#ampersand ⇒ Object



64
65
66
# File 'lib/code/parser/name.rb', line 64

def ampersand
  str("&")
end

#character ⇒ Object



91
92
93
# File 'lib/code/parser/name.rb', line 91

def character
  special_character.absent << any
end

#closing_curly_bracket ⇒ Object



28
29
30
# File 'lib/code/parser/name.rb', line 28

def closing_curly_bracket
  str("}")
end

#closing_parenthesis ⇒ Object



44
45
46
# File 'lib/code/parser/name.rb', line 44

def closing_parenthesis
  str(")")
end

#closing_square_bracket ⇒ Object



36
37
38
# File 'lib/code/parser/name.rb', line 36

def closing_square_bracket
  str("]")
end

#colon ⇒ Object



20
21
22
# File 'lib/code/parser/name.rb', line 20

def colon
  str(":")
end

#comma ⇒ Object



12
13
14
# File 'lib/code/parser/name.rb', line 12

def comma
  str(",")
end

#do_keyword ⇒ Object



68
69
70
# File 'lib/code/parser/name.rb', line 68

def do_keyword
  str("do")
end

#dot ⇒ Object



56
57
58
# File 'lib/code/parser/name.rb', line 56

def dot
  str(".")
end

#double_quote ⇒ Object



52
53
54
# File 'lib/code/parser/name.rb', line 52

def double_quote
  str('"')
end

#else_keyword ⇒ Object



80
81
82
# File 'lib/code/parser/name.rb', line 80

def else_keyword
  str("else")
end

#elsif_keyword ⇒ Object



76
77
78
# File 'lib/code/parser/name.rb', line 76

def elsif_keyword
  str("elsif")
end

#end_keyword ⇒ Object



72
73
74
# File 'lib/code/parser/name.rb', line 72

def end_keyword
  str("end")
end

#equal ⇒ Object



16
17
18
# File 'lib/code/parser/name.rb', line 16

def equal
  str("=")
end

#newline ⇒ Object



8
9
10
# File 'lib/code/parser/name.rb', line 8

def newline
  str("\n")
end

#opening_curly_bracket ⇒ Object



24
25
26
# File 'lib/code/parser/name.rb', line 24

def opening_curly_bracket
  str("{")
end

#opening_parenthesis ⇒ Object



40
41
42
# File 'lib/code/parser/name.rb', line 40

def opening_parenthesis
  str("(")
end

#opening_square_bracket ⇒ Object



32
33
34
# File 'lib/code/parser/name.rb', line 32

def opening_square_bracket
  str("[")
end

#pipe ⇒ Object



60
61
62
# File 'lib/code/parser/name.rb', line 60

def pipe
  str("|")
end

#root ⇒ Object



99
100
101
102
103
104
# File 'lib/code/parser/name.rb', line 99

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

#separator ⇒ Object



95
96
97
# File 'lib/code/parser/name.rb', line 95

def separator
  special_character
end

#single_quote ⇒ Object



48
49
50
# File 'lib/code/parser/name.rb', line 48

def single_quote
  str("'")
end

#space ⇒ Object



4
5
6
# File 'lib/code/parser/name.rb', line 4

def space
  str(" ")
end

#special_character ⇒ Object



84
85
86
87
88
89
# File 'lib/code/parser/name.rb', line 84

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