Esempio n. 1
0
        private DirectiveTriviaSyntax ParseLoadDirective(
            SyntaxToken hash,
            SyntaxToken keyword,
            bool isActive,
            bool isFollowingToken
            )
        {
            if (isActive)
            {
                if (Options.Kind == SourceCodeKind.Regular)
                {
                    keyword = this.AddError(
                        keyword,
                        ErrorCode.ERR_LoadDirectiveOnlyAllowedInScripts
                        );
                }
                else if (isFollowingToken)
                {
                    keyword = this.AddError(keyword, ErrorCode.ERR_PPLoadFollowsToken);
                }
            }

            SyntaxToken file = this.EatToken(
                SyntaxKind.StringLiteralToken,
                ErrorCode.ERR_ExpectedPPFile,
                reportError: isActive
                );

            var end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive);

            return(SyntaxFactory.LoadDirectiveTrivia(hash, keyword, file, end, isActive));
        }