Module: Eggshell::Compiler::Assembler

Included in:
DefaultAssembler
Defined in:
lib/eggshell/compiler.rb

Instance Method Summary collapse

Instance Method Details

#add_func(name) ⇒ Object

Generates a new function that statements will be inserted into.



28
29
# File 'lib/eggshell/compiler.rb', line 28

def add_func(name)
end

#add_lines(lines) ⇒ Object

Inject lines into current handler. If a line is either a block or macro, call assemble() on it.



49
50
# File 'lib/eggshell/compiler.rb', line 49

def add_lines(lines)
end

#assemble(parse_tree) ⇒ Object

Iterates over each line/block/macro in the parsed document and generates events. This should also take care of detecting block-macro chains (appending and inlining macros).



24
25
# File 'lib/eggshell/compiler.rb', line 24

def assemble(parse_tree)
end

#chain_append(lines) ⇒ Object

Inserts lines from an equivalent



53
54
# File 'lib/eggshell/compiler.rb', line 53

def chain_append(lines)
end

#commit_handler(name, args) ⇒ Object



71
72
73
# File 'lib/eggshell/compiler.rb', line 71

def commit_handler(name, args)
	@pending_funcs[-1][1] << insert_statement(HANDLER_COMMIT, 'HANDLER_NAME' => name, 'ARGS' => args.inspect)
end

#do_line(line) ⇒ Object

Inserts a raw line into output.



36
37
# File 'lib/eggshell/compiler.rb', line 36

def do_line(line)
end

#init(processor, opts = {}) ⇒ Object

Sets assembler-specific options. This should initialize the main method via add_func(). (e.g. what to do in a block-macro-block chain).

Parameters:

  • Eggshell::Processor

    A reference processor instance to validate certain conditions



20
21
# File 'lib/eggshell/compiler.rb', line 20

def init(processor, opts = {})
end

#pipe_append_endObject



68
69
# File 'lib/eggshell/compiler.rb', line 68

def pipe_append_end
end

#pipe_append_startObject

Inserts statements to append macro output into previous block.



65
66
# File 'lib/eggshell/compiler.rb', line 65

def pipe_append_start
end

#pipe_inline_endObject

Inserts statements to inject inlined macro output into previous block.



61
62
# File 'lib/eggshell/compiler.rb', line 61

def pipe_inline_end
end

#pipe_inline_startObject

Inserts statements to prepare for inlined macro output.



57
58
# File 'lib/eggshell/compiler.rb', line 57

def pipe_inline_start
end

#pop_funcObject

Pops the current function off stack, sending statements to the main function.



32
33
# File 'lib/eggshell/compiler.rb', line 32

def pop_func
end

#start_block(name, args, lines) ⇒ Object

Initializes handler and lines for a block.



40
41
# File 'lib/eggshell/compiler.rb', line 40

def start_block(name, args, lines)
end

#start_macro(name, args, lines) ⇒ Object

Initializes handler and lines for a macro.



44
45
# File 'lib/eggshell/compiler.rb', line 44

def start_macro(name, args, lines)
end

#write(stream) ⇒ Object



75
76
# File 'lib/eggshell/compiler.rb', line 75

def write(stream)
end