mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Add an executable and fix some bugs.
This commit is contained in:
parent
e2befee5d8
commit
2f332b4bbc
14
bin/sass.dart
Normal file
14
bin/sass.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2016 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:sass/src/parser.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
var parser = new Parser(new File(args.first).readAsStringSync(),
|
||||
url: p.toUri(args.first));
|
||||
print(parser.parse());
|
||||
}
|
@ -22,8 +22,8 @@ class Parser {
|
||||
|
||||
// Conventions:
|
||||
//
|
||||
// * All statement and expression functions consume through following
|
||||
// whitespace, including comments.
|
||||
// * All statement functions consume through following whitespace, including
|
||||
// comments. No other functions do so unless explicitly specified.
|
||||
//
|
||||
// * A function will return `null` if it fails to match iff it begins with
|
||||
// "try".
|
||||
@ -78,9 +78,9 @@ class Parser {
|
||||
guarded: guarded, global: global, span: _scanner.spanFrom(start));
|
||||
}
|
||||
|
||||
AstNode _tryAtRule() => throw new UnimplementedError();
|
||||
AstNode _tryAtRule() => null;
|
||||
|
||||
AstNode _tryDeclaration() => throw new UnimplementedError();
|
||||
AstNode _tryDeclaration() => null;
|
||||
|
||||
/// Consumes whitespace if available and returns any comments it contained.
|
||||
List<CommentNode> _comments() {
|
||||
@ -122,6 +122,7 @@ class Parser {
|
||||
var next = _trySingleExpression();
|
||||
if (next == null) break;
|
||||
spaceExpressions.add(next);
|
||||
_ignoreComments();
|
||||
}
|
||||
|
||||
if (spaceExpressions.isEmpty) {
|
||||
@ -177,6 +178,8 @@ class Parser {
|
||||
return _unaryOperator();
|
||||
|
||||
default:
|
||||
if (first == null) return null;
|
||||
|
||||
if (_isNameStart(first) || first == $backslash) {
|
||||
return _identifierLike();
|
||||
}
|
||||
@ -237,6 +240,7 @@ class Parser {
|
||||
}
|
||||
}
|
||||
|
||||
if (!text.isEmpty) contents.add(text.toString());
|
||||
return new InterpolationExpression(
|
||||
contents, span: _scanner.spanFrom(start));
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ environment:
|
||||
|
||||
dependencies:
|
||||
charcode: "^1.1.0"
|
||||
path: "^1.0.0"
|
||||
source_span: "^1.0.0"
|
||||
string_scanner: "^0.1.4"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user