Esempio n. 1
0
 public override int GetStop(PythonAst ast) {
     return ast.IndexToLocation(_endIndex).Index;
 }
Esempio n. 2
0
 public SourceLocation GetEnd(PythonAst parent)
 {
     return(parent.IndexToLocation(EndIndex));
 }
Esempio n. 3
0
 public override int GetStart(PythonAst ast) {
     return ast.IndexToLocation(_startIndex).Index;
 }
Esempio n. 4
0
 public SourceLocation GetHeader(PythonAst ast) {
     return ast.IndexToLocation(_headerIndex);
 }
Esempio n. 5
0
 public SourceLocation GetStart(PythonAst parent)
 {
     return(parent.IndexToLocation(StartIndex));
 }
Esempio n. 6
0
File: Node.cs Progetto: RussBaz/PTVS
 public SourceLocation GetEnd(PythonAst parent) {            
     return parent.IndexToLocation(EndIndex);
 }
 /// <summary>
 /// Returns the span of the name component of the expression
 /// </summary>
 public SourceSpan GetNameSpan(PythonAst parent)
 {
     return(new SourceSpan(parent.IndexToLocation(NameHeader), GetEnd(parent)));
 }
Esempio n. 8
0
File: Node.cs Progetto: RussBaz/PTVS
 public SourceLocation GetStart(PythonAst parent) {
     return parent.IndexToLocation(StartIndex);            
 }
Esempio n. 9
0
        private static int GetParentScopeIndent(InterpreterScope scope, PythonAst tree)
        {
            if (scope is ClassScope) {
                // Return column of "class" statement
                return tree.IndexToLocation(scope.GetStart(tree)).Column;
            }

            var function = scope as FunctionScope;
            if (function != null && !((FunctionDefinition)function.Node).IsLambda) {
                // Return column of "def" statement
                return tree.IndexToLocation(scope.GetStart(tree)).Column;
            }

            var isinstance = scope as IsInstanceScope;
            if (isinstance != null && isinstance._effectiveSuite != null) {
                int col = tree.IndexToLocation(isinstance._startIndex).Column;
                if (isinstance._effectiveSuite.StartIndex < isinstance._startIndex) {
                    // "assert isinstance", so scope is before the test
                    return col - 1;
                } else {
                    // "if isinstance", so scope is at the test
                    return col;
                }
            }

            return -1;
        }
 public SourceLocation GetHeader(PythonAst ast)
 {
     return(ast.IndexToLocation(_headerIndex));
 }
Esempio n. 11
0
 public override int GetBodyStart(PythonAst ast) {
     return ast.IndexToLocation(((ClassDefinition)Node).HeaderIndex).Index;
 }
Esempio n. 12
0
 /// <summary>
 /// Returns the span of the name component of the expression
 /// </summary>
 public SourceSpan GetNameSpan(PythonAst parent) {
     return new SourceSpan(parent.IndexToLocation(_nameHeader), GetEnd(parent));
 }