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)
| 419 | // ComputeOffsetAbsolute calculates the 0-based character offset from a 1-based line and 0-based column |
| 420 | // based on the absolute line and column of the SourceInfo. |
| 421 | func (s *SourceInfo) ComputeOffsetAbsolute(line, col int32) int32 { |
| 422 | if line == 1 { |
| 423 | return col |
| 424 | } |
| 425 | if line < 1 || line > int32(len(s.LineOffsets())) { |
| 426 | return -1 |
| 427 | } |
| 428 | offset := s.LineOffsets()[line-2] |
| 429 | return offset + col |
| 430 | } |
| 431 | |
| 432 | // Extensions returns the set of extensions present in the source. |
| 433 | func (s *SourceInfo) Extensions() []Extension { |
no test coverage detected