Пример #1
0
        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);
        }
Пример #2
0
 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));
        }