Class: Metal::Generator::LiteralQuotedToken
- Inherits:
-
Object
- Object
- Metal::Generator::LiteralQuotedToken
- Defined in:
- lib/metal/generator.rb
Instance Method Summary collapse
- #generate(ctx, source) ⇒ Object
-
#initialize(str) ⇒ LiteralQuotedToken
constructor
A new instance of LiteralQuotedToken.
- #preprocess(ctx) ⇒ Object
Constructor Details
#initialize(str) ⇒ LiteralQuotedToken
Returns a new instance of LiteralQuotedToken.
347 348 349 |
# File 'lib/metal/generator.rb', line 347 def initialize(str) @str = str end |
Instance Method Details
#generate(ctx, source) ⇒ Object
351 352 353 354 355 356 357 358 359 |
# File 'lib/metal/generator.rb', line 351 def generate(ctx, source) str, str_len = Generator.escape_quoated_string(@str) if str_len == 1 # FIXME multibyte character optimize source << "ctx->act_char(\"#{str}\",#{str_len});\n" else source << "ctx->act_token(\"#{str}\",#{str_len});\n" end end |
#preprocess(ctx) ⇒ Object
350 |
# File 'lib/metal/generator.rb', line 350 def preprocess(ctx) end |