2016-05-24 20:56:53 +02:00
|
|
|
// 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.
|
|
|
|
|
2016-05-28 01:09:03 +02:00
|
|
|
import '../visitor/value.dart';
|
2016-05-24 20:56:53 +02:00
|
|
|
import '../value.dart';
|
|
|
|
|
|
|
|
class SassList extends Value {
|
|
|
|
final List<Value> contents;
|
|
|
|
|
|
|
|
final ListSeparator separator;
|
|
|
|
|
|
|
|
SassList(Iterable<Value> contents, this.separator)
|
|
|
|
: contents = new List.unmodifiable(contents);
|
|
|
|
|
2016-05-28 01:09:03 +02:00
|
|
|
/*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor) =>
|
|
|
|
visitor.visitList(this);
|
|
|
|
|
2016-05-24 20:56:53 +02:00
|
|
|
// TODO: parenthesize nested lists if necessary
|
|
|
|
String toString() =>
|
|
|
|
contents.join(separator == ListSeparator.comma ? ", " : " ");
|
|
|
|
}
|
|
|
|
|
|
|
|
class ListSeparator {
|
|
|
|
static const space = const ListSeparator._("space");
|
|
|
|
static const comma = const ListSeparator._("comma");
|
2016-05-25 01:22:23 +02:00
|
|
|
static const none = const ListSeparator._("none");
|
2016-05-24 20:56:53 +02:00
|
|
|
|
|
|
|
final String name;
|
|
|
|
|
|
|
|
const ListSeparator._(this.name);
|
|
|
|
|
|
|
|
String toString() => name;
|
|
|
|
}
|