Пример #1
0
        private ParseItem CreateBang(ComplexItem parent, ITextProvider text, ITokenStream stream)
        {
            var modifier = stream.Peek(1);

            if (BangModifier.IsValidModifier(text, modifier, "default"))
            {
                return(new DefaultModifier());
            }

            if (BangModifier.IsValidModifier(text, modifier, "important"))
            {
                return(new ImportanceModifier());
            }

            if (BangModifier.IsValidModifier(text, modifier, "optional"))
            {
                return(new OptionalModifier());
            }

            if (VariableName.IsVariable(text, stream))
            {
                return(CreateVariableDefinitionOrReference(parent, text, stream));
            }

            return(new TokenItem());
        }
        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);
        }
Пример #3
0
 public static bool IsNamedArgument(ITextProvider text, ITokenStream stream)
 {
     return(VariableName.IsVariable(text, stream) && stream.Peek(2).Type == TokenType.Colon);
 }