Class: Tco::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/tco/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(default_style = nil) ⇒ Parser

Returns a new instance of Parser.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/tco/parser.rb', line 57

def initialize(default_style=nil)
  @default_params = {
    :base_style => nil,
    :fg => nil,
    :bg => nil,
    :bright => false,
    :underline => false
  }

  if default_style
    @default_params[:fg] = default_style.fg
    @default_params[:bg] = default_style.bg
    @default_params[:bright] = default_style.bright
    @default_params[:underline] = default_style.underline
  end
end

Instance Method Details

#parse(string) ⇒ Object



74
75
76
77
78
# File 'lib/tco/parser.rb', line 74

def parse(string)
  lexer string
  parser
  @segments
end