-
|
Lexy is used to write a parser to read line-oriented syntax: each line can contain a different set of value/pair items. Lines are then processed like this: I want to save the line number for each of the lines that are read. From the documentation of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The way it's supposed to work is that you use the rule However, in your particular case, it is probably easier if you use |
Beta Was this translation helpful? Give feedback.
The way it's supposed to work is that you use the rule
dsl::positionwhich gives you an iterator into the input, then later calllexy::get_input_location()to convert the iterators into line/column numbers.However, in your particular case, it is probably easier if you use
dsl::context_counter: create one in yournr_filerule, increment it after every line and use.value()to get the line number during parsing.