This is really a question, and not an issue:
I am building an AST and want to store a source location at every node. The simplest approach is to store the result of
line_col. However, skimming the code suggests that this may not be a good idea. I believe each call to line_col may scan over every prior newline in the file:
|
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize)) { |
Is that accurate? If so, I suppose the smart approach is to store a Span, and only invoke line_col when I need to print a location.
This is really a question, and not an issue:
I am building an AST and want to store a source location at every node. The simplest approach is to store the result of
line_col. However, skimming the code suggests that this may not be a good idea. I believe each call toline_colmay scan over every prior newline in the file:grmtools/lrlex/src/lib/lexer.rs
Line 339 in 5d37c36
Is that accurate? If so, I suppose the smart approach is to store a
Span, and only invokeline_colwhen I need to print a location.