Class: Hermeneutics::Cli::ImapTools::Data::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/hermeneutics/cli/imap/parser.rb

Instance Method Summary collapse

Constructor Details

#initializeCompiler

Returns a new instance of Compiler.



197
198
199
# File 'lib/hermeneutics/cli/imap/parser.rb', line 197

def initialize
  @list = []
end

Instance Method Details

#add(x) ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/hermeneutics/cli/imap/parser.rb', line 214

def add x
  if @sub then
    @list.push x
  else
    if not @name then
      is_name? x or raise "Not an item name: #{x}"
      @name = x.to_sym
    else
      @list.push x
    end
  end
end

#finishObject



227
228
# File 'lib/hermeneutics/cli/imap/parser.rb', line 227

def finish
end

#resultObject



201
202
203
# File 'lib/hermeneutics/cli/imap/parser.rb', line 201

def result
  Data.new @name, *@list
end

#stepObject



205
206
207
208
209
210
211
212
# File 'lib/hermeneutics/cli/imap/parser.rb', line 205

def step
  list_, @list = @list, []
  sub_, @sub = @sub, true
  yield
ensure
  list_.push @list
  @list, @sub = list_, sub_
end