void CheckAliases(CompilationUnit u) { Assert.AreEqual(3, u.Children.Count); Assert.IsTrue(u.Children[0] is UsingDeclaration); UsingDeclaration ud = (UsingDeclaration)u.Children[0]; Assert.AreEqual(1, ud.Usings.Count); Assert.IsTrue(((Using)ud.Usings[0]).IsAlias); Assert.AreEqual("TESTME", ud.Usings[0].Name); Assert.AreEqual("System", ud.Usings[0].Alias.Type); Assert.IsTrue(u.Children[1] is UsingDeclaration); ud = (UsingDeclaration)u.Children[1]; Assert.AreEqual(1, ud.Usings.Count); Assert.IsTrue(((Using)ud.Usings[0]).IsAlias); Assert.AreEqual("myAlias", ud.Usings[0].Name); Assert.AreEqual("My.Name.Space", ud.Usings[0].Alias.Type); Assert.IsTrue(u.Children[2] is UsingDeclaration); ud = (UsingDeclaration)u.Children[2]; Assert.AreEqual(1, ud.Usings.Count); Assert.IsTrue(((Using)ud.Usings[0]).IsAlias); Assert.AreEqual("StringCollection", ud.Usings[0].Name); Assert.AreEqual("System.Collections.Generic.List", ud.Usings[0].Alias.Type); Assert.AreEqual("System.String", ud.Usings[0].Alias.GenericTypes[0].Type); }
public object VisitCompilationUnit(ICSharpCode.NRefactory.VB.Ast.CompilationUnit compilationUnit, object data) { // don't do node tracking as we visit all children directly foreach (AstNode node in compilationUnit.Children) { node.AcceptVisitor(this, data); } return(null); }
void CSharpParseButtonClick(object sender, EventArgs e) { var parser = new VBParser(); compilationUnit = parser.Parse(new StringReader(codeView.Text)); if (parser.HasErrors) MessageBox.Show(parser.Errors.ErrorOutput); treeView.Nodes.Clear(); foreach (var element in compilationUnit.Children) { treeView.Nodes.Add(MakeTreeNode(element)); } SelectCurrentNode(treeView.Nodes); }
void CheckTwoSimpleUsings(CompilationUnit u) { Assert.AreEqual(2, u.Children.Count); Assert.IsTrue(u.Children[0] is UsingDeclaration); UsingDeclaration ud = (UsingDeclaration)u.Children[0]; Assert.AreEqual(1, ud.Usings.Count); Assert.IsTrue(!ud.Usings[0].IsAlias); Assert.AreEqual("System", ud.Usings[0].Name); Assert.IsTrue(u.Children[1] is UsingDeclaration); ud = (UsingDeclaration)u.Children[1]; Assert.AreEqual(1, ud.Usings.Count); Assert.IsTrue(!ud.Usings[0].IsAlias); Assert.AreEqual("My.Name.Space", ud.Usings[0].Name); }
void VB() { compilationUnit = new CompilationUnit(); NodeStart(compilationUnit); Get(); while (la.kind == 1 || la.kind == 21) { StatementTerminator(); } while (la.kind == 173) { OptionStatement(CompilationUnit.MemberRole); while (la.kind == 1 || la.kind == 21) { StatementTerminator(); } } while (la.kind == 137) { ImportsStatement(CompilationUnit.MemberRole); while (la.kind == 1 || la.kind == 21) { StatementTerminator(); } } }
public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) { Debug.Assert((compilationUnit != null)); return compilationUnit.AcceptChildren(this, data); }
public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) { throw new global::System.NotImplementedException("CompilationUnit"); }
public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) { Debug.Assert((compilationUnit != null)); for (int i = 0; i < compilationUnit.Children.Count; i++) { INode o = compilationUnit.Children[i]; Debug.Assert(o != null); nodeStack.Push(o); o.AcceptVisitor(this, data); o = nodeStack.Pop(); if (o == null) compilationUnit.Children.RemoveAt(i--); else compilationUnit.Children[i] = o; } return null; }
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CompilationUnit o = other as CompilationUnit; return(o != null && GetChildrenByRole(MemberRole).DoMatch(o.GetChildrenByRole(MemberRole), match)); }
void VB() { lexer.NextToken(); // get the first token compilationUnit = new CompilationUnit(); BlockStart(compilationUnit); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } while (la.kind == 173) { OptionStmt(); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } while (la.kind == 137) { ImportsStmt(); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } while (IsGlobalAttrTarget()) { GlobalAttributeSection(); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } while (StartOf(2)) { NamespaceMemberDecl(); while (la.kind == 1 || la.kind == 21) { EndOfStmt(); } } }
public override object VisitCompilationUnit(ICSharpCode.NRefactory.VB.Ast.CompilationUnit compilationUnit, object data) { variables.Clear(); return(base.VisitCompilationUnit(compilationUnit, data)); }
public virtual object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data) { return base.VisitCompilationUnit(compilationUnit, data); }
public sealed override object VisitCompilationUnit(CompilationUnit compilationUnit, object data) { this.BeginVisit(compilationUnit); object result = this.TrackedVisitCompilationUnit(compilationUnit, data); this.EndVisit(compilationUnit); return result; }
public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data) { if (compilationUnit == null) { throw new ArgumentNullException("compilationUnit"); } CodeNamespace globalNamespace = new CodeNamespace("Global"); //namespaces.Add(globalNamespace); namespaceDeclarations.Push(globalNamespace); compilationUnit.AcceptChildren(this, data); codeCompileUnit.Namespaces.Add(globalNamespace); return globalNamespace; }