Project

General

Profile

Actions

Feature #11181

open

Add a line directive to Ruby

Added by gam3 (Allen Morris) almost 9 years ago. Updated 15 days ago.

Status:
Assigned
Target version:
-
[ruby-core:69357]

Description

Add a line directive to Ruby

  #line {nn} ["filename"]

This is done by creating a array of filenames and using the upper bits of the line_number to determine the current filename. The original filename is in position 0.

An extra node is added by the parser that informs the compiler of the filenames so the backtrace code can also use the correct file names.

The __LINE__ and __FILE__ constants are updated and compile time warnings are also effected.

There is a pull request at https://github.com/ruby/ruby/pull/911

The patch does not have any affect on current programs unless a line matching '#\sline \d+(\s+"(.)")?\s*$' is found in the ruby source code.

More tests need to be written before this change sould be applied.

Use case:

This is helpful for debugging any generated code but is particularlly helpful for literate programming using Noweb.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0