libSyntax: create a basic infrastructure for generating libSyntax entities by using Parser.

This commit is contained in:
Xi Ge
2017-10-18 17:02:00 -07:00
committed by GitHub
parent b1bbe48b44
commit ee7a06276d
16 changed files with 473 additions and 39 deletions

View File

@@ -25,6 +25,8 @@
#include "swift/AST/Module.h"
#include "swift/AST/Pattern.h"
#include "swift/AST/Stmt.h"
#include "swift/Syntax/RawTokenSyntax.h"
#include "swift/Syntax/SyntaxParsingContext.h"
#include "swift/Basic/OptionSet.h"
#include "swift/Parse/Lexer.h"
#include "swift/Parse/LocalContext.h"
@@ -325,6 +327,9 @@ public:
/// This vector is managed by \c StructureMarkerRAII objects.
llvm::SmallVector<StructureMarker, 16> StructureMarkers;
/// Current syntax parsing context where call backs should be directed to.
syntax::SyntaxParsingContext *SyntaxContext;
public:
Parser(unsigned BufferID, SourceFile &SF, SILParserTUStateBase *SIL,
PersistentParserState *PersistentState = nullptr);
@@ -1417,6 +1422,11 @@ tokenizeWithTrivia(const LangOptions &LangOpts,
unsigned Offset = 0,
unsigned EndOffset = 0);
void populateTokenSyntaxMap(const LangOptions &LangOpts,
const SourceManager &SM,
unsigned BufferID,
std::vector<syntax::RawTokenInfo> &Result);
} // end namespace swift
#endif