Enable Travis-CI (#7)

Fixes #6
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4496f3a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+language: dart
+
+dart:
+  - dev
+  - stable
+
+dart_task:
+  - test: --platform vm,chrome
+
+matrix:
+  include:
+    # Only validate formatting using the dev release
+    - dart: dev
+      dart_task: dartfmt
+    - dart: dev
+      dart_task: analyzer
+
+# Only building master means that we don't run two builds for each pull request.
+branches:
+  only: [master]
+
+cache:
+ directories:
+   - $HOME/.pub-cache
diff --git a/.analysis_options b/analysis_options.yaml
similarity index 100%
rename from .analysis_options
rename to analysis_options.yaml
diff --git a/lib/src/eager_span_scanner.dart b/lib/src/eager_span_scanner.dart
index f80dce5..96c7362 100644
--- a/lib/src/eager_span_scanner.dart
+++ b/lib/src/eager_span_scanner.dart
@@ -58,8 +58,8 @@
       if (newlines.isEmpty) {
         _column -= oldPosition - newPosition;
       } else {
-        _column = newPosition -
-            string.lastIndexOf(_newlineRegExp, newPosition) - 1;
+        _column =
+            newPosition - string.lastIndexOf(_newlineRegExp, newPosition) - 1;
       }
     }
   }
@@ -121,4 +121,3 @@
 
   _EagerSpanScannerState(this._scanner, this.position, this.line, this.column);
 }
-
diff --git a/lib/src/line_scanner.dart b/lib/src/line_scanner.dart
index 06f1cbc..5182035 100644
--- a/lib/src/line_scanner.dart
+++ b/lib/src/line_scanner.dart
@@ -66,8 +66,8 @@
       if (newlines.isEmpty) {
         _column -= oldPosition - newPosition;
       } else {
-        _column = newPosition -
-            string.lastIndexOf(_newlineRegExp, newPosition) - 1;
+        _column =
+            newPosition - string.lastIndexOf(_newlineRegExp, newPosition) - 1;
       }
     }
   }
diff --git a/lib/src/relative_span_scanner.dart b/lib/src/relative_span_scanner.dart
index fdcd03f..088ff48 100644
--- a/lib/src/relative_span_scanner.dart
+++ b/lib/src/relative_span_scanner.dart
@@ -27,13 +27,14 @@
   /// This is used to convert between span-relative and file-relative fields.
   final FileLocation _startLocation;
 
-  int get line => _sourceFile.getLine(_startLocation.offset + position) -
+  int get line =>
+      _sourceFile.getLine(_startLocation.offset + position) -
       _startLocation.line;
 
   int get column {
     var line = _sourceFile.getLine(_startLocation.offset + position);
-    var column = _sourceFile.getColumn(_startLocation.offset + position,
-        line: line);
+    var column =
+        _sourceFile.getColumn(_startLocation.offset + position, line: line);
     return line == _startLocation.line
         ? column - _startLocation.column
         : column;
@@ -66,8 +67,7 @@
 
   FileSpan spanFrom(LineScannerState startState, [LineScannerState endState]) {
     var endPosition = endState == null ? position : endState.position;
-    return _sourceFile.span(
-        _startLocation.offset + startState.position,
+    return _sourceFile.span(_startLocation.offset + startState.position,
         _startLocation.offset + endPosition);
   }
 
@@ -77,8 +77,7 @@
       return false;
     }
 
-    _lastSpan = _sourceFile.span(
-        _startLocation.offset + position,
+    _lastSpan = _sourceFile.span(_startLocation.offset + position,
         _startLocation.offset + lastMatch.end);
     return true;
   }
@@ -92,8 +91,7 @@
     }
     if (length == null) length = match == null ? 1 : match.end - match.start;
 
-    var span = _sourceFile.span(
-        _startLocation.offset + position,
+    var span = _sourceFile.span(_startLocation.offset + position,
         _startLocation.offset + position + length);
     throw new StringScannerException(message, span, string);
   }
diff --git a/lib/src/span_scanner.dart b/lib/src/span_scanner.dart
index f362223..a629f13 100644
--- a/lib/src/span_scanner.dart
+++ b/lib/src/span_scanner.dart
@@ -42,6 +42,7 @@
     if (lastMatch == null) _lastSpan = null;
     return _lastSpan;
   }
+
   FileSpan _lastSpan;
 
   /// The current location of the scanner.
diff --git a/lib/src/string_scanner.dart b/lib/src/string_scanner.dart
index 712292c..ea3d6d6 100644
--- a/lib/src/string_scanner.dart
+++ b/lib/src/string_scanner.dart
@@ -34,6 +34,7 @@
     _position = position;
     _lastMatch = null;
   }
+
   int _position = 0;
 
   /// The data about the previous match made by the scanner.
@@ -45,6 +46,7 @@
     if (_position != _lastMatchPosition) _lastMatch = null;
     return _lastMatch;
   }
+
   Match _lastMatch;
   int _lastMatchPosition;
 
diff --git a/test/span_scanner_test.dart b/test/span_scanner_test.dart
index ab3cc80..37a01e0 100644
--- a/test/span_scanner_test.dart
+++ b/test/span_scanner_test.dart
@@ -9,11 +9,11 @@
 import 'utils.dart';
 
 void main() {
-  testForImplementation("lazy", ([string]) {
+  testForImplementation("lazy", ([String string]) {
     return new SpanScanner(string ?? 'foo\nbar\nbaz', sourceUrl: 'source');
   });
 
-  testForImplementation("eager", ([string]) {
+  testForImplementation("eager", ([String string]) {
     return new SpanScanner.eager(string ?? 'foo\nbar\nbaz',
         sourceUrl: 'source');
   });
@@ -93,8 +93,8 @@
 
     test(".error() uses an absolute span", () {
       scanner.expect("foo");
-      expect(() => scanner.error('oh no!'),
-          throwsStringScannerException("foo"));
+      expect(
+          () => scanner.error('oh no!'), throwsStringScannerException("foo"));
     });
 
     test(".isDone returns true at the end of the span", () {
@@ -104,7 +104,7 @@
   });
 }
 
-void testForImplementation(String name, SpanScanner create()) {
+void testForImplementation(String name, SpanScanner create([String string])) {
   group("for a $name scanner", () {
     var scanner;
     setUp(() => scanner = create());
diff --git a/test/string_scanner_test.dart b/test/string_scanner_test.dart
index 55ffa0a..30711f5 100644
--- a/test/string_scanner_test.dart
+++ b/test/string_scanner_test.dart
@@ -178,7 +178,8 @@
       expect(scanner.rest, equals(' bar'));
     });
 
-    test("a non-matching expect throws a FormatException and sets lastMatch to "
+    test(
+        "a non-matching expect throws a FormatException and sets lastMatch to "
         "null", () {
       expect(scanner.matches(new RegExp('f(..)')), isTrue);
       expect(scanner.lastMatch, isNotNull);