xref: /aosp_15_r20/external/antlr/runtime/Cpp/include/antlr3recognizersharedstate.inl (revision 16467b971bd3e2009fad32dd79016f2c7e421deb)
1*16467b97STreehugger RobotANTLR_BEGIN_NAMESPACE()
2*16467b97STreehugger Robot
3*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
4*16467b97STreehugger RobotRecognizerSharedState<ImplTraits, StreamType>::RecognizerSharedState()
5*16467b97STreehugger Robot{
6*16467b97STreehugger Robot	m_exception = NULL;
7*16467b97STreehugger Robot	m_sizeHint = 0;
8*16467b97STreehugger Robot	m_error = false;
9*16467b97STreehugger Robot	m_errorRecovery = false;
10*16467b97STreehugger Robot	m_failed = false;
11*16467b97STreehugger Robot	m_lastErrorIndex = 0;
12*16467b97STreehugger Robot	m_errorCount = 0;
13*16467b97STreehugger Robot	m_backtracking = false;
14*16467b97STreehugger Robot	m_ruleMemo = NULL;
15*16467b97STreehugger Robot	m_tokenNames = NULL;
16*16467b97STreehugger Robot	m_tokSource = NULL;
17*16467b97STreehugger Robot	m_channel = 0;
18*16467b97STreehugger Robot	m_type = 0;
19*16467b97STreehugger Robot	m_tokenStartLine = 0;
20*16467b97STreehugger Robot	m_tokenStartCharPositionInLine = 0;
21*16467b97STreehugger Robot	m_tokenStartCharIndex = 0;
22*16467b97STreehugger Robot}
23*16467b97STreehugger Robot
24*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
25*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::FollowingType& RecognizerSharedState<ImplTraits, StreamType>::get_following()
26*16467b97STreehugger Robot{
27*16467b97STreehugger Robot	return m_following;
28*16467b97STreehugger Robot}
29*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
30*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT32 RecognizerSharedState<ImplTraits, StreamType>::get_sizeHint() const
31*16467b97STreehugger Robot{
32*16467b97STreehugger Robot	return m_sizeHint;
33*16467b97STreehugger Robot}
34*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
35*16467b97STreehugger RobotANTLR_INLINE bool RecognizerSharedState<ImplTraits, StreamType>::get_error() const
36*16467b97STreehugger Robot{
37*16467b97STreehugger Robot	return m_error;
38*16467b97STreehugger Robot}
39*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
40*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::ExceptionBaseType*
41*16467b97STreehugger RobotRecognizerSharedState<ImplTraits, StreamType>::get_exception() const
42*16467b97STreehugger Robot{
43*16467b97STreehugger Robot	return m_exception;
44*16467b97STreehugger Robot}
45*16467b97STreehugger Robot
46*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
47*16467b97STreehugger RobotANTLR_INLINE bool RecognizerSharedState<ImplTraits, StreamType>::get_errorRecovery() const
48*16467b97STreehugger Robot{
49*16467b97STreehugger Robot	return m_errorRecovery;
50*16467b97STreehugger Robot}
51*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
52*16467b97STreehugger RobotANTLR_INLINE bool RecognizerSharedState<ImplTraits, StreamType>::get_failed() const
53*16467b97STreehugger Robot{
54*16467b97STreehugger Robot	return m_failed;
55*16467b97STreehugger Robot}
56*16467b97STreehugger Robot
57*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
58*16467b97STreehugger RobotANTLR_INLINE bool RecognizerSharedState<ImplTraits, StreamType>::get_token_present() const
59*16467b97STreehugger Robot{
60*16467b97STreehugger Robot	return m_token_present;
61*16467b97STreehugger Robot}
62*16467b97STreehugger Robot
63*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
64*16467b97STreehugger RobotANTLR_INLINE ANTLR_MARKER RecognizerSharedState<ImplTraits, StreamType>::get_lastErrorIndex() const
65*16467b97STreehugger Robot{
66*16467b97STreehugger Robot	return m_lastErrorIndex;
67*16467b97STreehugger Robot}
68*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
69*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT32 RecognizerSharedState<ImplTraits, StreamType>::get_errorCount() const
70*16467b97STreehugger Robot{
71*16467b97STreehugger Robot	return m_errorCount;
72*16467b97STreehugger Robot}
73*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
74*16467b97STreehugger RobotANTLR_INLINE ANTLR_INT32 RecognizerSharedState<ImplTraits, StreamType>::get_backtracking() const
75*16467b97STreehugger Robot{
76*16467b97STreehugger Robot	return m_backtracking;
77*16467b97STreehugger Robot}
78*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
79*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::RuleMemoType* RecognizerSharedState<ImplTraits, StreamType>::get_ruleMemo() const
80*16467b97STreehugger Robot{
81*16467b97STreehugger Robot	return m_ruleMemo;
82*16467b97STreehugger Robot}
83*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
84*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT8** RecognizerSharedState<ImplTraits, StreamType>::get_tokenNames() const
85*16467b97STreehugger Robot{
86*16467b97STreehugger Robot	return m_tokenNames;
87*16467b97STreehugger Robot}
88*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
89*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT8* RecognizerSharedState<ImplTraits, StreamType>::get_tokenName( ANTLR_UINT32 i ) const
90*16467b97STreehugger Robot{
91*16467b97STreehugger Robot	return m_tokenNames[i];
92*16467b97STreehugger Robot}
93*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
94*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::CommonTokenType* RecognizerSharedState<ImplTraits, StreamType>::get_token()
95*16467b97STreehugger Robot{
96*16467b97STreehugger Robot	return &m_token;
97*16467b97STreehugger Robot}
98*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
99*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::TokenSourceType* RecognizerSharedState<ImplTraits, StreamType>::get_tokSource() const
100*16467b97STreehugger Robot{
101*16467b97STreehugger Robot	return m_tokSource;
102*16467b97STreehugger Robot}
103*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
104*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT32& RecognizerSharedState<ImplTraits, StreamType>::get_channel()
105*16467b97STreehugger Robot{
106*16467b97STreehugger Robot	return m_channel;
107*16467b97STreehugger Robot}
108*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
109*16467b97STreehugger RobotANTLR_INLINE ANTLR_UINT32 RecognizerSharedState<ImplTraits, StreamType>::get_type() const
110*16467b97STreehugger Robot{
111*16467b97STreehugger Robot	return m_type;
112*16467b97STreehugger Robot}
113*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
114*16467b97STreehugger RobotANTLR_INLINE ANTLR_INT32 RecognizerSharedState<ImplTraits, StreamType>::get_tokenStartLine() const
115*16467b97STreehugger Robot{
116*16467b97STreehugger Robot	return m_tokenStartLine;
117*16467b97STreehugger Robot}
118*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
119*16467b97STreehugger RobotANTLR_INLINE ANTLR_INT32 RecognizerSharedState<ImplTraits, StreamType>::get_tokenStartCharPositionInLine() const
120*16467b97STreehugger Robot{
121*16467b97STreehugger Robot	return m_tokenStartCharPositionInLine;
122*16467b97STreehugger Robot}
123*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
124*16467b97STreehugger RobotANTLR_INLINE ANTLR_MARKER RecognizerSharedState<ImplTraits, StreamType>::get_tokenStartCharIndex() const
125*16467b97STreehugger Robot{
126*16467b97STreehugger Robot	return m_tokenStartCharIndex;
127*16467b97STreehugger Robot}
128*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
129*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::StringType& RecognizerSharedState<ImplTraits, StreamType>::get_text()
130*16467b97STreehugger Robot{
131*16467b97STreehugger Robot	return m_text;
132*16467b97STreehugger Robot}
133*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
134*16467b97STreehugger RobotANTLR_INLINE typename RecognizerSharedState<ImplTraits, StreamType>::StreamsType& RecognizerSharedState<ImplTraits, StreamType>::get_streams()
135*16467b97STreehugger Robot{
136*16467b97STreehugger Robot	return m_streams;
137*16467b97STreehugger Robot}
138*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
139*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_exception( ExceptionBaseType* exception )
140*16467b97STreehugger Robot{
141*16467b97STreehugger Robot	m_exception = exception;
142*16467b97STreehugger Robot}
143*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
144*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_following( const FollowingType& following )
145*16467b97STreehugger Robot{
146*16467b97STreehugger Robot	m_following = following;
147*16467b97STreehugger Robot}
148*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
149*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_sizeHint( ANTLR_UINT32 sizeHint )
150*16467b97STreehugger Robot{
151*16467b97STreehugger Robot	m_sizeHint = sizeHint;
152*16467b97STreehugger Robot}
153*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
154*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_error( bool error )
155*16467b97STreehugger Robot{
156*16467b97STreehugger Robot	m_error = error;
157*16467b97STreehugger Robot}
158*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
159*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_errorRecovery( bool errorRecovery )
160*16467b97STreehugger Robot{
161*16467b97STreehugger Robot	m_errorRecovery = errorRecovery;
162*16467b97STreehugger Robot}
163*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
164*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_failed( bool failed )
165*16467b97STreehugger Robot{
166*16467b97STreehugger Robot	m_failed = failed;
167*16467b97STreehugger Robot}
168*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
169*16467b97STreehugger RobotANTLR_INLINE void  RecognizerSharedState<ImplTraits, StreamType>::set_token_present(bool token_present)
170*16467b97STreehugger Robot{
171*16467b97STreehugger Robot	m_token_present = token_present;
172*16467b97STreehugger Robot}
173*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
174*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_lastErrorIndex( ANTLR_MARKER lastErrorIndex )
175*16467b97STreehugger Robot{
176*16467b97STreehugger Robot	m_lastErrorIndex = lastErrorIndex;
177*16467b97STreehugger Robot}
178*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
179*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_errorCount( ANTLR_UINT32 errorCount )
180*16467b97STreehugger Robot{
181*16467b97STreehugger Robot	m_errorCount = errorCount;
182*16467b97STreehugger Robot}
183*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
184*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_backtracking( ANTLR_INT32 backtracking )
185*16467b97STreehugger Robot{
186*16467b97STreehugger Robot	m_backtracking = backtracking;
187*16467b97STreehugger Robot}
188*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
189*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_ruleMemo( RuleMemoType* ruleMemo )
190*16467b97STreehugger Robot{
191*16467b97STreehugger Robot	m_ruleMemo = ruleMemo;
192*16467b97STreehugger Robot}
193*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
194*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_tokenNames( ANTLR_UINT8** tokenNames )
195*16467b97STreehugger Robot{
196*16467b97STreehugger Robot	m_tokenNames = tokenNames;
197*16467b97STreehugger Robot}
198*16467b97STreehugger Robot
199*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
200*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_tokSource( TokenSourceType* tokSource )
201*16467b97STreehugger Robot{
202*16467b97STreehugger Robot	m_tokSource = tokSource;
203*16467b97STreehugger Robot}
204*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
205*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_channel( ANTLR_UINT32 channel )
206*16467b97STreehugger Robot{
207*16467b97STreehugger Robot	m_channel = channel;
208*16467b97STreehugger Robot}
209*16467b97STreehugger Robot
210*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
211*16467b97STreehugger RobotANTLR_INLINE void  RecognizerSharedState<ImplTraits, StreamType>::set_token(const CommonTokenType* tok)
212*16467b97STreehugger Robot{
213*16467b97STreehugger Robot	this->set_token_present( tok != NULL );
214*16467b97STreehugger Robot	if( tok != NULL )
215*16467b97STreehugger Robot		m_token = *tok;
216*16467b97STreehugger Robot}
217*16467b97STreehugger Robot
218*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
219*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_type( ANTLR_UINT32 type )
220*16467b97STreehugger Robot{
221*16467b97STreehugger Robot	m_type = type;
222*16467b97STreehugger Robot}
223*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
224*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_tokenStartLine( ANTLR_INT32 tokenStartLine )
225*16467b97STreehugger Robot{
226*16467b97STreehugger Robot	m_tokenStartLine = tokenStartLine;
227*16467b97STreehugger Robot}
228*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
229*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_tokenStartCharPositionInLine( ANTLR_INT32 tokenStartCharPositionInLine )
230*16467b97STreehugger Robot{
231*16467b97STreehugger Robot	m_tokenStartCharPositionInLine = tokenStartCharPositionInLine;
232*16467b97STreehugger Robot}
233*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
234*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_tokenStartCharIndex( ANTLR_MARKER tokenStartCharIndex )
235*16467b97STreehugger Robot{
236*16467b97STreehugger Robot	m_tokenStartCharIndex = tokenStartCharIndex;
237*16467b97STreehugger Robot}
238*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
239*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_text( const StringType& text )
240*16467b97STreehugger Robot{
241*16467b97STreehugger Robot	m_text = text;
242*16467b97STreehugger Robot}
243*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
244*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::set_streams( const InputStreamsType& streams )
245*16467b97STreehugger Robot{
246*16467b97STreehugger Robot	m_streams = streams;
247*16467b97STreehugger Robot}
248*16467b97STreehugger Robot
249*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
250*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::inc_errorCount()
251*16467b97STreehugger Robot{
252*16467b97STreehugger Robot	++m_errorCount;
253*16467b97STreehugger Robot}
254*16467b97STreehugger Robot
255*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
256*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::inc_backtracking()
257*16467b97STreehugger Robot{
258*16467b97STreehugger Robot	++m_backtracking;
259*16467b97STreehugger Robot}
260*16467b97STreehugger Robot
261*16467b97STreehugger Robottemplate<class ImplTraits, class StreamType>
262*16467b97STreehugger RobotANTLR_INLINE void RecognizerSharedState<ImplTraits, StreamType>::dec_backtracking()
263*16467b97STreehugger Robot{
264*16467b97STreehugger Robot	--m_backtracking;
265*16467b97STreehugger Robot}
266*16467b97STreehugger Robot
267*16467b97STreehugger RobotANTLR_END_NAMESPACE()
268