Motr  M0
lex.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_XCODE_FF2C_LEX_H__
26 #define __MOTR_XCODE_FF2C_LEX_H__
27 
46 #include <sys/types.h> /* size_t */
47 /* export */
48 struct ff2c_context;
49 struct ff2c_token;
50 
88 };
89 
91 extern const char *ff2c_token_type_name[];
92 
94 struct ff2c_token {
97  const char *ft_val;
99  size_t ft_len;
100 };
101 
109 int ff2c_token_get(struct ff2c_context *ctx, struct ff2c_token *tok);
118 void ff2c_token_put(struct ff2c_context *ctx, struct ff2c_token *tok);
119 
120 enum { FF2C_CTX_STACK_MAX = 32 };
121 
123 struct ff2c_context {
125  const char *fc_origin;
127  size_t fc_size;
129  const char *fc_pt;
131  size_t fc_remain;
135  int fc_depth;
138  int fc_line;
142  int fc_col;
143 };
144 
145 void ff2c_context_init(struct ff2c_context *ctx, const char *buf, size_t size);
146 void ff2c_context_fini(struct ff2c_context *ctx);
150 int ff2c_context_loc(struct ff2c_context *ctx, int nr, char *buf);
151 
154 /* __MOTR_XCODE_FF2C_LEX_H__ */
155 #endif
156 
157 /*
158  * Local variables:
159  * c-indentation-style: "K&R"
160  * c-basic-offset: 8
161  * tab-width: 8
162  * fill-column: 80
163  * scroll-step: 1
164  * End:
165  */
ff2c_token_type
Definition: lex.h:53
static size_t nr
Definition: dump.c:1505
Definition: lex.h:63
Definition: lex.h:81
Definition: lex.h:65
void ff2c_context_fini(struct ff2c_context *ctx)
Definition: lex.c:230
void ff2c_token_put(struct ff2c_context *ctx, struct ff2c_token *tok)
Definition: lex.c:217
int ff2c_token_get(struct ff2c_context *ctx, struct ff2c_token *tok)
Definition: lex.c:134
Definition: sock.c:887
size_t ft_len
Definition: lex.h:99
int fc_depth
Definition: lex.h:135
Definition: lex.h:87
enum ff2c_token_type ft_type
Definition: lex.h:95
Definition: lex.h:73
const char * ff2c_token_type_name[]
Definition: lex.c:241
const char * fc_pt
Definition: lex.h:129
size_t fc_remain
Definition: lex.h:131
size_t fc_size
Definition: lex.h:127
struct ff2c_token fc_stack[FF2C_CTX_STACK_MAX]
Definition: lex.h:133
Definition: lex.h:59
const char * fc_origin
Definition: lex.h:125
int ff2c_context_loc(struct ff2c_context *ctx, int nr, char *buf)
Definition: lex.c:234
Definition: lex.h:67
Definition: lex.h:94
m0_bcount_t size
Definition: di.c:39
int fc_col
Definition: lex.h:142
int fc_line
Definition: lex.h:138
Definition: lex.h:85
Definition: lex.h:61
Definition: lex.h:79
Definition: lex.h:77
Definition: nucleus.c:42
const char * ft_val
Definition: lex.h:97
Definition: lex.h:71
void ff2c_context_init(struct ff2c_context *ctx, const char *buf, size_t size)
Definition: lex.c:224
Definition: lex.h:69