File tree Expand file tree Collapse file tree 3 files changed +44
-20
lines changed Expand file tree Collapse file tree 3 files changed +44
-20
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class CodeCompletionCallbacks {
34
34
protected:
35
35
Parser &P;
36
36
ASTContext &Context;
37
- Parser:: ParserPosition ExprBeginPosition;
37
+ ParserPosition ExprBeginPosition;
38
38
39
39
// / The declaration parsed during delayed parsing that was caused by code
40
40
// / completion. This declaration contained the code completion token.
@@ -65,7 +65,7 @@ class CodeCompletionCallbacks {
65
65
return CompleteExprSelectorContext != ObjCSelectorContext::None;
66
66
}
67
67
68
- void setExprBeginning (Parser:: ParserPosition PP) {
68
+ void setExprBeginning (ParserPosition PP) {
69
69
ExprBeginPosition = PP;
70
70
}
71
71
Original file line number Diff line number Diff line change 30
30
#include " swift/Parse/LocalContext.h"
31
31
#include " swift/Parse/PersistentParserState.h"
32
32
#include " swift/Parse/Token.h"
33
+ #include " swift/Parse/ParserPosition.h"
33
34
#include " swift/Parse/ParserResult.h"
34
35
#include " swift/Parse/SyntaxParserResult.h"
35
36
#include " swift/Syntax/SyntaxParsingContext.h"
@@ -358,24 +359,6 @@ class Parser {
358
359
// ===--------------------------------------------------------------------===//
359
360
// Routines to save and restore parser state.
360
361
361
- class ParserPosition {
362
- public:
363
- ParserPosition () = default ;
364
- ParserPosition &operator =(const ParserPosition &) = default ;
365
-
366
- bool isValid () const {
367
- return LS.isValid ();
368
- }
369
-
370
- private:
371
- ParserPosition (LexerState LS, SourceLoc PreviousLoc):
372
- LS (LS), PreviousLoc(PreviousLoc)
373
- {}
374
- LexerState LS;
375
- SourceLoc PreviousLoc;
376
- friend class Parser ;
377
- };
378
-
379
362
ParserPosition getParserPosition () {
380
363
return ParserPosition (L->getStateForBeginningOfToken (Tok, LeadingTrivia),
381
364
PreviousLoc);
Original file line number Diff line number Diff line change
1
+ // ===--- ParserPosition.h - Parser Position ---------------------*- C++ -*-===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ // ===----------------------------------------------------------------------===//
12
+ //
13
+ // Parser position where Parser can jump to.
14
+ //
15
+ // ===----------------------------------------------------------------------===//
16
+
17
+ #ifndef SWIFT_PARSE_PARSERPOSITION_H
18
+ #define SWIFT_PARSE_PARSERPOSITION_H
19
+
20
+ #include " swift/Basic/SourceLoc.h"
21
+ #include " swift/Parse/LexerState.h"
22
+
23
+ namespace swift {
24
+
25
+ class ParserPosition {
26
+ LexerState LS;
27
+ SourceLoc PreviousLoc;
28
+ friend class Parser ;
29
+
30
+ ParserPosition (LexerState LS, SourceLoc PreviousLoc)
31
+ : LS(LS), PreviousLoc(PreviousLoc) {}
32
+ public:
33
+ ParserPosition () = default ;
34
+ ParserPosition &operator =(const ParserPosition &) = default ;
35
+
36
+ bool isValid () const { return LS.isValid (); }
37
+ };
38
+
39
+ } // end namespace swift
40
+
41
+ #endif
You can’t perform that action at this time.
0 commit comments