public CartoDimension(string value, string unit, NodeLocation index) : base(value, unit) { m_index = index; if ("px".Equals(unit)) Unit = unit.Replace("px", string.Empty); }
private static void GetLineNumber(NodeLocation location, out int lineNumber, out int position) { var input = location.Source; var index = location.Index; if (location.Index > input.Length) { index = input.Length; } var first = input.Substring(0, index); var start = first.LastIndexOf('\n') + 1; lineNumber = first.Count(c => c == '\n'); position = index - start; }
public Zone(NodeLocation location, string error, Zone callZone) { var input = location.Source; var index = location.Index; if (index > input.Length) { index = input.Length; } int lineNumber, position; GetLineNumber(location, out lineNumber, out position); var lines = input.Split('\n'); FileName = location.FileName; Message = error; CallZone = callZone; LineNumber = lineNumber + 1; Position = position; Extract = new Extract(lines, lineNumber); }
public Variable Variable(string name, NodeLocation location) { return new Variable(name) { Location = location }; }
public Number Number(string value, string unit, NodeLocation location) { return new Number(value, unit) { Location = location }; }
public Color Color(string rgb, NodeLocation location) { return new Color(rgb) { Location = location }; }
public Alpha Alpha(Node value, NodeLocation location) { return new Alpha(value) { Location = location }; }
public dotless.Core.Parser.Tree.Rule Rule(string name, Node value, bool variadic, NodeLocation location) { return new CartoRule(name, value, variadic) { Location = location }; }
public Selector Selector(NodeList<Element> elements, NodeLocation location) { // TODO throw new System.NotImplementedException(); }
public Element Element(Combinator combinator, Node value, NodeLocation location) { return new CartoElement(combinator, value) { Location = location }; }
public Assignment Assignment(string key, Node value, NodeLocation location) { return new Assignment(key, value); }
public Operation Operation(string operation, Node left, Node right, NodeLocation location) { return new Operation(operation, left, right) { Location = location }; }
public Value Value(IEnumerable<Node> values, string important, NodeLocation location) { return new Value(values, important) { Location = location }; }
public Expression Expression(NodeList expression, NodeLocation location) { return new Expression(expression) { Location = location }; }
public Zone(NodeLocation location) : this(location, null, null) { }
public CssFunction CssFunction(string name, Node value, NodeLocation location) { return new CssFunction() { Name = name, Value = value, Location = location }; }
public Comment Comment(string value, NodeLocation location) { return new Comment(value) { Location = location }; }
public Combinator Combinator(string value, NodeLocation location) { return new Combinator(value) { Location = location }; }
public TextNode TextNode(string contents, NodeLocation location) { return new TextNode(contents) { Location = location }; }
public Selector Selector(NodeList<Element> elements, NodeLocation location, Env env) { return new CartoSelector(elements, env) { Location = location }; }
public Quoted Quoted(string value, string contents, bool escaped, NodeLocation location) { return new CartoQuotedNode(value, contents, escaped) { Location = location }; }
public Ruleset Ruleset(NodeList<Selector> selectors, NodeList rules, NodeLocation location) { return new Ruleset(selectors, rules) { Location = location }; }
public Paren Paren(Node value, NodeLocation location) { return new Paren(value) { Location = location }; }
public Call Call(string name, NodeList<Node> arguments, NodeLocation location) { return new Call(name, arguments) { Location = location }; }
public Condition Condition(Node left, string operation, Node right, bool negate, NodeLocation location) { return new Condition(left, operation, right, negate) { Location = location }; }
public Keyword Keyword(string value, NodeLocation location) { return new Keyword(value) { Location = location }; }
public Extend Extend(List<Selector> exact, List<Selector> partial, NodeLocation location) { return new Extend(exact, partial) { Location = location }; }
public Shorthand Shorthand(Node first, Node second, NodeLocation location) { return new Shorthand(first, second) { Location = location }; }
public GuardedRuleset GuardedRuleset(NodeList<Selector> selectors, NodeList rules, Condition condition, NodeLocation location) { return new GuardedRuleset(selectors, rules, condition) { Location = location }; }
public Url Url(Node value, IImporter importer, NodeLocation location) { return new Url(value, importer) { Location = location }; }
public Node Attribute(Node key, Node op, Node val, NodeLocation location) { return new Attribute(key, op, val) { Location = location }; }