mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
libSyntax: create a basic infrastructure for generating libSyntax entities by using Parser.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "swift/AST/Identifier.h"
|
||||
#include "swift/Basic/LangOptions.h"
|
||||
#include "swift/Basic/SourceManager.h"
|
||||
#include "swift/Syntax/TokenSyntax.h"
|
||||
#include "swift/Syntax/SyntaxParsingContext.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@@ -737,11 +737,12 @@ static bool rangeContainsPlaceholderEnd(const char *CurPtr,
|
||||
return false;
|
||||
}
|
||||
|
||||
RC<syntax::RawTokenSyntax> Lexer::fullLex() {
|
||||
syntax::RawTokenInfo Lexer::fullLex() {
|
||||
if (NextToken.isEscapedIdentifier()) {
|
||||
LeadingTrivia.push_back(syntax::TriviaPiece::backtick());
|
||||
TrailingTrivia.push_front(syntax::TriviaPiece::backtick());
|
||||
}
|
||||
auto Loc = NextToken.getLoc();
|
||||
auto Result = syntax::RawTokenSyntax::make(NextToken.getKind(),
|
||||
OwnedString(NextToken.getText()).copy(),
|
||||
syntax::SourcePresence::Present,
|
||||
@@ -751,7 +752,7 @@ RC<syntax::RawTokenSyntax> Lexer::fullLex() {
|
||||
if (NextToken.isNot(tok::eof)) {
|
||||
lexImpl();
|
||||
}
|
||||
return Result;
|
||||
return {Loc, Result};
|
||||
}
|
||||
|
||||
/// lexOperatorIdentifier - Match identifiers formed out of punctuation.
|
||||
|
||||
Reference in New Issue
Block a user