File tree Expand file tree Collapse file tree 10 files changed +14
-14
lines changed Expand file tree Collapse file tree 10 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 11
11
12
12
using namespace antlr4 ;
13
13
14
- const Ref <TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT = std::make_shared< CommonTokenFactory>( );
14
+ const std::unique_ptr <TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT ( new CommonTokenFactory);
15
15
16
16
CommonTokenFactory::CommonTokenFactory (bool copyText_) : copyText(copyText_) {
17
17
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ namespace antlr4 {
22
22
* This token factory does not explicitly copy token text when constructing
23
23
* tokens.</p>
24
24
*/
25
- static const Ref <TokenFactory<CommonToken>> DEFAULT;
25
+ static const std::unique_ptr <TokenFactory<CommonToken>> DEFAULT;
26
26
27
27
protected:
28
28
/* *
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ size_t Lexer::popMode() {
136
136
}
137
137
138
138
139
- Ref< TokenFactory<CommonToken>> Lexer::getTokenFactory () {
139
+ TokenFactory<CommonToken>* Lexer::getTokenFactory () {
140
140
return _factory;
141
141
}
142
142
@@ -284,7 +284,7 @@ size_t Lexer::getNumberOfSyntaxErrors() {
284
284
void Lexer::InitializeInstanceFields () {
285
285
_syntaxErrors = 0 ;
286
286
token = nullptr ;
287
- _factory = CommonTokenFactory::DEFAULT;
287
+ _factory = CommonTokenFactory::DEFAULT. get () ;
288
288
tokenStartCharIndex = INVALID_INDEX;
289
289
tokenStartLine = 0 ;
290
290
tokenStartCharPositionInLine = 0 ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ namespace antlr4 {
31
31
32
32
protected:
33
33
// / How to create token objects.
34
- Ref< TokenFactory<CommonToken>> _factory;
34
+ TokenFactory<CommonToken> * _factory;
35
35
36
36
public:
37
37
// / The goal of all lexer rules/methods is to create a token object.
@@ -100,7 +100,7 @@ namespace antlr4 {
100
100
this ->_factory = factory;
101
101
}
102
102
103
- virtual Ref< TokenFactory<CommonToken>> getTokenFactory () override ;
103
+ virtual TokenFactory<CommonToken>* getTokenFactory () override ;
104
104
105
105
// / Set the char stream and reset the lexer
106
106
virtual void setInputStream (IntStream *input) override ;
Original file line number Diff line number Diff line change @@ -82,11 +82,11 @@ std::string ListTokenSource::getSourceName() {
82
82
return " List" ;
83
83
}
84
84
85
- Ref< TokenFactory<CommonToken>> ListTokenSource::getTokenFactory () {
85
+ TokenFactory<CommonToken>* ListTokenSource::getTokenFactory () {
86
86
return _factory;
87
87
}
88
88
89
89
void ListTokenSource::InitializeInstanceFields () {
90
90
i = 0 ;
91
- _factory = CommonTokenFactory::DEFAULT;
91
+ _factory = CommonTokenFactory::DEFAULT. get () ;
92
92
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ namespace antlr4 {
40
40
private:
41
41
// / This is the backing field for <seealso cref="#getTokenFactory"/> and
42
42
// / <seealso cref="setTokenFactory"/>.
43
- Ref< TokenFactory<CommonToken>> _factory = CommonTokenFactory::DEFAULT;
43
+ TokenFactory<CommonToken> * _factory = CommonTokenFactory::DEFAULT.get() ;
44
44
45
45
public:
46
46
// / Constructs a new <seealso cref="ListTokenSource"/> instance from the specified
@@ -79,7 +79,7 @@ namespace antlr4 {
79
79
this ->_factory = factory;
80
80
}
81
81
82
- virtual Ref< TokenFactory<CommonToken>> getTokenFactory () override ;
82
+ virtual TokenFactory<CommonToken>* getTokenFactory () override ;
83
83
84
84
private:
85
85
void InitializeInstanceFields ();
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ size_t Parser::getNumberOfSyntaxErrors() {
208
208
return _syntaxErrors;
209
209
}
210
210
211
- Ref< TokenFactory<CommonToken>> Parser::getTokenFactory () {
211
+ TokenFactory<CommonToken>* Parser::getTokenFactory () {
212
212
return _input->getTokenSource ()->getTokenFactory ();
213
213
}
214
214
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ namespace antlr4 {
193
193
// / <seealso cref= #notifyErrorListeners </seealso>
194
194
virtual size_t getNumberOfSyntaxErrors ();
195
195
196
- virtual Ref< TokenFactory<CommonToken>> getTokenFactory () override ;
196
+ virtual TokenFactory<CommonToken>* getTokenFactory () override ;
197
197
198
198
// / <summary>
199
199
// / Tell our token source and error strategy about a new way to create tokens. </summary>
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ namespace antlr4 {
138
138
139
139
virtual void setInputStream (IntStream *input) = 0;
140
140
141
- virtual Ref< TokenFactory<CommonToken>> getTokenFactory () = 0;
141
+ virtual TokenFactory<CommonToken>* getTokenFactory () = 0;
142
142
143
143
template <typename T1>
144
144
void setTokenFactory (TokenFactory<T1> *input);
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ namespace antlr4 {
79
79
// / creating <seealso cref="Token"/> objects from the input.
80
80
// / </summary>
81
81
// / <returns> The <seealso cref="TokenFactory"/> currently used by this token source. </returns>
82
- virtual Ref< TokenFactory<CommonToken>> getTokenFactory () = 0;
82
+ virtual TokenFactory<CommonToken>* getTokenFactory () = 0;
83
83
};
84
84
85
85
} // namespace antlr4
You can’t perform that action at this time.
0 commit comments