Class: Code::Parser::Equal

Inherits:
Language show all
Defined in:
lib/code/parser/equal.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

#ampersandObject



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

def ampersand
  str("&")
end

#asteriskObject



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

def asterisk
  str("*")
end

#caretObject



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

def caret
  str("^")
end

#dotObject



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

def dot
  str(".")
end

#equalObject



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

def equal
  str("=")
end

#equal_classObject



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

def equal_class
  ::Code::Parser::Equal
end

#greaterObject



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

def greater
  str(">")
end

#lesserObject



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

def lesser
  str("<")
end

#minusObject



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

def minus
  str("-")
end

#nameObject



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

def name
  ::Code::Parser::Name
end

#namesObject



82
83
84
# File 'lib/code/parser/equal.rb', line 82

def names
  name << (dot << name).repeat
end

#operatorObject



72
73
74
75
76
77
78
79
80
# File 'lib/code/parser/equal.rb', line 72

def operator
  equal.ignore | (plus << equal.ignore) | (minus << equal.ignore) |
    (asterisk << equal.ignore) | (slash << equal.ignore) |
    (percent << equal.ignore) | (greater << greater << equal.ignore) |
    (lesser << lesser << equal.ignore) | (ampersand << equal.ignore) |
    (pipe << equal.ignore) | (caret << equal.ignore) |
    (pipe << pipe << equal.ignore) |
    (ampersand << ampersand << equal.ignore)
end

#percentObject



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

def percent
  str("%")
end

#pipeObject



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

def pipe
  str("|")
end

#plusObject



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

def plus
  str("+")
end

#rootObject



86
87
88
89
90
91
# File 'lib/code/parser/equal.rb', line 86

def root
  (
    names.aka(:left) << whitespace? << operator.aka(:operator) <<
      whitespace? << equal_class.aka(:right)
  ).aka(:equal) | statement
end

#slashObject



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

def slash
  str("/")
end

#statementObject



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

def statement
  ::Code::Parser::Rescue
end

#whitespaceObject



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

def whitespace
  ::Code::Parser::Whitespace
end

#whitespace?Boolean

Returns:



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

def whitespace?
  whitespace.maybe
end