Use source_span rather than source_maps in csslib.

This will release csslib 0.11.0 and html5lib 0.11.0+2.

BUG=19930
R=sigmund@google.com

Review URL: https://codereview.chromium.org//426053003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/csslib@38716 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..c466bd0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 0.11.0
+
+* Switch from `source_maps`' `Span` class to `source_span`'s `SourceSpan` class.
diff --git a/lib/css.dart b/lib/css.dart
index 2d94e5c..73400bc 100644
--- a/lib/css.dart
+++ b/lib/css.dart
@@ -7,7 +7,7 @@
 import 'dart:io';
 
 import 'package:path/path.dart' as path;
-import 'package:source_maps/span.dart' show SourceFile;
+import 'package:source_span/source_span.dart';
 
 import 'parser.dart';
 import 'visitor.dart';
@@ -36,7 +36,7 @@
     // Read the file.
     var filename = path.basename(inputPath);
     var contents = new File(inputPath).readAsStringSync();
-    var file = new SourceFile.text(inputPath, contents);
+    var file = new SourceFile(contents, url: path.toUri(inputPath));
 
     // Parse the CSS.
     var tree = _time('Parse $filename',
diff --git a/lib/parser.dart b/lib/parser.dart
index 272268b..059b75c 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -6,7 +6,7 @@
 
 import 'dart:math' as math;
 
-import 'package:source_maps/span.dart' show SourceFile, Span, FileSpan;
+import 'package:source_span/source_span.dart';
 
 import "visitor.dart";
 import 'src/messages.dart';
@@ -59,7 +59,7 @@
 
   _createMessages(errors: errors, options: options);
 
-  var file = new SourceFile.text(null, source);
+  var file = new SourceFile(source);
 
   var tree = new _Parser(file, source).parse();
 
@@ -91,7 +91,7 @@
 
   _createMessages(errors: errors, options: options);
 
-  var file = new SourceFile.text(null, source);
+  var file = new SourceFile(source);
   return new _Parser(file, source).parse();
 }
 
@@ -106,7 +106,7 @@
 
   _createMessages(errors: errors);
 
-  var file = new SourceFile.text(null, source);
+  var file = new SourceFile(source);
   return (new _Parser(file, source)
       ..tokenizer.inSelector = true)
       .parseSelector();
@@ -117,7 +117,7 @@
 
   _createMessages(errors: errors);
 
-  var file = new SourceFile.text(null, source);
+  var file = new SourceFile(source);
   return (new _Parser(file, source)
       // TODO(jmesserly): this fix should be applied to the parser. It's tricky
       // because by the time the flag is set one token has already been fetched.
@@ -320,21 +320,21 @@
     _error(message, tok.span);
   }
 
-  void _error(String message, Span location) {
+  void _error(String message, SourceSpan location) {
     if (location == null) {
       location = _peekToken.span;
     }
     messages.error(message, location);
   }
 
-  void _warning(String message, Span location) {
+  void _warning(String message, SourceSpan location) {
     if (location == null) {
       location = _peekToken.span;
     }
     messages.warning(message, location);
   }
 
-  Span _makeSpan(int start) {
+  SourceSpan _makeSpan(int start) {
     // TODO(terry): there are places where we are creating spans before we eat
     // the tokens, so using _previousToken.end is not always valid.
     var end = _previousToken != null && _previousToken.end >= start
@@ -942,7 +942,7 @@
     return tokId;
   }
 
-  IncludeDirective processInclude(Span span, {bool eatSemiColon: true}) {
+  IncludeDirective processInclude(SourceSpan span, {bool eatSemiColon: true}) {
     /* Stylet grammar:
     *
      *  @include IDENT [(args,...)];
@@ -2283,7 +2283,7 @@
   }
 
   /** Process all dimension units. */
-  LiteralTerm processDimension(Token t, var value, Span span) {
+  LiteralTerm processDimension(Token t, var value, SourceSpan span) {
     LiteralTerm term;
     var unitType = this._peek();
 
@@ -2538,7 +2538,7 @@
     }
   }
 
-  HexColorTerm _parseHex(String hexText, Span span) {
+  HexColorTerm _parseHex(String hexText, SourceSpan span) {
     var hexValue = 0;
 
      for (var i = 0; i < hexText.length; i++) {
diff --git a/lib/src/messages.dart b/lib/src/messages.dart
index 6c2ecbf..92f8451 100644
--- a/lib/src/messages.dart
+++ b/lib/src/messages.dart
@@ -5,7 +5,7 @@
 library csslib.src.messages;
 
 import 'package:logging/logging.dart' show Level;
-import 'package:source_maps/span.dart' show Span;
+import 'package:source_span/source_span.dart';
 
 import 'options.dart';
 
@@ -43,16 +43,16 @@
 class Message {
   final Level level;
   final String message;
-  final Span span;
+  final SourceSpan span;
   final bool useColors;
 
-  Message(this.level, this.message, {Span span, bool useColors: false})
+  Message(this.level, this.message, {SourceSpan span, bool useColors: false})
       : this.span = span, this.useColors = useColors;
 
   String toString() {
     var output = new StringBuffer();
     bool colors = useColors && _ERROR_COLORS.containsKey(level);
-    var levelColor =  _ERROR_COLORS[level];
+    var levelColor = colors ? _ERROR_COLORS[level] : null;
     if (colors) output.write(levelColor);
     output..write(_ERROR_LABEL[level])..write(' ');
     if (colors) output.write(NO_COLOR);
@@ -61,8 +61,7 @@
       output.write(message);
     } else {
       output.write('on ');
-      output.write(span.getLocationMessage(message, useColors: colors,
-          color: levelColor));
+      output.write(span.message(message, color: levelColor));
     }
 
     return output.toString();
@@ -87,7 +86,7 @@
       : options = options != null ? options : new PreprocessorOptions();
 
   /** Report a compile-time CSS error. */
-  void error(String message, Span span) {
+  void error(String message, SourceSpan span) {
     var msg = new Message(Level.SEVERE, message, span: span,
         useColors: options.useColors);
 
@@ -97,7 +96,7 @@
   }
 
   /** Report a compile-time CSS warning. */
-  void warning(String message, Span span) {
+  void warning(String message, SourceSpan span) {
     if (options.warningsAsErrors) {
       error(message, span);
     } else {
@@ -109,7 +108,7 @@
   }
 
   /** Report and informational message about what the compiler is doing. */
-  void info(String message, Span span) {
+  void info(String message, SourceSpan span) {
     var msg = new Message(Level.INFO, message, span: span,
         useColors: options.useColors);
 
diff --git a/lib/src/token.dart b/lib/src/token.dart
index 7e70f88..75ae6c5 100644
--- a/lib/src/token.dart
+++ b/lib/src/token.dart
@@ -12,7 +12,7 @@
   final int kind;
 
   /** The location where this token was parsed from. */
-  final Span span;
+  final SourceSpan span;
 
   /** The start offset of this token. */
   int get start => span.start.offset;
@@ -43,13 +43,13 @@
 /** A token containing a parsed literal value. */
 class LiteralToken extends Token {
   var value;
-  LiteralToken(int kind, Span span, this.value) : super(kind, span);
+  LiteralToken(int kind, SourceSpan span, this.value) : super(kind, span);
 }
 
 /** A token containing error information. */
 class ErrorToken extends Token {
   String message;
-  ErrorToken(int kind, Span span, this.message) : super(kind, span);
+  ErrorToken(int kind, SourceSpan span, this.message) : super(kind, span);
 }
 
 /**
@@ -61,6 +61,6 @@
 class IdentifierToken extends Token {
   final String text;
 
-  IdentifierToken(this.text, int kind, Span span)
+  IdentifierToken(this.text, int kind, SourceSpan span)
       : super(kind, span);
 }
diff --git a/lib/src/tree.dart b/lib/src/tree.dart
index c5275fd..53a5f9f 100644
--- a/lib/src/tree.dart
+++ b/lib/src/tree.dart
@@ -11,7 +11,7 @@
 class Identifier extends TreeNode {
   String name;
 
-  Identifier(this.name, Span span): super(span);
+  Identifier(this.name, SourceSpan span): super(span);
 
   Identifier clone() => new Identifier(name, span);
 
@@ -21,7 +21,7 @@
 }
 
 class Wildcard extends TreeNode {
-  Wildcard(Span span): super(span);
+  Wildcard(SourceSpan span): super(span);
   Wildcard clone() => new Wildcard(span);
   visit(VisitorBase visitor) => visitor.visitWildcard(this);
 
@@ -29,7 +29,7 @@
 }
 
 class ThisOperator extends TreeNode {
-  ThisOperator(Span span): super(span);
+  ThisOperator(SourceSpan span): super(span);
   ThisOperator clone() => new ThisOperator(span);
   visit(VisitorBase visitor) => visitor.visitThisOperator(this);
 
@@ -37,7 +37,7 @@
 }
 
 class Negation extends TreeNode {
-  Negation(Span span): super(span);
+  Negation(SourceSpan span): super(span);
   Negation clone() => new Negation(span);
   visit(VisitorBase visitor) => visitor.visitNegation(this);
 
@@ -48,14 +48,14 @@
 class CssComment extends TreeNode {
   final String comment;
 
-  CssComment(this.comment, Span span): super(span);
+  CssComment(this.comment, SourceSpan span): super(span);
   CssComment clone() => new CssComment(comment, span);
   visit(VisitorBase visitor) => visitor.visitCssComment(this);
 }
 
 // CDO/CDC (Comment Definition Open <!-- and Comment Definition Close -->).
 class CommentDefinition extends CssComment {
-  CommentDefinition(String comment, Span span): super(comment, span);
+  CommentDefinition(String comment, SourceSpan span): super(comment, span);
   CommentDefinition clone() => new CommentDefinition(comment, span);
   visit(VisitorBase visitor) => visitor.visitCommentDefinition(this);
 }
@@ -63,7 +63,7 @@
 class SelectorGroup extends TreeNode {
   final List<Selector> selectors;
 
-  SelectorGroup(this.selectors, Span span): super(span);
+  SelectorGroup(this.selectors, SourceSpan span): super(span);
 
   SelectorGroup clone() => new SelectorGroup(selectors, span);
 
@@ -73,7 +73,7 @@
 class Selector extends TreeNode {
   final List<SimpleSelectorSequence> simpleSelectorSequences;
 
-  Selector(this.simpleSelectorSequences, Span span) : super(span);
+  Selector(this.simpleSelectorSequences, SourceSpan span) : super(span);
 
   void add(SimpleSelectorSequence seq) => simpleSelectorSequences.add(seq);
 
@@ -95,7 +95,7 @@
   int combinator;
   final SimpleSelector simpleSelector;
 
-  SimpleSelectorSequence(this.simpleSelector, Span span,
+  SimpleSelectorSequence(this.simpleSelector, SourceSpan span,
       [int combinator = TokenKind.COMBINATOR_NONE])
       : combinator = combinator, super(span);
 
@@ -126,7 +126,7 @@
 abstract class SimpleSelector extends TreeNode {
   final _name; // Wildcard, ThisOperator, Identifier, Negation, others?
 
-  SimpleSelector(this._name, Span span) : super(span);
+  SimpleSelector(this._name, SourceSpan span) : super(span);
 
   String get name => _name.name;
 
@@ -139,7 +139,7 @@
 
 // element name
 class ElementSelector extends SimpleSelector {
-  ElementSelector(name, Span span) : super(name, span);
+  ElementSelector(name, SourceSpan span) : super(name, span);
   visit(VisitorBase visitor) => visitor.visitElementSelector(this);
 
   ElementSelector clone() => new ElementSelector(_name, span);
@@ -151,7 +151,8 @@
 class NamespaceSelector extends SimpleSelector {
   final _namespace;           // null, Wildcard or Identifier
 
-  NamespaceSelector(this._namespace, var name, Span span) : super(name, span);
+  NamespaceSelector(this._namespace, var name, SourceSpan span)
+      : super(name, span);
 
   String get namespace =>
       _namespace is Wildcard ? '*' : _namespace == null ? '' : _namespace.name;
@@ -173,7 +174,7 @@
   final _value;
 
   AttributeSelector(Identifier name, this._op, this._value,
-      Span span) : super(name, span);
+      SourceSpan span) : super(name, span);
 
   int get operatorKind => _op;
 
@@ -237,7 +238,7 @@
 
 // #id
 class IdSelector extends SimpleSelector {
-  IdSelector(Identifier name, Span span) : super(name, span);
+  IdSelector(Identifier name, SourceSpan span) : super(name, span);
   IdSelector clone() => new IdSelector(_name, span);
   visit(VisitorBase visitor) => visitor.visitIdSelector(this);
 
@@ -246,7 +247,7 @@
 
 // .class
 class ClassSelector extends SimpleSelector {
-  ClassSelector(Identifier name, Span span) : super(name, span);
+  ClassSelector(Identifier name, SourceSpan span) : super(name, span);
   ClassSelector clone() => new ClassSelector(_name, span);
   visit(VisitorBase visitor) => visitor.visitClassSelector(this);
 
@@ -255,7 +256,7 @@
 
 // :pseudoClass
 class PseudoClassSelector extends SimpleSelector {
-  PseudoClassSelector(Identifier name, Span span) : super(name, span);
+  PseudoClassSelector(Identifier name, SourceSpan span) : super(name, span);
   visit(VisitorBase visitor) => visitor.visitPseudoClassSelector(this);
 
   PseudoClassSelector clone() => new PseudoClassSelector(_name, span);
@@ -265,7 +266,7 @@
 
 // ::pseudoElement
 class PseudoElementSelector extends SimpleSelector {
-  PseudoElementSelector(Identifier name, Span span) : super(name, span);
+  PseudoElementSelector(Identifier name, SourceSpan span) : super(name, span);
   visit(VisitorBase visitor) => visitor.visitPseudoElementSelector(this);
 
   PseudoElementSelector clone() => new PseudoElementSelector(_name, span);
@@ -277,7 +278,7 @@
 class PseudoClassFunctionSelector extends PseudoClassSelector {
   final SelectorExpression expression;
 
-  PseudoClassFunctionSelector(Identifier name, this.expression, Span span)
+  PseudoClassFunctionSelector(Identifier name, this.expression, SourceSpan span)
       : super(name, span);
 
   PseudoClassFunctionSelector clone() =>
@@ -291,7 +292,8 @@
 class PseudoElementFunctionSelector extends PseudoElementSelector {
   final SelectorExpression expression;
 
-  PseudoElementFunctionSelector(Identifier name, this.expression, Span span)
+  PseudoElementFunctionSelector(Identifier name, this.expression,
+          SourceSpan span)
       : super(name, span);
 
   PseudoElementFunctionSelector clone() =>
@@ -304,7 +306,7 @@
 class SelectorExpression extends TreeNode {
   final List<Expression> expressions;
 
-  SelectorExpression(this.expressions, Span span): super(span);
+  SelectorExpression(this.expressions, SourceSpan span): super(span);
 
   SelectorExpression clone() {
     return new SelectorExpression(
@@ -318,7 +320,7 @@
 class NegationSelector extends SimpleSelector {
   final SimpleSelector negationArg;
 
-  NegationSelector(this.negationArg, Span span)
+  NegationSelector(this.negationArg, SourceSpan span)
       : super(new Negation(span), span);
 
   NegationSelector clone() => new NegationSelector(negationArg, span);
@@ -340,14 +342,14 @@
    */
   final List<TreeNode> topLevels;
 
-  StyleSheet(this.topLevels, Span span) : super(span) {
+  StyleSheet(this.topLevels, SourceSpan span) : super(span) {
     for (final node in topLevels) {
       assert(node is TopLevelProduction || node is Directive);
     }
   }
 
   /** Selectors only in this tree. */
-  StyleSheet.selector(this.topLevels, Span span) : super(span);
+  StyleSheet.selector(this.topLevels, SourceSpan span) : super(span);
 
   StyleSheet clone() {
     var clonedTopLevels = topLevels.map((e) => e.clone()).toList();
@@ -358,7 +360,7 @@
 }
 
 class TopLevelProduction extends TreeNode {
-  TopLevelProduction(Span span) : super(span);
+  TopLevelProduction(SourceSpan span) : super(span);
   TopLevelProduction clone() => new TopLevelProduction(span);
   visit(VisitorBase visitor) => visitor.visitTopLevelProduction(this);
 }
@@ -367,7 +369,8 @@
   final SelectorGroup _selectorGroup;
   final DeclarationGroup _declarationGroup;
 
-  RuleSet(this._selectorGroup, this._declarationGroup, Span span) : super(span);
+  RuleSet(this._selectorGroup, this._declarationGroup, SourceSpan span)
+      : super(span);
 
   SelectorGroup get selectorGroup => _selectorGroup;
   DeclarationGroup get declarationGroup => _declarationGroup;
@@ -382,7 +385,7 @@
 }
 
 class Directive extends TreeNode {
-  Directive(Span span) : super(span);
+  Directive(SourceSpan span) : super(span);
 
   bool get isBuiltIn => true;       // Known CSS directive?
   bool get isExtension => false;    // SCSS extension?
@@ -398,7 +401,8 @@
   /** Any media queries for this import. */
   final List<MediaQuery> mediaQueries;
 
-  ImportDirective(this.import, this.mediaQueries, Span span) : super(span);
+  ImportDirective(this.import, this.mediaQueries, SourceSpan span)
+      : super(span);
 
   ImportDirective clone() {
     var cloneMediaQueries = [];
@@ -420,7 +424,8 @@
   final Identifier _mediaFeature;
   final Expressions exprs;
 
-  MediaExpression(this.andOperator, this._mediaFeature, this.exprs, Span span)
+  MediaExpression(this.andOperator, this._mediaFeature, this.exprs,
+          SourceSpan span)
       : super(span);
 
   String get mediaFeature => _mediaFeature.name;
@@ -450,7 +455,8 @@
   final Identifier _mediaType;
   final List<MediaExpression> expressions;
 
-  MediaQuery(this._mediaUnary, this._mediaType, this.expressions, Span span)
+  MediaQuery(this._mediaUnary, this._mediaType, this.expressions,
+          SourceSpan span)
       : super(span);
 
   bool get hasMediaType => _mediaType != null;
@@ -474,7 +480,8 @@
   final List<MediaQuery> mediaQueries;
   final List<RuleSet> rulesets;
 
-  MediaDirective(this.mediaQueries, this.rulesets, Span span) : super(span);
+  MediaDirective(this.mediaQueries, this.rulesets, SourceSpan span)
+      : super(span);
 
   MediaDirective clone() {
     var cloneQueries = [];
@@ -494,7 +501,7 @@
 class HostDirective extends Directive {
   final List<RuleSet> rulesets;
 
-  HostDirective(this.rulesets, Span span) : super(span);
+  HostDirective(this.rulesets, SourceSpan span) : super(span);
 
   HostDirective clone() {
     var cloneRulesets = [];
@@ -513,7 +520,7 @@
   final List<DeclarationGroup> _declsMargin;
 
   PageDirective(this._ident, this._pseudoPage, this._declsMargin,
-      Span span) : super(span);
+      SourceSpan span) : super(span);
 
   PageDirective clone() {
     var cloneDeclsMargin = [];
@@ -532,7 +539,7 @@
 class CharsetDirective extends Directive {
   final String charEncoding;
 
-  CharsetDirective(this.charEncoding, Span span) : super(span);
+  CharsetDirective(this.charEncoding, SourceSpan span) : super(span);
   CharsetDirective clone() => new CharsetDirective(charEncoding, span);
   visit(VisitorBase visitor) => visitor.visitCharsetDirective(this);
 }
@@ -545,7 +552,7 @@
   final name;
   final List<KeyFrameBlock> _blocks;
 
-  KeyFrameDirective(this._keyframeName, this.name, Span span)
+  KeyFrameDirective(this._keyframeName, this.name, SourceSpan span)
       : _blocks = [], super(span);
 
   add(KeyFrameBlock block) {
@@ -577,7 +584,7 @@
   final Expressions _blockSelectors;
   final DeclarationGroup _declarations;
 
-  KeyFrameBlock(this._blockSelectors, this._declarations, Span span)
+  KeyFrameBlock(this._blockSelectors, this._declarations, SourceSpan span)
       : super(span);
 
   KeyFrameBlock clone() =>
@@ -588,7 +595,7 @@
 class FontFaceDirective extends Directive {
   final DeclarationGroup _declarations;
 
-  FontFaceDirective(this._declarations, Span span) : super(span);
+  FontFaceDirective(this._declarations, SourceSpan span) : super(span);
 
   FontFaceDirective clone() =>
       new FontFaceDirective(_declarations.clone(), span);
@@ -599,7 +606,8 @@
   final String dartClassName;
   final List<RuleSet> rulesets;
 
-  StyletDirective(this.dartClassName, this.rulesets, Span span) : super(span);
+  StyletDirective(this.dartClassName, this.rulesets, SourceSpan span)
+     : super(span);
 
   bool get isBuiltIn => false;
   bool get isExtension => true;
@@ -622,7 +630,7 @@
   /** URI associated with this namespace. */
   final String _uri;
 
-  NamespaceDirective(this._prefix, this._uri, Span span) : super(span);
+  NamespaceDirective(this._prefix, this._uri, SourceSpan span) : super(span);
 
   NamespaceDirective clone() => new NamespaceDirective(_prefix, _uri, span);
 
@@ -635,7 +643,7 @@
 class VarDefinitionDirective extends Directive {
   final VarDefinition def;
 
-  VarDefinitionDirective(this.def, Span span) : super(span);
+  VarDefinitionDirective(this.def, SourceSpan span) : super(span);
 
   VarDefinitionDirective clone() =>
       new VarDefinitionDirective(def.clone(), span);
@@ -648,7 +656,7 @@
   final List definedArgs;
   final bool varArgs;
 
-  MixinDefinition(this.name, this.definedArgs, this.varArgs, Span span)
+  MixinDefinition(this.name, this.definedArgs, this.varArgs, SourceSpan span)
       : super(span);
 
   MixinDefinition clone() {
@@ -667,7 +675,7 @@
   final List<RuleSet> rulesets;
 
   MixinRulesetDirective(String name, List<VarDefinitionDirective> args,
-      bool varArgs, this.rulesets, Span span) :
+      bool varArgs, this.rulesets, SourceSpan span) :
       super(name, args, varArgs, span);
 
   MixinRulesetDirective clone() {
@@ -690,7 +698,7 @@
   final DeclarationGroup declarations;
 
   MixinDeclarationDirective(String name, List<VarDefinitionDirective>  args,
-      bool varArgs, this.declarations, Span span) :
+      bool varArgs, this.declarations, SourceSpan span) :
       super(name, args, varArgs, span);
 
   MixinDeclarationDirective clone() {
@@ -710,7 +718,7 @@
   final String name;
   final List<List<TreeNode>> args;
 
-  IncludeDirective(this.name, this.args, Span span) : super(span);
+  IncludeDirective(this.name, this.args, SourceSpan span) : super(span);
 
   IncludeDirective clone() {
     var cloneArgs = [];
@@ -727,7 +735,7 @@
 
 /** To support SASS @content. */
 class ContentDirective extends Directive {
-  ContentDirective(Span span) : super(span);
+  ContentDirective(SourceSpan span) : super(span);
 
   visit(VisitorBase visitor) => visitor.visitContentDirective(this);
 }
@@ -749,7 +757,7 @@
    */
   final bool isIE7;
 
-  Declaration(this._property, this._expression, this.dartStyle, Span span,
+  Declaration(this._property, this._expression, this.dartStyle, SourceSpan span,
               {important: false, ie7: false})
       : this.important = important, this.isIE7 = ie7, super(span);
 
@@ -774,7 +782,7 @@
 class VarDefinition extends Declaration {
   bool badUsage = false;
 
-  VarDefinition(Identifier definedName, Expression expr, Span span)
+  VarDefinition(Identifier definedName, Expression expr, SourceSpan span)
       : super(definedName, expr, null, span);
 
   String get definedName => _property.name;
@@ -796,7 +804,7 @@
 class IncludeMixinAtDeclaration extends Declaration {
   final IncludeDirective include;
 
-  IncludeMixinAtDeclaration(this.include, Span span)
+  IncludeMixinAtDeclaration(this.include, SourceSpan span)
       : super(null, null, null, span);
 
   IncludeMixinAtDeclaration clone() =>
@@ -809,7 +817,7 @@
 class ExtendDeclaration extends Declaration {
   final List<TreeNode> selectors;
 
-  ExtendDeclaration(this.selectors, Span span) :
+  ExtendDeclaration(this.selectors, SourceSpan span) :
       super(null, null, null, span);
 
   ExtendDeclaration clone() {
@@ -824,7 +832,7 @@
   /** Can be either Declaration or RuleSet (if nested selector). */
   final List declarations;
 
-  DeclarationGroup(this.declarations, Span span) : super(span);
+  DeclarationGroup(this.declarations, SourceSpan span) : super(span);
 
   DeclarationGroup clone() {
     var clonedDecls = declarations.map((d) => d.clone()).toList();
@@ -837,7 +845,7 @@
 class MarginGroup extends DeclarationGroup {
   final int margin_sym;       // TokenType for for @margin sym.
 
-  MarginGroup(this.margin_sym, List<Declaration> decls, Span span)
+  MarginGroup(this.margin_sym, List<Declaration> decls, SourceSpan span)
       : super(decls, span);
   MarginGroup clone() =>
     new MarginGroup(margin_sym, super.clone() as dynamic, span);
@@ -848,7 +856,7 @@
   final String name;
   final List<Expression> defaultValues;
 
-  VarUsage(this.name, this.defaultValues, Span span) : super(span);
+  VarUsage(this.name, this.defaultValues, SourceSpan span) : super(span);
 
   VarUsage clone() {
     var clonedValues = [];
@@ -862,25 +870,25 @@
 }
 
 class OperatorSlash extends Expression {
-  OperatorSlash(Span span) : super(span);
+  OperatorSlash(SourceSpan span) : super(span);
   OperatorSlash clone() => new OperatorSlash(span);
   visit(VisitorBase visitor) => visitor.visitOperatorSlash(this);
 }
 
 class OperatorComma extends Expression {
-  OperatorComma(Span span) : super(span);
+  OperatorComma(SourceSpan span) : super(span);
   OperatorComma clone() => new OperatorComma(span);
   visit(VisitorBase visitor) => visitor.visitOperatorComma(this);
 }
 
 class OperatorPlus extends Expression {
-  OperatorPlus(Span span) : super(span);
+  OperatorPlus(SourceSpan span) : super(span);
   OperatorPlus clone() => new OperatorPlus(span);
   visit(VisitorBase visitor) => visitor.visitOperatorPlus(this);
 }
 
 class OperatorMinus extends Expression {
-  OperatorMinus(Span span) : super(span);
+  OperatorMinus(SourceSpan span) : super(span);
   OperatorMinus clone() => new OperatorMinus(span);
   visit(VisitorBase visitor) => visitor.visitOperatorMinus(this);
 }
@@ -889,7 +897,7 @@
   final String first;
   final String second;
 
-  UnicodeRangeTerm(this.first, this.second, Span span) : super(span);
+  UnicodeRangeTerm(this.first, this.second, SourceSpan span) : super(span);
 
   bool get hasSecond => second != null;
 
@@ -905,7 +913,7 @@
   dynamic value;
   String text;
 
-  LiteralTerm(this.value, this.text, Span span) : super(span);
+  LiteralTerm(this.value, this.text, SourceSpan span) : super(span);
 
   LiteralTerm clone() => new LiteralTerm(value, text, span);
 
@@ -913,7 +921,7 @@
 }
 
 class NumberTerm extends LiteralTerm {
-  NumberTerm(value, String t, Span span) : super(value, t, span);
+  NumberTerm(value, String t, SourceSpan span) : super(value, t, span);
   NumberTerm clone() => new NumberTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitNumberTerm(this);
 }
@@ -921,7 +929,7 @@
 class UnitTerm extends LiteralTerm {
   final int unit;
 
-  UnitTerm(value, String t, Span span, this.unit) : super(value, t, span);
+  UnitTerm(value, String t, SourceSpan span, this.unit) : super(value, t, span);
 
   UnitTerm clone() => new UnitTerm(value, text, span, unit);
 
@@ -933,7 +941,7 @@
 }
 
 class LengthTerm extends UnitTerm {
-  LengthTerm(value, String t, Span span,
+  LengthTerm(value, String t, SourceSpan span,
       [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(this.unit == TokenKind.UNIT_LENGTH_PX ||
         this.unit == TokenKind.UNIT_LENGTH_CM ||
@@ -947,25 +955,25 @@
 }
 
 class PercentageTerm extends LiteralTerm {
-  PercentageTerm(value, String t, Span span) : super(value, t, span);
+  PercentageTerm(value, String t, SourceSpan span) : super(value, t, span);
   PercentageTerm clone() => new PercentageTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitPercentageTerm(this);
 }
 
 class EmTerm extends LiteralTerm {
-  EmTerm(value, String t, Span span) : super(value, t, span);
+  EmTerm(value, String t, SourceSpan span) : super(value, t, span);
   EmTerm clone() => new EmTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitEmTerm(this);
 }
 
 class ExTerm extends LiteralTerm {
-  ExTerm(value, String t, Span span) : super(value, t, span);
+  ExTerm(value, String t, SourceSpan span) : super(value, t, span);
   ExTerm clone() => new ExTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitExTerm(this);
 }
 
 class AngleTerm extends UnitTerm {
-  AngleTerm(var value, String t, Span span,
+  AngleTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(this.unit == TokenKind.UNIT_ANGLE_DEG ||
         this.unit == TokenKind.UNIT_ANGLE_RAD ||
@@ -978,7 +986,7 @@
 }
 
 class TimeTerm extends UnitTerm {
-  TimeTerm(var value, String t, Span span,
+  TimeTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(this.unit == TokenKind.UNIT_ANGLE_DEG ||
         this.unit == TokenKind.UNIT_TIME_MS ||
@@ -990,7 +998,7 @@
 }
 
 class FreqTerm extends UnitTerm {
-  FreqTerm(var value, String t, Span span,
+  FreqTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(unit == TokenKind.UNIT_FREQ_HZ || unit == TokenKind.UNIT_FREQ_KHZ);
   }
@@ -1000,21 +1008,21 @@
 }
 
 class FractionTerm extends LiteralTerm {
-  FractionTerm(var value, String t, Span span) : super(value, t, span);
+  FractionTerm(var value, String t, SourceSpan span) : super(value, t, span);
 
   FractionTerm clone() => new FractionTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitFractionTerm(this);
 }
 
 class UriTerm extends LiteralTerm {
-  UriTerm(String value, Span span) : super(value, value, span);
+  UriTerm(String value, SourceSpan span) : super(value, value, span);
 
   UriTerm clone() => new UriTerm(value, span);
   visit(VisitorBase visitor) => visitor.visitUriTerm(this);
 }
 
 class ResolutionTerm extends UnitTerm {
-  ResolutionTerm(var value, String t, Span span,
+  ResolutionTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(unit == TokenKind.UNIT_RESOLUTION_DPI ||
         unit == TokenKind.UNIT_RESOLUTION_DPCM ||
@@ -1026,7 +1034,7 @@
 }
 
 class ChTerm extends UnitTerm {
-  ChTerm(var value, String t, Span span,
+  ChTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(unit == TokenKind.UNIT_CH);
   }
@@ -1036,7 +1044,7 @@
 }
 
 class RemTerm extends UnitTerm {
-  RemTerm(var value, String t, Span span,
+  RemTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(unit == TokenKind.UNIT_REM);
   }
@@ -1046,7 +1054,7 @@
 }
 
 class ViewportTerm extends UnitTerm {
-  ViewportTerm(var value, String t, Span span,
+  ViewportTerm(var value, String t, SourceSpan span,
     [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) {
     assert(unit == TokenKind.UNIT_VIEWPORT_VW ||
         unit == TokenKind.UNIT_VIEWPORT_VH ||
@@ -1062,7 +1070,7 @@
 class BAD_HEX_VALUE { }
 
 class HexColorTerm extends LiteralTerm {
-  HexColorTerm(var value, String t, Span span) : super(value, t, span);
+  HexColorTerm(var value, String t, SourceSpan span) : super(value, t, span);
 
   HexColorTerm clone() => new HexColorTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitHexColorTerm(this);
@@ -1071,7 +1079,7 @@
 class FunctionTerm extends LiteralTerm {
   final Expressions _params;
 
-  FunctionTerm(var value, String t, this._params, Span span)
+  FunctionTerm(var value, String t, this._params, SourceSpan span)
       : super(value, t, span);
 
   FunctionTerm clone() => new FunctionTerm(value, text, _params.clone(), span);
@@ -1084,7 +1092,7 @@
  * browsers.
  */
 class IE8Term extends LiteralTerm {
-  IE8Term(Span span) : super('\\9', '\\9', span);
+  IE8Term(SourceSpan span) : super('\\9', '\\9', span);
   IE8Term clone() => new IE8Term(span);
   visit(VisitorBase visitor) => visitor.visitIE8Term(this);
 }
@@ -1092,7 +1100,7 @@
 class GroupTerm extends Expression {
   final List<LiteralTerm> _terms;
 
-  GroupTerm(Span span) : _terms =  [], super(span);
+  GroupTerm(SourceSpan span) : _terms =  [], super(span);
 
   void add(LiteralTerm term) {
     _terms.add(term);
@@ -1103,7 +1111,7 @@
 }
 
 class ItemTerm extends NumberTerm {
-  ItemTerm(var value, String t, Span span) : super(value, t, span);
+  ItemTerm(var value, String t, SourceSpan span) : super(value, t, span);
 
   ItemTerm clone() => new ItemTerm(value, text, span);
   visit(VisitorBase visitor) => visitor.visitItemTerm(this);
@@ -1112,7 +1120,7 @@
 class Expressions extends Expression {
   final List<Expression> expressions = [];
 
-  Expressions(Span span): super(span);
+  Expressions(SourceSpan span): super(span);
 
   void add(Expression expression) {
     expressions.add(expression);
@@ -1133,7 +1141,7 @@
   final Expression x;
   final Expression y;
 
-  BinaryExpression(this.op, this.x, this.y, Span span): super(span);
+  BinaryExpression(this.op, this.x, this.y, SourceSpan span): super(span);
 
   BinaryExpression clone() =>
       new BinaryExpression(op, x.clone(), y.clone(), span);
@@ -1144,7 +1152,7 @@
   final Token op;
   final Expression self;
 
-  UnaryExpression(this.op, this.self, Span span): super(span);
+  UnaryExpression(this.op, this.self, SourceSpan span): super(span);
 
   UnaryExpression clone() => new UnaryExpression(op, self.clone(), span);
   visit(VisitorBase visitor) => visitor.visitUnaryExpression(this);
@@ -1162,7 +1170,7 @@
   final int _styleType;
   int priority;
 
-  DartStyleExpression(this._styleType, Span span) : super(span);
+  DartStyleExpression(this._styleType, SourceSpan span) : super(span);
 
   /*
    * Merges give 2 DartStyleExpression (or derived from DartStyleExpression,
@@ -1191,7 +1199,7 @@
   //   font-style font-variant font-weight font-size/line-height font-family
   // TODO(terry): Only px/pt for now need to handle all possible units to
   //              support calc expressions on units.
-  FontExpression(Span span, {dynamic size, List<String> family,
+  FontExpression(SourceSpan span, {dynamic size, List<String> family,
       int weight, String style, String variant, LineHeight lineHeight}) :
         font = new Font(size : size is LengthTerm ? size.value : size,
             family: family, weight: weight, style: style, variant: variant,
@@ -1213,7 +1221,7 @@
     return new FontExpression._merge(x, y, y.span);
   }
 
-  FontExpression._merge(FontExpression x, FontExpression y, Span span)
+  FontExpression._merge(FontExpression x, FontExpression y, SourceSpan span)
       : super(DartStyleExpression.fontStyle, span),
         font = new Font.merge(x.font, y.font);
 
@@ -1228,7 +1236,7 @@
 abstract class BoxExpression extends DartStyleExpression {
   final BoxEdge box;
 
-  BoxExpression(int styleType, Span span, this.box)
+  BoxExpression(int styleType, SourceSpan span, this.box)
       : super(styleType, span);
 
   /*
@@ -1257,11 +1265,11 @@
 class MarginExpression extends BoxExpression {
   // TODO(terry): Does auto for margin need to be exposed to Dart UI framework?
   /** Margin expression ripped apart. */
-  MarginExpression(Span span, {num top, num right, num bottom, num left})
+  MarginExpression(SourceSpan span, {num top, num right, num bottom, num left})
       : super(DartStyleExpression.marginStyle, span,
               new BoxEdge(left, top, right, bottom));
 
-  MarginExpression.boxEdge(Span span, BoxEdge box)
+  MarginExpression.boxEdge(SourceSpan span, BoxEdge box)
       : super(DartStyleExpression.marginStyle, span, box);
 
   merged(MarginExpression newMarginExpr) {
@@ -1279,7 +1287,8 @@
     return new MarginExpression._merge(x, y, y.span);
   }
 
-  MarginExpression._merge(MarginExpression x, MarginExpression y, Span span)
+  MarginExpression._merge(MarginExpression x, MarginExpression y,
+          SourceSpan span)
       : super(x._styleType, span, new BoxEdge.merge(x.box, y.box));
 
   MarginExpression clone() =>
@@ -1291,11 +1300,11 @@
 
 class BorderExpression extends BoxExpression {
   /** Border expression ripped apart. */
-  BorderExpression(Span span, {num top, num right, num bottom, num left})
+  BorderExpression(SourceSpan span, {num top, num right, num bottom, num left})
       : super(DartStyleExpression.borderStyle, span,
               new BoxEdge(left, top, right, bottom));
 
-  BorderExpression.boxEdge(Span span, BoxEdge box)
+  BorderExpression.boxEdge(SourceSpan span, BoxEdge box)
       : super(DartStyleExpression.borderStyle, span, box);
 
   merged(BorderExpression newBorderExpr) {
@@ -1314,7 +1323,7 @@
   }
 
   BorderExpression._merge(BorderExpression x, BorderExpression y,
-      Span span)
+      SourceSpan span)
       : super(DartStyleExpression.borderStyle, span,
               new BoxEdge.merge(x.box, y.box));
 
@@ -1328,7 +1337,7 @@
 class HeightExpression extends DartStyleExpression {
   final height;
 
-  HeightExpression(Span span, this.height)
+  HeightExpression(SourceSpan span, this.height)
       : super(DartStyleExpression.heightStyle, span);
 
   merged(HeightExpression newHeightExpr) {
@@ -1346,7 +1355,7 @@
 class WidthExpression extends DartStyleExpression {
   final width;
 
-  WidthExpression(Span span, this.width)
+  WidthExpression(SourceSpan span, this.width)
       : super(DartStyleExpression.widthStyle, span);
 
   merged(WidthExpression newWidthExpr) {
@@ -1363,11 +1372,11 @@
 
 class PaddingExpression extends BoxExpression {
   /** Padding expression ripped apart. */
-  PaddingExpression(Span span, {num top, num right, num bottom, num left})
+  PaddingExpression(SourceSpan span, {num top, num right, num bottom, num left})
       : super(DartStyleExpression.paddingStyle, span,
               new BoxEdge(left, top, right, bottom));
 
-  PaddingExpression.boxEdge(Span span, BoxEdge box)
+  PaddingExpression.boxEdge(SourceSpan span, BoxEdge box)
       : super(DartStyleExpression.paddingStyle, span, box);
 
   merged(PaddingExpression newPaddingExpr) {
@@ -1385,7 +1394,8 @@
     return new PaddingExpression._merge(x, y, y.span);
   }
 
-  PaddingExpression._merge(PaddingExpression x, PaddingExpression y, Span span)
+  PaddingExpression._merge(PaddingExpression x, PaddingExpression y,
+          SourceSpan span)
       : super(DartStyleExpression.paddingStyle, span,
             new BoxEdge.merge(x.box, y.box));
 
diff --git a/lib/src/tree_base.dart b/lib/src/tree_base.dart
index 6dc27b1..35aef13 100644
--- a/lib/src/tree_base.dart
+++ b/lib/src/tree_base.dart
@@ -9,7 +9,7 @@
  */
 abstract class TreeNode {
   /** The source code this [TreeNode] represents. */
-  final Span span;
+  final SourceSpan span;
 
   TreeNode(this.span);
 
@@ -29,7 +29,7 @@
 
 /** The base type for expressions. */
 abstract class Expression extends TreeNode {
-  Expression(Span span): super(span);
+  Expression(SourceSpan span): super(span);
 }
 
 /** Simple class to provide a textual dump of trees for debugging. */
@@ -53,7 +53,7 @@
   void heading(String name, [span]) {
     write(name);
     if (span != null) {
-      buf.write('  (${span.getLocationMessage('')})');
+      buf.write('  (${span.message('')})');
     }
     buf.write('\n');
   }
diff --git a/lib/src/validate.dart b/lib/src/validate.dart
index d85c341..bc3a6ad 100644
--- a/lib/src/validate.dart
+++ b/lib/src/validate.dart
@@ -5,19 +5,12 @@
 library csslib.src.validate;
 
 import 'package:csslib/visitor.dart';
-import 'package:source_maps/span.dart' show Span;
+import 'package:source_span/source_span.dart';
 
 /** Can be thrown on any Css runtime problem includes source location. */
-class CssSelectorException implements Exception {
-  final String _message;
-  final Span _span;
-
-  CssSelectorException(this._message, [this._span]);
-
-  String toString() {
-    var msg = _span == null ? _message : _span.getLocationMessage(_message);
-    return 'CssSelectorException: $msg';
-  }
+class CssSelectorException extends SourceSpanException {
+  CssSelectorException(String message, [SourceSpan span])
+      : super(message, span);
 }
 
 List<String> classes = [];
diff --git a/lib/visitor.dart b/lib/visitor.dart
index 8174af9..aac7242 100644
--- a/lib/visitor.dart
+++ b/lib/visitor.dart
@@ -4,7 +4,7 @@
 
 library csslib.visitor;
 
-import 'package:source_maps/span.dart' show Span;
+import 'package:source_span/source_span.dart';
 import 'parser.dart';
 
 part 'src/css_printer.dart';
diff --git a/pubspec.yaml b/pubspec.yaml
index e1d0afe..3ef6ed4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: csslib
-version: 0.10.0+1
+version: 0.11.0
 author: Polymer.dart Team <web-ui-dev@dartlang.org>
 description: A library for parsing CSS.
 homepage: https://www.dartlang.org
@@ -9,7 +9,7 @@
   args: '>=0.9.0 <0.13.0'
   logging: '>=0.9.0 <0.10.0'
   path: '>=0.9.0 <2.0.0'
-  source_maps: '>=0.9.1 <0.10.0'
+  source_span: '>=1.0.0 <2.0.0'
 dev_dependencies:
   browser: '>=0.9.0 <0.10.0'
   unittest: '>=0.9.0 <0.10.0'