Class: Metal::Generator::LiteralCharclass

Inherits:
Object
  • Object
show all
Defined in:
lib/metal/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(set) ⇒ LiteralCharclass

Returns a new instance of LiteralCharclass.



380
381
382
# File 'lib/metal/generator.rb', line 380

def initialize(set)
	@set = set
end

Instance Method Details

#generate(ctx, source) ⇒ Object



384
385
386
387
388
389
390
# File 'lib/metal/generator.rb', line 384

def generate(ctx, source)
	set, set_len = Generator.escape_quoated_string(@set)
	reg = "[" << set << "]"  # FIXME \\A
	reg_len = set_len + 2
	# FIXME regexp precompile
	source << "ctx->act_charclass(\"#{reg}\",#{reg_len});\n"
end

#preprocess(ctx) ⇒ Object



383
# File 'lib/metal/generator.rb', line 383

def preprocess(ctx) end