class Trenni::Template::Assembler

def expression(text)

Output a string interpolation.
def expression(text)
	# Double brackets are required here to handle expressions like #{foo rescue "bar"}.
	@code << "#{OUT}<<String(#{text});"
end

def initialize(encoding: Encoding::UTF_8)

def initialize(encoding: Encoding::UTF_8)
	@code = String.new.force_encoding(encoding)
end

def instruction(text, postfix = nil)

Output a ruby expression (or part of).
def instruction(text, postfix = nil)
	@code << text << (postfix || ';')
end

def text(text)

Output raw text to the template.
def text(text)
	text = text.gsub("'", "\\\\'")
	@code << "#{OUT}<<'#{text}';"
	
	# This is an interesting approach, but it doens't preserve newlines or tabs as raw characters, so template line numbers don't match up.
	# @parts << "#{OUT}<<#{text.dump};"
end