rcl  master
C API providing common ROS client library functionality.
lexer_lookahead.h
Go to the documentation of this file.
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 
16 
17 #ifndef RCL__LEXER_LOOKAHEAD_H_
18 #define RCL__LEXER_LOOKAHEAD_H_
19 
20 #include <stddef.h>
21 
22 #include "rcl/allocator.h"
23 #include "rcl/lexer.h"
24 #include "rcl/macros.h"
25 #include "rcl/types.h"
26 #include "rcl/visibility_control.h"
27 
28 #if __cplusplus
29 extern "C"
30 {
31 #endif
32 
33 // Forward declaration
34 struct rcl_lexer_lookahead2_impl_t;
35 
37 typedef struct rcl_lexer_lookahead2_t
38 {
40  struct rcl_lexer_lookahead2_impl_t * impl;
42 
44 
56 RCL_PUBLIC
57 RCL_WARN_UNUSED
60 
62 
85 RCL_PUBLIC
86 RCL_WARN_UNUSED
89  rcl_lexer_lookahead2_t * buffer,
90  const char * text,
91  rcl_allocator_t allocator);
92 
94 
111 RCL_PUBLIC
112 RCL_WARN_UNUSED
113 rcl_ret_t
115  rcl_lexer_lookahead2_t * buffer);
116 
118 
138 RCL_PUBLIC
139 RCL_WARN_UNUSED
140 rcl_ret_t
142  rcl_lexer_lookahead2_t * buffer,
143  rcl_lexeme_t * next_type);
144 
146 
167 RCL_PUBLIC
168 RCL_WARN_UNUSED
169 rcl_ret_t
171  rcl_lexer_lookahead2_t * buffer,
172  rcl_lexeme_t * next_type1,
173  rcl_lexeme_t * next_type2);
174 
176 
197 RCL_PUBLIC
198 RCL_WARN_UNUSED
199 rcl_ret_t
201  rcl_lexer_lookahead2_t * buffer,
202  const char ** lexeme_text,
203  size_t * lexeme_text_length);
204 
206 
230 RCL_PUBLIC
231 RCL_WARN_UNUSED
232 rcl_ret_t
234  rcl_lexer_lookahead2_t * buffer,
235  rcl_lexeme_t type,
236  const char ** lexeme_text,
237  size_t * lexeme_text_length);
238 
240 
254 RCL_PUBLIC
255 RCL_WARN_UNUSED
256 const char *
258  const rcl_lexer_lookahead2_t * buffer);
259 
260 #if __cplusplus
261 }
262 #endif
263 
264 #endif // RCL__LEXER_LOOKAHEAD_H_
rcl_lexer_lookahead2_init
rcl_ret_t rcl_lexer_lookahead2_init(rcl_lexer_lookahead2_t *buffer, const char *text, rcl_allocator_t allocator)
Initialize an rcl_lexer_lookahead2_t instance.
rcl_lexeme_t
rcl_lexeme_t
Type of lexeme found by lexical analysis.
Definition: lexer.h:33
types.h
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rcl_get_zero_initialized_lexer_lookahead2
rcl_lexer_lookahead2_t rcl_get_zero_initialized_lexer_lookahead2()
Get a zero initialized rcl_lexer_lookahead2_t instance.
rcl_lexer_lookahead2_peek2
rcl_ret_t rcl_lexer_lookahead2_peek2(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t *next_type1, rcl_lexeme_t *next_type2)
Look ahead at the next two lexemes in the string.
rcl_lexer_lookahead2_t::impl
struct rcl_lexer_lookahead2_impl_t * impl
Pointer to the lexer look ahead2 implementation.
Definition: lexer_lookahead.h:40
lexer.h
rcl_lexer_lookahead2_accept
rcl_ret_t rcl_lexer_lookahead2_accept(rcl_lexer_lookahead2_t *buffer, const char **lexeme_text, size_t *lexeme_text_length)
Accept a lexeme and advance analysis.
rcutils_allocator_t
allocator.h
rcl_lexer_lookahead2_fini
rcl_ret_t rcl_lexer_lookahead2_fini(rcl_lexer_lookahead2_t *buffer)
Finalize an instance of an rcl_lexer_lookahead2_t structure.
rcl_lexer_lookahead2_t
Track lexical analysis and allow looking ahead 2 lexemes.
Definition: lexer_lookahead.h:37
rcl_lexer_lookahead2_t
struct rcl_lexer_lookahead2_t rcl_lexer_lookahead2_t
Track lexical analysis and allow looking ahead 2 lexemes.
rcl_lexer_lookahead2_peek
rcl_ret_t rcl_lexer_lookahead2_peek(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t *next_type)
Look ahead at the next lexeme in the string.
rcl_lexer_lookahead2_get_text
const char * rcl_lexer_lookahead2_get_text(const rcl_lexer_lookahead2_t *buffer)
Get the text at the point where it is currently being analyzed.
rcl_lexer_lookahead2_expect
rcl_ret_t rcl_lexer_lookahead2_expect(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t type, const char **lexeme_text, size_t *lexeme_text_length)
Require the next lexeme to be a certain type and advance analysis.