Class: Racc::DebugFlags

Inherits:
Object show all
Defined in:
lib/racc/debugflags.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parse = false, rule = false, token = false, state = false, la = false, prec = false, conf = false) ⇒ DebugFlags

Returns a new instance of DebugFlags.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/racc/debugflags.rb', line 34

def initialize(parse = false, rule = false, token = false, state = false,
               la = false, prec = false, conf = false)
  @parse = parse
  @rule = rule
  @token = token
  @state = state
  @la = la
  @prec = prec
  @any = (parse || rule || token || state || la || prec)
  @status_logging = conf
end

Instance Attribute Details

#laObject (readonly)

Returns the value of attribute la.



50
51
52
# File 'lib/racc/debugflags.rb', line 50

def la
  @la
end

#parseObject (readonly)

Returns the value of attribute parse.



46
47
48
# File 'lib/racc/debugflags.rb', line 46

def parse
  @parse
end

#precObject (readonly)

Returns the value of attribute prec.



51
52
53
# File 'lib/racc/debugflags.rb', line 51

def prec
  @prec
end

#ruleObject (readonly)

Returns the value of attribute rule.



47
48
49
# File 'lib/racc/debugflags.rb', line 47

def rule
  @rule
end

#stateObject (readonly)

Returns the value of attribute state.



49
50
51
# File 'lib/racc/debugflags.rb', line 49

def state
  @state
end

#status_loggingObject (readonly)

Returns the value of attribute status_logging.



57
58
59
# File 'lib/racc/debugflags.rb', line 57

def status_logging
  @status_logging
end

#tokenObject (readonly)

Returns the value of attribute token.



48
49
50
# File 'lib/racc/debugflags.rb', line 48

def token
  @token
end

Class Method Details

.parse_option_string(s) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/racc/debugflags.rb', line 16

def DebugFlags.parse_option_string(s)
  parse = rule = token = state = la = prec = conf = false
  s.split(//).each do |ch|
    case ch
    when 'p' then parse = true
    when 'r' then rule = true
    when 't' then token = true
    when 's' then state = true
    when 'l' then la = true
    when 'c' then prec = true
    when 'o' then conf = true
    else
      raise "unknown debug flag char: #{ch.inspect}"
    end
  end
  new(parse, rule, token, state, la, prec, conf)
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/racc/debugflags.rb', line 53

def any?
  @any
end