p-hatan/ mirror

pub repository

mirror.p-hatan.ir

source_span

1.1.0

A library for identifying source spans and locations.

Download archive

Readme

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.

Changelog

1.1.0

  • Added SourceSpanWithContext: a span that also includes the full line of text that contains the span.

1.0.3

  • Cleanup equality operator to accept any Object rather than just a SourceLocation.

1.0.2

  • Avoid unintentionally allocating extra objects for internal FileSpan operations.

  • Ensure that SourceSpan.operator== works on arbitrary Objects.

1.0.1

  • Use a more compact internal representation for FileSpan.

1.0.0

This package was extracted from the source_maps package, but the API has many differences. Among them:

  • Span has been renamed to SourceSpan and Location has been renamed to SourceLocation to clarify their purpose and maintain consistency with the package name. Likewise, SpanException is now SourceSpanException and SpanFormatException is not SourceSpanFormatException.

  • FixedSpan and FixedLocation have been rolled into the Span and Location classes, respectively.

  • SourceFile is more aggressive about validating its arguments. Out-of-bounds lines, columns, and offsets will now throw errors rather than be silently clamped.

  • SourceSpan.sourceUrl, SourceLocation.sourceUrl, and SourceFile.url now return Uri objects rather than Strings. The constructors allow either Strings or Uris.

  • Span.getLocationMessage and SourceFile.getLocationMessage are now SourceSpan.message and SourceFile.message, respectively. Rather than taking both a useColor and a color parameter, they now take a single color parameter that controls both whether and which color is used.

  • Span.isIdentifier has been removed. This property doesn't make sense outside of a source map context.

  • SourceFileSegment has been removed. This class wasn't widely used and was inconsistent in its choice of which parameters were considered relative and which absolute.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add source_span
pubspec.yaml
name: source_span
version: 1.1.0
author: Dart Team <misc@dartlang.org>
description: A library for identifying source spans and locations.
homepage: http://github.com/dart-lang/source_span
dependencies:
  path: '>=1.2.0 <2.0.0'
environment:
  sdk: '>=0.8.10+6 <2.0.0'
dev_dependencies:
  unittest: '>=0.9.0 <0.12.0'

Version history

VersionPublishedArchiveSHA-256
1.0.02014-07-24T00:08:12.087240ZDownloadb293139cfacbda39d8f463828187b9de03f2d770eab942dee37d31a51741e159
1.0.22014-11-21T23:56:21.332220ZDownloadf04350df28bb147634c786d15b79d0db91d92749bfe61d0e0b97adefea997ae3
1.0.32015-01-27T23:36:54.384010ZDownloadd62bde36e2a003e505a6eb88a1a18f044a17dd50bb2ec95825b6c5e2cd8d18fd
1.1.02015-03-26T22:15:12.023690ZDownloaddfa31dfe981ac4ac76822e6601f9c68395d654a1fb8b505334304ecf22769521
1.1.12015-03-27T21:27:05.457770ZDownload919b6f2bf88e6b89afc8ff2aaacdbd7e146d930f77bdb6614224b8d3ebbf9f4c
1.1.22015-03-31T19:55:26.218560ZDownloadd850107d61180b35c16588794c9b841976524ddfacc4317455c6906ea896a87d
1.1.32015-08-18T22:02:20.558ZDownload37088e8517eb517913081ac20222306d45fe414d9e501e6b41baf14b0dd0314d
1.1.42015-08-28T01:15:40.048ZDownloadc306bd6ca08754dba4af8fbfeef680ee4a862240350c87741512f2e45ed30a98
1.1.52015-09-01T22:46:04.012ZDownload03605dfac55a9eec1b9509365af2e7976a2e328b094398e0fa59d0760c2f8a2c
1.1.62015-09-02T00:43:35.510ZDownload00da6fc846677f47673c397ebf407c63b824b63098de0a8d03f462252b82d1be
1.2.02015-09-02T20:32:43.820ZDownload228381f5844e7fbe45aab32c43bd8bbcd74adbbd61c2ab90bdd0d53f06e406d9
1.2.12015-09-30T20:38:51.964ZDownloadb852ee4fd1aa0acb15ee89724f01932173d38a4de90c55b2a1d72a69bb51f1b0
1.2.22016-03-02T20:46:37.826ZDownloadda088aef9183b68c0c44d5299c7bf0f0068ba4c0ec1f324b36e690e78c1b79ca
1.2.32016-06-09T22:38:05.703ZDownload609f429c9ccda7f509106d42ea9725fb2b2455b812b04332074037805d21eba9
1.2.42016-10-21T18:33:52.176ZDownload6cee45ee2bebbebafa7e8b11b2850e8647de9acb7e5e0ba8d27e5d1ad213c50e
1.3.02016-11-08T19:35:45.774ZDownload4f8990c5182821dd7632375ccbac47ccdf226b16a68bec356dbf46a3ecce19af
1.3.12017-01-07T01:47:03.432ZDownload32c891d21baa24013f1a516d367061862daa47039f052e322d83767cbe862725
1.4.02017-05-17T05:18:27.887288ZDownload68a6694f302fafebd49800105bf38319487cb8b127cf8ee31fc467a9d7711c41
1.4.12018-07-18T20:51:24.362698ZDownload95781967e5097aa62142359998aa3c4be5c717d862a48767cbbeb1f3a29c287e
1.5.02019-01-10T23:18:38.421891ZDownload232d786b1ddab4e17f92ed865aa1a2cba8eea817d994bcd6353a61a4d14d600d
1.5.12019-01-14T22:41:17.092205ZDownload84c694051f01da77436ed404f7eb5fdb090384fde6616b29d39528bd1ed11658
1.5.22019-01-17T22:38:43.475980ZDownloadfa8ce4a4a4ee8596a3a3d5238a7fb5ea427b538cece55293c95db786f100c49b
1.5.32019-01-24T00:50:13.815416ZDownload1e18ece6fa538eeffe2b7d6c2cedccf15cc27bfed460db4c612bcd63480a719a
1.5.42019-01-29T00:20:21.924880ZDownloadc4a5f80a11c59232cc011a6338daa723f814af4bd2f1eb1226408646e1274085
1.5.52019-02-28T22:32:10.087963ZDownloadc0802c9ba654045f5993e7cdd167ce5ea264cafe62fdab211d3338ee8f4912e4
1.6.02020-01-15T03:49:07.372381ZDownloadc3e499e549e6473b6f4e7a7aed2fb27be74a2d9f6c02b197b829c2cd7c01e760
1.7.02020-03-18T02:42:37.130706ZDownloadc8515a2573f7c0772c6f60674a2b4d5c5631de0b9f483a477d1694f2c879b00c
1.8.0-nullsafety2020-07-29T16:21:05.352748ZDownloadbe35950b7155e5650280cbd50d4cdeb47624221e82c741b406270f014edf81ba
1.8.0-nullsafety.12020-09-18T20:03:40.597406ZDownload88166fff7e102c87895b3848f7103a05ffecd1eedf2db2aaf14db76108f66247
1.8.0-nullsafety.22020-09-21T20:21:01.463061ZDownload4006c8178555df52e7647118afa77bdf3c6eb6ea3da27f800fec3ddb90953bc7
1.8.0-nullsafety.32020-10-23T20:09:00.348438ZDownloadabb70965554128fe10f7cb75e2f20255b6117fa80076b2ddb1137d78bbd2c73a
1.8.0-nullsafety.42020-11-05T01:02:44.202610ZDownload985d284510fdd8a6d411b303e2aa82cf4e1adc09c4892c06925a5ac5ec8f0538
1.8.02021-02-02T23:42:27.767202ZDownloadf4b22294de9a549967d0033d4f30fcad4f0afc200f4bf58e82d815725feec70c
1.8.12021-02-05T22:50:21.324729ZDownloadd5f89a9e52b36240a80282b3dc0667dd36e53459717bb17b8fb102d30496606a
1.8.22022-01-13T19:34:51.293243ZDownloadd77dbb9d0b7469d91e42d352334b2b4bbd5cec4379542f1bdb630db368c4d9f6
1.9.02022-04-12T19:34:46.728223ZDownloade3320978e3715725e62f04358fd249c1efe5999297b2c6acd626a817593281b0
1.9.12022-07-21T14:31:55.437658ZDownloaddd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
1.10.02023-04-05T23:54:02.366713ZDownload53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c
1.10.12024-12-11T11:13:51.416044ZDownload254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c
1.10.22026-02-05T09:07:00.222021ZDownload56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab

Dependencies

path "\u003e=1.2.0 \u003c2.0.0"