private static bool CompleteAgainstSwitchFile(Ast lastAst, Token tokenBeforeCursor) { Tuple <Token, Ast> tuple; ErrorStatementAst ast = lastAst as ErrorStatementAst; if ((((ast != null) && (ast.Flags != null)) && ((ast.Kind != null) && (tokenBeforeCursor != null))) && (ast.Kind.Kind.Equals(TokenKind.Switch) && ast.Flags.TryGetValue("file", out tuple))) { return(tuple.Item1.Extent.EndOffset == tokenBeforeCursor.Extent.EndOffset); } if (!(lastAst.Parent is CommandExpressionAst)) { return(false); } PipelineAst parent = lastAst.Parent.Parent as PipelineAst; if (parent == null) { return(false); } ast = parent.Parent as ErrorStatementAst; if (((ast == null) || (ast.Kind == null)) || (ast.Flags == null)) { return(false); } return((ast.Kind.Kind.Equals(TokenKind.Switch) && ast.Flags.TryGetValue("file", out tuple)) && (tuple.Item2 == parent)); }
private static bool CompleteAgainstStatementFlags(Ast scriptAst, Ast lastAst, Token token, out TokenKind kind) { Func <Ast, bool> predicate = null; kind = TokenKind.Unknown; ErrorStatementAst ast = lastAst as ErrorStatementAst; if (((ast != null) && (ast.Kind != null)) && (ast.Kind.Kind == TokenKind.Switch)) { kind = TokenKind.Switch; return(true); } ScriptBlockAst ast2 = scriptAst as ScriptBlockAst; if (((token != null) && (token.Kind == TokenKind.Minus)) && (ast2 != null)) { Tuple <Token, Ast> tuple; if (predicate == null) { predicate = a => IsCursorBeforeExtent(token.Extent.StartScriptPosition, a.Extent); } Ast parent = AstSearcher.FindAll(ast2, predicate, true).LastOrDefault <Ast>(); ast = null; while (parent != null) { ast = parent as ErrorStatementAst; if (ast != null) { break; } parent = parent.Parent; } if ((((ast != null) && (ast.Kind != null)) && ((ast.Kind.Kind == TokenKind.Switch) && (ast.Flags != null))) && (ast.Flags.TryGetValue("--%", out tuple) && IsTokenTheSame(tuple.Item1, token))) { kind = TokenKind.Switch; return(true); } } return(false); }
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { throw PSTraceSource.NewArgumentException("ast"); }
public override StatementAst VisitErrorStatement(ErrorStatementAst errorStatementAst) => VisitStatement(base.VisitErrorStatement(errorStatementAst));
public override AstVisitAction VisitErrorStatement(ErrorStatementAst ast) { return(DoNextAction(ast)); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst errorStatementAst) { return(Visit(errorStatementAst)); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst errorStatementAst) { Console.WriteLine("Visited an ErrorStatementAst."); Console.WriteLine(" " + errorStatementAst.ToString().Replace(Environment.NewLine, Environment.NewLine + " ")); return(AstVisitAction.Continue); }
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { // TODO: why is there no public constructor for ast with nested asts? return(errorStatementAst.Copy()); }
public static ErrorStatementAst Update(this ErrorStatementAst ast) { return(ast.Clone()); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst errorStatementAst) { // SKIP AstExplainer(errorStatementAst); return(base.VisitErrorStatement(errorStatementAst)); }
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { throw new UnexpectedElementException(); }
object ICustomAstVisitor.VisitErrorStatement(ErrorStatementAst errorStatementAst) => ProcessRewriter(VisitErrorStatement, errorStatementAst);
public virtual StatementAst VisitErrorStatement(ErrorStatementAst errorStatementAst) { return((ErrorStatementAst)errorStatementAst.Copy()); }
public virtual TResult VisitErrorStatement(ErrorStatementAst errorStatementAst) => default(TResult);
object ICustomAstVisitor.VisitErrorStatement(ErrorStatementAst errorStatementAst) => VisitErrorStatement(errorStatementAst);
/// <summary/> public virtual AstVisitAction VisitErrorStatement(ErrorStatementAst errorStatementAst) => DefaultVisit(errorStatementAst);
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) => null;
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { throw new NotImplementedException(); }
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { Console.WriteLine("Visited an ErrorStatementAst."); return(errorStatementAst); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst ast) { return(AstVisitAction.Continue); }
public virtual object VisitErrorStatement(ErrorStatementAst errorStatementAst) { return(errorStatementAst); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst ast) { return(Check(ast)); }
public object VisitErrorStatement(ErrorStatementAst errorStatementAst) { return(false); }
public override AstVisitAction VisitErrorStatement(ErrorStatementAst errorStatementAst) => VisitAst(errorStatementAst);