Class: Code::Parser::Group

Inherits:
Language
  • Object
show all
Defined in:
lib/code/parser/group.rb

Instance Method Summary collapse

Instance Method Details

#begin_keywordObject



34
35
36
# File 'lib/code/parser/group.rb', line 34

def begin_keyword
  str("begin")
end

#closing_parenthesisObject



22
23
24
# File 'lib/code/parser/group.rb', line 22

def closing_parenthesis
  str(")")
end

#codeObject



6
7
8
# File 'lib/code/parser/group.rb', line 6

def code
  Code
end

#do_keywordObject



30
31
32
# File 'lib/code/parser/group.rb', line 30

def do_keyword
  str("do")
end

#end_keywordObject



26
27
28
# File 'lib/code/parser/group.rb', line 26

def end_keyword
  str("end")
end

#opening_parenthesisObject



18
19
20
# File 'lib/code/parser/group.rb', line 18

def opening_parenthesis
  str("(")
end

#rootObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/code/parser/group.rb', line 38

def root
  (
    opening_parenthesis.ignore << whitespace? << code <<
      (whitespace? << closing_parenthesis).maybe.ignore
  ).aka(:group) |
    (
      begin_keyword.ignore << whitespace << code <<
        (whitespace? << end_keyword).maybe.ignore
    ).aka(:group) |
    (
      do_keyword.ignore << whitespace << code <<
        (whitespace? << end_keyword).maybe.ignore
    ).aka(:group) | Call
end

#whitespaceObject



10
11
12
# File 'lib/code/parser/group.rb', line 10

def whitespace
  Whitespace
end

#whitespace?Boolean

Returns:



14
15
16
# File 'lib/code/parser/group.rb', line 14

def whitespace?
  whitespace.maybe
end