private static RootName ParseImplicitNamespaceName(ITokenIterator tokens) { RootName name = GlobalNamespaceName.Instance; foreach (var segment in tokens.Context.File.Reference.Namespace) { name = name.Qualify(segment); } return(name); }
public NamespaceDeclarationSyntax( CodeFile file, bool inGlobalNamespace, Name name, TextSpan nameSpan, RootName nameContext, FixedList <UsingDirectiveSyntax> usingDirectives, FixedList <DeclarationSyntax> declarations) : base(file, nameSpan) { Name = name; FullName = nameContext.Qualify(name); UsingDirectives = usingDirectives; Declarations = declarations; InGlobalNamespace = inGlobalNamespace; NameContext = nameContext; }
public UsingDirectiveSyntax AcceptUsingDirective() { if (!Tokens.Accept <IUsingKeywordToken>()) { return(null); } var identifiers = AcceptOneOrMore <IIdentifierToken, IDotToken>( () => Tokens.AcceptToken <IIdentifierToken>()); RootName name = GlobalNamespaceName.Instance; foreach (var identifier in identifiers) { name = name.Qualify(identifier.Value); } Tokens.Expect <ISemicolonToken>(); return(new UsingDirectiveSyntax((Name)name)); }