Class: Metal::Generator::PredLookahead

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

Instance Method Summary collapse

Constructor Details

#initialize(literal) ⇒ PredLookahead

Returns a new instance of PredLookahead.



302
303
304
# File 'lib/metal/generator.rb', line 302

def initialize(literal)
	@literal = literal
end

Instance Method Details

#generate(ctx, source) ⇒ Object



308
309
310
311
312
313
# File 'lib/metal/generator.rb', line 308

def generate(ctx, source)
	obj = ctx.rule.with_lambda(source) {
		@literal.generate(ctx, source)
	}
	source << "ctx->act_lookahead(&#{obj});\n"
end

#preprocess(ctx) ⇒ Object



305
306
307
# File 'lib/metal/generator.rb', line 305

def preprocess(ctx)
	@literal.preprocess(ctx)
end