Esempio n. 1
0
 internal static ExpressionAst ScanString(string str)
 {
     string str1 = string.Concat((char)34, str.Replace("\"", "\"\""), (char)34);
     Parser parser = new Parser();
     Tokenizer tokenizer = new Tokenizer(parser);
     tokenizer.Initialize(null, str1, null);
     StringExpandableToken stringExpandableToken = (StringExpandableToken)tokenizer.NextToken();
     ExpressionAst expressionAst = parser.ExpandableStringRule(stringExpandableToken);
     if (!parser._errorList.Any<ParseError>())
     {
         return expressionAst;
     }
     else
     {
         throw new ParseException(parser._errorList.ToArray());
     }
 }
Esempio n. 2
0
 internal static ExpressionAst ScanString(string str)
 {
     str = str.Replace("\"", "\"\"");
     var parser = new Parser();
     parser._tokenizer.Initialize(null, '"' + str + '"', null);
     var strToken = (StringExpandableToken)parser._tokenizer.NextToken();
     var ast = parser.ExpandableStringRule(strToken);
     if (parser.ErrorList.Count > 0)
     {
         throw new ParseException(parser.ErrorList.ToArray());
     }
     return ast;
 }