[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69695] [Ruby trunk - Feature #11181] Add a line directive to Ruby
From:
shevegen@...
Date:
2015-06-21 07:13:57 UTC
List:
ruby-core #69695
Issue #11181 has been updated by Robert A. Heiler.
Today on IRC someone else also wanted such a feature:
sphex> hey. does ruby support something like "#line" directives?
sphex> I mean a cpp-like directive to let the parser know which file name / line number the input came from.
sphex> [k-: this is for generated code. I'd like to change the parser's idea of the current line number.
sphex> [k-: so that it reports the original line number from which the parsed code was generated in stack traces, syntax error exceptions, etc. C and Perl (and prolly others) change their idea of the current line number when they encounter "#line N" comments, which allows just that. (yacc/lex use that, for example)
sphex> shevy: eh, someone else already asked for this feature: https://bugs.ruby-lang.org/issues/11181
----------------------------------------
Feature #11181: Add a line directive to Ruby
https://bugs.ruby-lang.org/issues/11181#change-53071
* Author: Allen Morris
* Status: Open
* Priority: Low
* Assignee: ruby-core
----------------------------------------
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/910
The patch does not have any affect on current programs unless a line matching '#\s*line \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.
--
https://bugs.ruby-lang.org/