Class: Metal::Generator::PredLookahead
- Inherits:
-
Object
- Object
- Metal::Generator::PredLookahead
- Defined in:
- lib/metal/generator.rb
Instance Method Summary collapse
- #generate(ctx, source) ⇒ Object
-
#initialize(literal) ⇒ PredLookahead
constructor
A new instance of PredLookahead.
- #preprocess(ctx) ⇒ Object
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 |