static ParseItem CreateFunctionArgument(ComplexItem parent, IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (parent is MixinReference || parent is SystemFunctionReference || parent is UserFunctionReference)
            {
                if (VariableName.IsVariable(text, stream) && stream.Peek(2).Type == TokenType.Colon)
                {
                    return(new NamedFunctionArgument());
                }
            }

            return(null);
        }
        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            var name = new VariableName(SassClassifierType.VariableReference);

            if (name.Parse(itemFactory, text, stream))
            {
                Name = name;
                Children.Add(name);
            }

            return(Children.Count > 0);
        }
        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            var name = new VariableName(SassClassifierType.VariableDefinition);

            if (name.Parse(itemFactory, text, stream))
            {
                Name = name;
                Children.Add(name);
            }

            if (stream.Current.Type == TokenType.Colon)
            {
                Colon = Children.AddCurrentAndAdvance(stream);
            }

            while (!IsValueTerminator(Mode, stream))
            {
                ParseItem item;
                if (itemFactory.TryCreateParsedOrDefault(this, text, stream, out item))
                {
                    Values.Add(item);
                    Children.Add(item);
                }
            }

            if (stream.Current.Type == TokenType.Bang)
            {
                var modifier = new DefaultModifier();
                if (modifier.Parse(itemFactory, text, stream))
                {
                    Modifier = modifier;
                    Children.Add(modifier);
                }
                else
                {
                    Children.AddCurrentAndAdvance(stream);
                }
            }

            if (stream.Current.Type == TokenType.Semicolon)
            {
                Semicolon = Children.AddCurrentAndAdvance(stream);
            }

            return(Children.Count > 0);
        }
Beispiel #4
0
 public static bool IsNamedArgument(ITextProvider text, ITokenStream stream)
 {
     return(VariableName.IsVariable(text, stream) && stream.Peek(2).Type == TokenType.Colon);
 }