mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Re-organize AST files.
This commit is contained in:
parent
6951774d70
commit
fcaa696f02
13
lib/src/ast/css.dart
Normal file
13
lib/src/ast/css.dart
Normal file
@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
export 'css/at_rule.dart';
|
||||
export 'css/comment.dart';
|
||||
export 'css/declaration.dart';
|
||||
export 'css/media_query.dart';
|
||||
export 'css/media_rule.dart';
|
||||
export 'css/node.dart';
|
||||
export 'css/style_rule.dart';
|
||||
export 'css/stylesheet.dart';
|
||||
export 'css/value.dart';
|
@ -6,7 +6,7 @@ import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../utils.dart';
|
||||
import '../node.dart';
|
||||
import 'node.dart';
|
||||
import 'value.dart';
|
||||
|
||||
class CssMediaQuery implements AstNode {
|
||||
final CssValue<String> modifier;
|
||||
|
@ -5,6 +5,7 @@
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/css.dart';
|
||||
import 'media_query.dart';
|
||||
import 'node.dart';
|
||||
|
||||
class CssMediaRule extends CssParentNode {
|
||||
|
@ -7,15 +7,6 @@ import 'dart:collection';
|
||||
import '../../visitor/interface/css.dart';
|
||||
import '../node.dart';
|
||||
|
||||
export 'at_rule.dart';
|
||||
export 'comment.dart';
|
||||
export 'declaration.dart';
|
||||
export 'media_query.dart';
|
||||
export 'media_rule.dart';
|
||||
export 'style_rule.dart';
|
||||
export 'stylesheet.dart';
|
||||
export 'value.dart';
|
||||
|
||||
abstract class CssNode extends AstNode {
|
||||
CssParentNode get parent => _parent;
|
||||
CssParentNode _parent;
|
||||
|
37
lib/src/ast/sass.dart
Normal file
37
lib/src/ast/sass.dart
Normal file
@ -0,0 +1,37 @@
|
||||
// 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.
|
||||
|
||||
export 'sass/argument.dart';
|
||||
export 'sass/argument_declaration.dart';
|
||||
export 'sass/argument_invocation.dart';
|
||||
export 'sass/callable_declaration.dart';
|
||||
export 'sass/callable_invocation.dart';
|
||||
export 'sass/expression.dart';
|
||||
export 'sass/expression/boolean.dart';
|
||||
export 'sass/expression/color.dart';
|
||||
export 'sass/expression/function.dart';
|
||||
export 'sass/expression/identifier.dart';
|
||||
export 'sass/expression/list.dart';
|
||||
export 'sass/expression/map.dart';
|
||||
export 'sass/expression/number.dart';
|
||||
export 'sass/expression/string.dart';
|
||||
export 'sass/expression/unary_operator.dart';
|
||||
export 'sass/expression/variable.dart';
|
||||
export 'sass/interpolation.dart';
|
||||
export 'sass/media_query.dart';
|
||||
export 'sass/node.dart';
|
||||
export 'sass/statement.dart';
|
||||
export 'sass/statement/at_rule.dart';
|
||||
export 'sass/statement/comment.dart';
|
||||
export 'sass/statement/declaration.dart';
|
||||
export 'sass/statement/extend_rule.dart';
|
||||
export 'sass/statement/function_declaration.dart';
|
||||
export 'sass/statement/include.dart';
|
||||
export 'sass/statement/media_rule.dart';
|
||||
export 'sass/statement/mixin_declaration.dart';
|
||||
export 'sass/statement/return.dart';
|
||||
export 'sass/statement/style_rule.dart';
|
||||
export 'sass/statement/stylesheet.dart';
|
||||
export 'sass/statement/variable_declaration.dart';
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
import 'argument_invocation.dart';
|
||||
import 'node.dart';
|
||||
import 'statement.dart';
|
||||
|
||||
abstract class CallableInvocation implements SassNode {
|
||||
ArgumentInvocation get arguments;
|
||||
|
@ -5,17 +5,6 @@
|
||||
import '../../visitor/interface/expression.dart';
|
||||
import 'node.dart';
|
||||
|
||||
export 'expression/boolean.dart';
|
||||
export 'expression/color.dart';
|
||||
export 'expression/function.dart';
|
||||
export 'expression/identifier.dart';
|
||||
export 'expression/list.dart';
|
||||
export 'expression/map.dart';
|
||||
export 'expression/number.dart';
|
||||
export 'expression/string.dart';
|
||||
export 'expression/unary_operator.dart';
|
||||
export 'expression/variable.dart';
|
||||
|
||||
abstract class Expression implements SassNode {
|
||||
/*=T*/ accept/*<T>*/(ExpressionVisitor/*<T>*/ visitor);
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// 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 'package:charcode/charcode.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../../utils.dart';
|
||||
import '../../../value/list.dart';
|
||||
import '../../../visitor/interface/expression.dart';
|
||||
import '../expression.dart';
|
||||
|
||||
class ArgumentInvocation {
|
||||
|
||||
}
|
@ -7,7 +7,9 @@ import 'package:source_span/source_span.dart';
|
||||
import '../../../utils.dart';
|
||||
import '../../../visitor/interface/expression.dart';
|
||||
import '../expression.dart';
|
||||
import '../statement.dart';
|
||||
import '../argument_invocation.dart';
|
||||
import '../callable_invocation.dart';
|
||||
import '../interpolation.dart';
|
||||
|
||||
class FunctionExpression implements Expression, CallableInvocation {
|
||||
final Interpolation name;
|
||||
|
@ -6,7 +6,7 @@ import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../../visitor/interface/expression.dart';
|
||||
import '../expression.dart';
|
||||
import '../statement.dart';
|
||||
import '../interpolation.dart';
|
||||
|
||||
class IdentifierExpression implements Expression {
|
||||
final Interpolation text;
|
||||
|
@ -6,9 +6,10 @@ import 'package:charcode/charcode.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../../utils.dart';
|
||||
import '../../../value/list.dart';
|
||||
import '../../../value.dart';
|
||||
import '../../../visitor/interface/expression.dart';
|
||||
import '../expression.dart';
|
||||
import 'unary_operator.dart';
|
||||
|
||||
class ListExpression implements Expression {
|
||||
final List<Expression> contents;
|
||||
|
@ -9,7 +9,7 @@ import '../../../interpolation_buffer.dart';
|
||||
import '../../../util/character.dart';
|
||||
import '../../../visitor/interface/expression.dart';
|
||||
import '../expression.dart';
|
||||
import '../statement.dart';
|
||||
import '../interpolation.dart';
|
||||
|
||||
class StringExpression implements Expression {
|
||||
/// Interpolation that, when evaluated, produces the semantic content of the
|
||||
|
@ -6,8 +6,8 @@ import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../utils.dart';
|
||||
import '../node.dart';
|
||||
import 'interpolation.dart';
|
||||
import 'node.dart';
|
||||
import 'statement.dart';
|
||||
|
||||
class MediaQuery implements SassNode {
|
||||
final Interpolation modifier;
|
||||
|
@ -5,26 +5,6 @@
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'node.dart';
|
||||
|
||||
export 'at_rule.dart';
|
||||
export 'argument_declaration.dart';
|
||||
export 'argument_invocation.dart';
|
||||
export 'argument.dart';
|
||||
export 'callable_declaration.dart';
|
||||
export 'callable_invocation.dart';
|
||||
export 'comment.dart';
|
||||
export 'declaration.dart';
|
||||
export 'extend_rule.dart';
|
||||
export 'function_declaration.dart';
|
||||
export 'include.dart';
|
||||
export 'interpolation.dart';
|
||||
export 'media_query.dart';
|
||||
export 'media_rule.dart';
|
||||
export 'mixin_declaration.dart';
|
||||
export 'return.dart';
|
||||
export 'style_rule.dart';
|
||||
export 'stylesheet.dart';
|
||||
export 'variable_declaration.dart';
|
||||
|
||||
abstract class Statement implements SassNode {
|
||||
/*=T*/ accept/*<T>*/(StatementVisitor/*<T>*/ visitor);
|
||||
}
|
@ -4,8 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../interpolation.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class AtRule implements Statement {
|
||||
final String name;
|
@ -4,8 +4,8 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class Comment implements Statement {
|
||||
final String text;
|
@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'expression.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../expression.dart';
|
||||
import '../interpolation.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class Declaration implements Statement {
|
||||
final Interpolation name;
|
@ -4,8 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../interpolation.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class ExtendRule implements Statement {
|
||||
final Interpolation selector;
|
@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'argument_declaration.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../argument_declaration.dart';
|
||||
import '../callable_declaration.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class FunctionDeclaration extends CallableDeclaration {
|
||||
FunctionDeclaration(String name, ArgumentDeclaration arguments,
|
@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'argument_invocation.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../argument_invocation.dart';
|
||||
import '../callable_invocation.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class Include implements Statement, CallableInvocation {
|
||||
final String name;
|
@ -4,8 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../media_query.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class MediaRule implements Statement {
|
||||
final List<MediaQuery> queries;
|
@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'argument_declaration.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../callable_declaration.dart';
|
||||
import '../argument_declaration.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class MixinDeclaration extends CallableDeclaration {
|
||||
MixinDeclaration(String name, ArgumentDeclaration arguments,
|
@ -4,9 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'expression.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../expression.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class Return implements Statement {
|
||||
final Expression expression;
|
@ -4,8 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../interpolation.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class StyleRule implements Statement {
|
||||
final Interpolation selector;
|
@ -4,8 +4,8 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class Stylesheet implements Statement {
|
||||
final List<Statement> children;
|
@ -4,9 +4,9 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../../visitor/interface/statement.dart';
|
||||
import 'expression.dart';
|
||||
import 'statement.dart';
|
||||
import '../../../visitor/interface/statement.dart';
|
||||
import '../expression.dart';
|
||||
import '../statement.dart';
|
||||
|
||||
class VariableDeclaration implements Statement {
|
||||
final String name;
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import 'ast/sass/statement.dart';
|
||||
import 'ast/sass.dart';
|
||||
|
||||
export 'callable/built_in.dart';
|
||||
export 'callable/user_defined.dart';
|
||||
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import '../ast/sass/statement.dart';
|
||||
import '../ast/sass.dart';
|
||||
import '../callable.dart';
|
||||
import '../value.dart';
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import '../ast/sass/statement.dart';
|
||||
import '../ast/sass.dart';
|
||||
import '../callable.dart';
|
||||
import '../environment.dart';
|
||||
|
||||
|
@ -8,7 +8,7 @@ import 'dart:math' as math;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../ast/css/node.dart';
|
||||
import '../ast/css.dart';
|
||||
import '../ast/selector.dart';
|
||||
import '../utils.dart';
|
||||
import 'functions.dart';
|
||||
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import 'ast/sass/statement.dart';
|
||||
import 'ast/sass.dart';
|
||||
import 'callable.dart';
|
||||
import 'environment.dart';
|
||||
import 'value.dart';
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import 'ast/sass/expression.dart';
|
||||
import 'ast/sass/statement.dart';
|
||||
import 'ast/sass.dart';
|
||||
|
||||
class InterpolationBuffer implements StringSink {
|
||||
final _text = new StringBuffer();
|
||||
|
@ -7,8 +7,7 @@ import 'dart:math' as math;
|
||||
import 'package:charcode/charcode.dart';
|
||||
import 'package:string_scanner/string_scanner.dart';
|
||||
|
||||
import 'ast/sass/expression.dart';
|
||||
import 'ast/sass/statement.dart';
|
||||
import 'ast/sass.dart';
|
||||
import 'ast/selector.dart';
|
||||
import 'interpolation_buffer.dart';
|
||||
import 'util/character.dart';
|
||||
|
@ -10,7 +10,7 @@ import 'package:collection/collection.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import 'ast/node.dart';
|
||||
import 'value/number.dart';
|
||||
import 'value.dart';
|
||||
|
||||
const _epsilon = 1 / (10 * SassNumber.precision);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import '../../ast/css/node.dart';
|
||||
import '../../ast/css.dart';
|
||||
import 'selector.dart';
|
||||
import 'value.dart';
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import '../../ast/sass/expression.dart';
|
||||
import '../../ast/sass/statement.dart';
|
||||
import '../../ast/sass.dart';
|
||||
|
||||
abstract class ExpressionVisitor<T> {
|
||||
T visitVariableExpression(VariableExpression node) => null;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import '../../ast/sass/statement.dart';
|
||||
import '../../ast/sass.dart';
|
||||
|
||||
abstract class StatementVisitor<T> {
|
||||
T visitComment(Comment node) => null;
|
||||
|
@ -6,9 +6,8 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
import '../ast/css/node.dart';
|
||||
import '../ast/sass/expression.dart';
|
||||
import '../ast/sass/statement.dart';
|
||||
import '../ast/css.dart';
|
||||
import '../ast/sass.dart';
|
||||
import '../ast/selector.dart';
|
||||
import '../callable.dart';
|
||||
import '../environment.dart';
|
||||
|
@ -7,7 +7,7 @@ import 'dart:math' as math;
|
||||
import 'package:charcode/charcode.dart';
|
||||
import 'package:string_scanner/string_scanner.dart';
|
||||
|
||||
import '../ast/css/node.dart';
|
||||
import '../ast/css.dart';
|
||||
import '../ast/selector.dart';
|
||||
import '../util/character.dart';
|
||||
import '../value.dart';
|
||||
|
Loading…
Reference in New Issue
Block a user