예제 #1
0
 private static IList<ExpressionAst> ParseExpandableString(IScriptExtent extent, string value)
 {
     var parser = new ExpandableStringParser(extent, value);
     parser.Parse();
     return parser.NestedExpressions;
 }
예제 #2
0
 private void ParseExpandableString(string value)
 {
     var parser = new ExpandableStringParser(Extent, value);
     parser.Parse();
     this.NestedExpressions = parser.NestedExpressions;
 }
예제 #3
0
        private void ParseExpandableString(string value)
        {
            var parser = new ExpandableStringParser(Extent, value);
            parser.Parse();
            this.NestedExpressions = parser.NestedExpressions;

            int currentIndex = 0;
            foreach (var nestedEx in NestedExpressions)
            {
                int nestedExpressionStartIndex = GetRelativeStartIndex(nestedEx);
                var strval = value.Substring(currentIndex, nestedExpressionStartIndex - currentIndex);
                if (strval.Length > 0)
                {
                    _stringParts.Add(StringExpressionHelper.ResolveEscapeCharacters(strval, StringConstantType));
                }
                _stringParts.Add(nestedEx);
                currentIndex = GetRelativeEndIndex(nestedEx);
            }
            if (currentIndex < value.Length)
            {
                _stringParts.Add(StringExpressionHelper.ResolveEscapeCharacters(value.Substring(currentIndex),
                                                                                StringConstantType));
            }
        }