Пример #1
0
 public NormalExpressionWalker(PythonAst ast, int location, int endLocation, GetExpressionOptions options) : base(location)
 {
     Tree = ast;
     ExtendedStatements = true;
     _endLocation       = endLocation;
     _options           = options;
 }
Пример #2
0
        public ExpressionFinder(string expression, PythonLanguageVersion version, GetExpressionOptions options)
        {
            var parser = Parser.CreateParser(new StringReader(expression), version, ParserOptions.Default);

            Ast = parser.ParseTopExpression();
            Ast.Body.SetLoc(0, expression.Length);
            Options = options.Clone();
        }
Пример #3
0
        public ExpressionFinder(string expression, PythonLanguageVersion version, GetExpressionOptions options)
        {
            var parserOpts = new ParserOptions {
                Verbatim = true
            };

            using (var parser = Parser.CreateParser(new StringReader(expression), version, parserOpts)) {
                Ast = parser.ParseTopExpression();
                Ast.Body.SetLoc(0, expression.Length);
            }
            Options = options.Clone();
        }
Пример #4
0
 public ExpressionFinder(PythonAst ast, GetExpressionOptions options)
 {
     Ast     = ast;
     Options = options.Clone();
 }
Пример #5
0
 public NormalExpressionWalker(PythonAst ast, int location, int endLocation, GetExpressionOptions options) : base(location)
 {
     _ast         = ast;
     _endLocation = endLocation;
     _options     = options;
 }
Пример #6
0
        public static Node GetNode(PythonAst ast, SourceLocation location, GetExpressionOptions options)
        {
            var finder = new ExpressionFinder(ast, options);

            return(finder.GetExpression(location));
        }