mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
776ce586bc
These capture the line and column number of the current position in the matched text. This is useful for error reporting as well as indentation checking. This works by lazily creating an index on first use that stores all newline character indices in order. We can then do a binary search on this to get both line number and column number in log(n) time. This is good enough for most use cases and doesn't slow down the common case at all - these will not be commonly used patterns in a hot loop so it is not worth to try and optimize this at all. Constant time look up should be possible but at the cost of complicating code and slowing down all matching to check for new lines. |
||
---|---|---|
.. | ||
amalg | ||
fuzzers | ||
install | ||
helper.janet | ||
suite0000.janet | ||
suite0001.janet | ||
suite0002.janet | ||
suite0003.janet | ||
suite0004.janet | ||
suite0005.janet | ||
suite0006.janet | ||
suite0007.janet | ||
suite0008.janet | ||
suite0009.janet | ||
suite0010.janet |