当前位置: 首页>>代码示例>>C++>>正文


C++ SourceFile::shouldKeepSyntaxInfo方法代码示例

本文整理汇总了C++中SourceFile::shouldKeepSyntaxInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceFile::shouldKeepSyntaxInfo方法的具体用法?C++ SourceFile::shouldKeepSyntaxInfo怎么用?C++ SourceFile::shouldKeepSyntaxInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceFile的用法示例。


在下文中一共展示了SourceFile::shouldKeepSyntaxInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TokenRecorder

Parser::Parser(std::unique_ptr<Lexer> Lex, SourceFile &SF,
               SILParserTUStateBase *SIL,
               PersistentParserState *PersistentState)
  : SourceMgr(SF.getASTContext().SourceMgr),
    Diags(SF.getASTContext().Diags),
    SF(SF),
    L(Lex.release()),
    SIL(SIL),
    CurDeclContext(&SF),
    Context(SF.getASTContext()),
    TokReceiver(SF.shouldKeepSyntaxInfo() ?
                new TokenRecorder(SF) :
                new ConsumeTokenReceiver()),
    SyntaxContext(new SyntaxParsingContext(SyntaxContext, SF, Diags, SourceMgr,
                                           L->getBufferID())) {
  State = PersistentState;
  if (!State) {
    OwnedState.reset(new PersistentParserState());
    State = OwnedState.get();
  }

  // Set the token to a sentinel so that we know the lexer isn't primed yet.
  // This cannot be tok::unknown, since that is a token the lexer could produce.
  Tok.setKind(tok::NUM_TOKENS);

  auto ParserPos = State->takeParserPosition();
  if (ParserPos.isValid() &&
      L->isStateForCurrentBuffer(ParserPos.LS)) {
    restoreParserPosition(ParserPos);
    InPoundLineEnvironment = State->InPoundLineEnvironment;
  }
}
开发者ID:randomstep,项目名称:swift,代码行数:32,代码来源:Parser.cpp

示例2: RootDataOrParent

SyntaxParsingContext::SyntaxParsingContext(SyntaxParsingContext *&CtxtHolder,
                                           SourceFile &SF,
                                           DiagnosticEngine &Diags,
                                           SourceManager &SourceMgr,
                                           unsigned BufferID)
    : RootDataOrParent(new RootContextData(SF, Diags, SourceMgr, BufferID)),
      CtxtHolder(CtxtHolder), Storage(getRootData().Storage), Offset(0),
      Mode(AccumulationMode::Root), Enabled(SF.shouldKeepSyntaxInfo()) {
  CtxtHolder = this;
}
开发者ID:rymcol,项目名称:swift,代码行数:10,代码来源:SyntaxParsingContext.cpp

示例3: Parser

Parser::Parser(unsigned BufferID, SourceFile &SF, SILParserTUStateBase *SIL,
               PersistentParserState *PersistentState)
    : Parser(
          std::unique_ptr<Lexer>(new Lexer(
              SF.getASTContext().LangOpts, SF.getASTContext().SourceMgr,
              BufferID, &SF.getASTContext().Diags,
              /*InSILMode=*/SIL != nullptr,
              SF.getASTContext().LangOpts.AttachCommentsToDecls
                  ? CommentRetentionMode::AttachToNextToken
                  : CommentRetentionMode::None,
              SF.shouldKeepSyntaxInfo()
                  ? TriviaRetentionMode::WithTrivia
                  : TriviaRetentionMode::WithoutTrivia)),
          SF, SIL, PersistentState) {}
开发者ID:randomstep,项目名称:swift,代码行数:14,代码来源:Parser.cpp


注:本文中的SourceFile::shouldKeepSyntaxInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。