public override LessNode VisitImportDeclaration(LessParser.ImportDeclarationContext context)
        {
            Expression GetImportTarget()
            {
                var str = context.referenceUrl().@string();

                if (str != null)
                {
                    return((Expression)str.Accept(this));
                }

                var quoted = context.referenceUrl().quotedExpression();

                if (quoted != null)
                {
                    return((Expression)quoted.Accept(this));
                }

                return((Url)context.referenceUrl().url().Accept(this));
            }

            var options = context.IMPORT_ONCE() != null
                                ? ImportOptions.Once
                                : context.importOption()
                          .Select(opt => opt.GetText().ParseEnum <ImportOptions>())
                          .Aggregate(ImportOptions.None, (result, opt) => result | opt);

            var mediaQueries = context.mediaQuery().Select(mq => (MediaQuery)mq.Accept(this));

            return(new ImportStatement(GetImportTarget(), options, mediaQueries));
        }
Пример #2
0
 public virtual LessNode VisitImportDeclaration(LessParser.ImportDeclarationContext context)
 {
     throw new System.NotImplementedException();
 }