Module: Eggshell::Compiler

Defined in:
lib/eggshell/compiler.rb

Defined Under Namespace

Modules: Assembler Classes: DefaultAssembler

Constant Summary collapse

BODY =
<<-DOC
	processor = @eggshell
	out = @out
	call_depth = 0
DOC
BODY_MACRO =
<<-DOC
	processor = @eggshell
DOC
LINE_OUT =
<<-DOC
	out << @@LINE@@
DOC
LINE =
<<-DOC
	lines << @@LINE@@
DOC
LINE_EGG =
<<-DOC
	lines << Eggshell::Line.new(@@LINE@@, @@TAB@@, @@INDENT@@, @@LINE_NUM@@)
DOC
BLOCK_HANDLER =
<<-DOC
	handler = processor.get_block_handler('@@HANDLER_NAME@@')
	lines = @@RAW_LINES@@
DOC
HANDLER_COMMIT =
<<-DOC
	handler.process('@@HANDLER_NAME@@', @@ARGS@@, lines, out, call_depth)
DOC
MACRO_HANDLER =
<<-DOC
	handler = processor.get_macro_handler('@@HANDLER_NAME@@')
	lines = @@RAW_LINES@@
DOC
PIPE_APPEND_START =
<<-DOC
	# pipe:append
	_handler = handler
	_out = out
	out = lines
DOC
PIPE_APPEND_END =
<<-DOC
	lines = out
	out = _out
	handler = _handler
	_out = nil
	_handler = nil
	# pipe:append:end
DOC
PIPE_INLINE_START =
<<-DOC
	# pipe:inline
	_lines = lines
	_out = out
	out = []
DOC
HANDLER_SAVE_REF =
<<-DOC
	handler_@@ID@@ = handler
	lines_@@ID@@ = lines
DOC
HANDLER_RESTORE_REF =
<<-DOC
	handler = handler_@@ID@@
	lines = lines_@@ID@@
DOC
PIPE_INLINE_END =
<<-DOC
	if _lines[-1].is_a?(Eggshell::Line)
		_lines[-1] = lines[-1].replace(_lines[-1].line.sub(Eggshell::Processor::PIPE_INLINE, out.join('\\n')))
	else
		_lines[-1] = _lines[-1].sub(Eggshell::Processor::PIPE_INLINE, out.join('\\n'))
	end

	lines = _lines
	out = _out
	_out = nil
	_lines = nil
	# pipe:inline:end
DOC
BLOCK_CHAIN_APPEND =

When a block immediately follows in a block-macro chain and this block is same as initial block

<<-DOC
	lines += @@RAW_LINES@@
DOC