[Syntax] Rewrite SyntaxParsingContext

Read RawSyntaxToken along with Parser::consumeToken()

* Single Lexer pass
* Backtracking support
* Split token support
This commit is contained in:
Rintaro Ishizaki
2017-11-16 01:16:37 +09:00
parent a78fda0720
commit 0a401b381c
12 changed files with 453 additions and 683 deletions

View File

@@ -83,7 +83,6 @@ namespace syntax {
class SourceFileSyntax;
class SyntaxParsingContext;
class SyntaxParsingContextRoot;
struct RawSyntaxInfo;
}
/// Discriminator for file-units.
@@ -1083,21 +1082,15 @@ public:
bool shouldKeepSyntaxInfo() const;
syntax::SourceFileSyntax getSyntaxRoot() const;
void setSyntaxRoot(syntax::SourceFileSyntax &&Root);
bool hasSyntaxRoot() const;
private:
friend class syntax::SyntaxParsingContext;
friend class syntax::SyntaxParsingContextRoot;
/// If not None, the underlying vector should contain tokens of this source file.
Optional<std::vector<Token>> AllCorrectedTokens;
/// All of the raw token syntax nodes in the underlying source.
std::vector<syntax::RawSyntaxInfo> AllRawTokenSyntax;
SourceFileSyntaxInfo &SyntaxInfo;
void setSyntaxRoot(syntax::SourceFileSyntax &&Root);
bool hasSyntaxRoot() const;
};