Clone this repo:
  1. 81fa2a5 Update travis-CI to use dev (#58) by Kevin Moore · 11 days ago master 1.8.0-nullsafety
  2. 8a85996 Delete .test_config by Kevin Moore · 11 days ago
  3. 94833d6 update for the 2.10 dev sdk (#57) by Jacob MacDonald · 3 weeks ago
  4. 9c3335f Merge the null_safety branch into master (#56) by Jacob MacDonald · 4 weeks ago
  5. b27ac98 Add SourceSpan.subspan() (#54) by Natalie Weizenbaum · 5 months ago 1.7.0

source_span is a library for tracking locations in source code. It's designed to provide a standard representation for source code locations and spans so that disparate packages can easily pass them among one another, and to make it easy to generate human-friendly messages associated with a given piece of code.

The most commonly-used class is the package's namesake, SourceSpan. It represents a span of characters in some source file, and is often attached to an object that has been parsed to indicate where it was parsed from. It provides access to the text of the span via SourceSpan.text and can be used to produce human-friendly messages using SourceSpan.message().

When parsing code from a file, SourceFile is useful. Not only does it provide an efficient means of computing line and column numbers, SourceFile.span() returns special FileSpans that are able to provide more context for their error messages.