ComputeOffsetAbsolute calculates the 0-based character offset from a 1-based line and 0-based column based on the absolute line and column of the SourceInfo.
(line, col int32)
| 427 | // ComputeOffsetAbsolute calculates the 0-based character offset from a 1-based line and 0-based column |
| 428 | // based on the absolute line and column of the SourceInfo. |
| 429 | func (s *SourceInfo) ComputeOffsetAbsolute(line, col int32) int32 { |
| 430 | if line == 1 { |
| 431 | return col |
| 432 | } |
| 433 | if line < 1 || line > int32(len(s.LineOffsets())) { |
| 434 | return -1 |
| 435 | } |
| 436 | offset := s.LineOffsets()[line-2] |
| 437 | return offset + col |
| 438 | } |
| 439 | |
| 440 | // Extensions returns the set of extensions present in the source. |
| 441 | func (s *SourceInfo) Extensions() []Extension { |
no test coverage detected