rcl  master
C API providing common ROS client library functionality.
lexer_lookahead.h
1 // Copyright 2018 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCL__LEXER_LOOKAHEAD_H_
16 #define RCL__LEXER_LOOKAHEAD_H_
17 
18 #include <stddef.h>
19 
20 #include "rcl/allocator.h"
21 #include "rcl/lexer.h"
22 #include "rcl/macros.h"
23 #include "rcl/types.h"
24 #include "rcl/visibility_control.h"
25 
26 #if __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 // Forward declaration
32 struct rcl_lexer_lookahead2_impl_t;
33 
35 typedef struct rcl_lexer_lookahead2_t
36 {
38  struct rcl_lexer_lookahead2_impl_t * impl;
40 
42 
54 RCL_PUBLIC
55 RCL_WARN_UNUSED
57 rcl_get_zero_initialized_lexer_lookahead2();
58 
60 
83 RCL_PUBLIC
84 RCL_WARN_UNUSED
85 rcl_ret_t
86 rcl_lexer_lookahead2_init(
87  rcl_lexer_lookahead2_t * buffer,
88  const char * text,
89  rcl_allocator_t allocator);
90 
92 
109 RCL_PUBLIC
110 RCL_WARN_UNUSED
111 rcl_ret_t
112 rcl_lexer_lookahead2_fini(
113  rcl_lexer_lookahead2_t * buffer);
114 
116 
136 RCL_PUBLIC
137 RCL_WARN_UNUSED
138 rcl_ret_t
139 rcl_lexer_lookahead2_peek(
140  rcl_lexer_lookahead2_t * buffer,
141  rcl_lexeme_t * next_type);
142 
144 
165 RCL_PUBLIC
166 RCL_WARN_UNUSED
167 rcl_ret_t
168 rcl_lexer_lookahead2_peek2(
169  rcl_lexer_lookahead2_t * buffer,
170  rcl_lexeme_t * next_type1,
171  rcl_lexeme_t * next_type2);
172 
174 
195 RCL_PUBLIC
196 RCL_WARN_UNUSED
197 rcl_ret_t
198 rcl_lexer_lookahead2_accept(
199  rcl_lexer_lookahead2_t * buffer,
200  const char ** lexeme_text,
201  size_t * lexeme_text_length);
202 
204 
228 RCL_PUBLIC
229 RCL_WARN_UNUSED
230 rcl_ret_t
231 rcl_lexer_lookahead2_expect(
232  rcl_lexer_lookahead2_t * buffer,
233  rcl_lexeme_t type,
234  const char ** lexeme_text,
235  size_t * lexeme_text_length);
236 
238 
252 RCL_PUBLIC
253 RCL_WARN_UNUSED
254 const char *
255 rcl_lexer_lookahead2_get_text(
256  const rcl_lexer_lookahead2_t * buffer);
257 
258 #if __cplusplus
259 }
260 #endif
261 
262 #endif // RCL__LEXER_LOOKAHEAD_H_
rcl_lexer_lookahead2_t::impl
struct rcl_lexer_lookahead2_impl_t * impl
Pointer to the lexer look ahead2 implementation.
Definition: lexer_lookahead.h:38
rcutils_allocator_t
rcl_lexer_lookahead2_t
Track lexical analysis and allow looking ahead 2 lexemes.
Definition: lexer_lookahead.h:35