public override int GetStop(PythonAst ast) { return ast.IndexToLocation(_endIndex).Index; }
public SourceLocation GetEnd(PythonAst parent) { return(parent.IndexToLocation(EndIndex)); }
public override int GetStart(PythonAst ast) { return ast.IndexToLocation(_startIndex).Index; }
public SourceLocation GetHeader(PythonAst ast) { return ast.IndexToLocation(_headerIndex); }
public SourceLocation GetStart(PythonAst parent) { return(parent.IndexToLocation(StartIndex)); }
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))); }
public SourceLocation GetStart(PythonAst parent) { return parent.IndexToLocation(StartIndex); }
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)); }
public override int GetBodyStart(PythonAst ast) { return ast.IndexToLocation(((ClassDefinition)Node).HeaderIndex).Index; }
/// <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)); }