public override LessNode VisitString(LessParser.StringContext context)
        {
            char quote = context.SQUOT_STRING_START() != null ? '\'' : '"';

            return(new LessString(quote, GetFragments()));

            IEnumerable <LessStringFragment> GetFragments()
            {
                // First and last character are quotes, don't include them
                var nonQuoteParts = context.children.Skip(1).Take(context.children.Count - 2);

                foreach (var strChild in nonQuoteParts)
                {
                    if (strChild is LessParser.VariableInterpolationContext interpolation)
                    {
                        yield return(new InterpolatedVariable(new Variable(interpolation.identifierVariableName().GetText())));
                    }
                    else
                    {
                        yield return(new LessStringLiteral(strChild.GetText()));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public virtual LessNode VisitString(LessParser.StringContext context)
 {
     throw new System.NotImplementedException();
 }