Exemplo n.º 1
0
 private string[] DoParse(string refactor, string cs, int offset)
 {
     CsGlobalNamespace globals = new CsParser.Parser().Parse(cs);
     Script script = new Parser(refactor).Parse();
     RefactorCommand[] commands = script.Evaluate(new Context(script, globals, cs, offset, 0));
     return (from c in commands select c.ToString()).ToArray();
 }
Exemplo n.º 2
0
        // "foo #{e} bar #{f}" => "foo " + e + " bar " + f
        private Expression DoParseStringLiteral(List<string> locals)
        {
            int line = m_scanner.Token.Line;
            string text = m_scanner.Token.Text();				// TODO: should change this back to not including the delimiters
            text = text.Substring(1, text.Length - 2);
            m_scanner.Advance();

            if (text.Contains("#{") && text.Contains("}"))
            {
                string expr = DoInterpolateString(line, text);	// "foo " + (e) + " bar " + (f) + ""
                Parser parser = new Parser(expr, line);
                return parser.DoParseAddExpression(locals);
            }
            else
            {
                return new StringLiteral(line, text);
            }
        }
Exemplo n.º 3
0
        private string DoParse(string refactor, string cs, int offset)
        {
            StringWriter writer = new StringWriter();
            ScriptType.Instance.SetWriter(writer);

            CsGlobalNamespace globals = new CsParser.Parser().Parse(cs);
            Script script = new Parser(refactor).Parse();
            script.Evaluate(new Context(script, globals, cs, offset, 0));

            return writer.ToString();
        }