private DirectiveTriviaSyntax ParseReferenceDirective( SyntaxToken hash, SyntaxToken keyword, bool isActive, bool isFollowingToken ) { if (isActive) { if (Options.Kind == SourceCodeKind.Regular) { keyword = this.AddError( keyword, ErrorCode.ERR_ReferenceDirectiveOnlyAllowedInScripts ); } else if (isFollowingToken) { keyword = this.AddError(keyword, ErrorCode.ERR_PPReferenceFollowsToken); } } SyntaxToken file = this.EatToken( SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive ); var end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive); return(SyntaxFactory.ReferenceDirectiveTrivia(hash, keyword, file, end, isActive)); }
private DirectiveTriviaSyntax ParseReferenceDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool isFollowingToken) { if (isActive && isFollowingToken) { keyword = this.AddError(keyword, ErrorCode.ERR_PPReferenceFollowsToken); } SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); var end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive, afterPragma: false, afterLineNumber: false, afterReference: true); return(SyntaxFactory.ReferenceDirectiveTrivia(hash, keyword, file, end, isActive)); }