class Trenni::Template::Assembler
def expression(text)
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)
def instruction(text, postfix = nil) @code << text << (postfix || ';') end
def text(text)
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