Skip to content
Discussion options

You must be logged in to vote

The way it's supposed to work is that you use the rule dsl::position which gives you an iterator into the input, then later call lexy::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 your nr_file rule, increment it after every line and use .value() to get the line number during parsing.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@natinusala
Comment options

@foonathan
Comment options

Answer selected by matejk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants