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
53
enum
ff2c_token_type
{
55
FTT_IDENTIFIER
= 1,
57
FTT_REQUIRE
,
59
FTT_STRING
,
61
FTT_VOID
,
63
FTT_U8
,
65
FTT_U32
,
67
FTT_U64
,
69
FTT_OPAQUE
,
71
FTT_RECORD
,
73
FTT_UNION
,
75
FTT_SEQUENCE
,
77
FTT_ARRAY
,
79
FTT_OPEN
,
81
FTT_CLOSE
,
83
FTT_SEMICOLON
,
85
FTT_TAG
,
87
FTT_ESCAPE
88
};
89
91
extern
const
char
*
ff2c_token_type_name
[];
92
94
struct
ff2c_token
{
95
enum
ff2c_token_type
ft_type
;
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
;
133
struct
ff2c_token
fc_stack
[
FF2C_CTX_STACK_MAX
];
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
ff2c_token_type
Definition:
lex.h:53
nr
static size_t nr
Definition:
dump.c:1505
FTT_U8
Definition:
lex.h:63
FF2C_CTX_STACK_MAX
Definition:
lex.h:120
FTT_SEQUENCE
Definition:
lex.h:75
FTT_REQUIRE
Definition:
lex.h:57
FTT_CLOSE
Definition:
lex.h:81
FTT_U32
Definition:
lex.h:65
ff2c_context_fini
void ff2c_context_fini(struct ff2c_context *ctx)
Definition:
lex.c:230
ff2c_token_put
void ff2c_token_put(struct ff2c_context *ctx, struct ff2c_token *tok)
Definition:
lex.c:217
ff2c_token_get
int ff2c_token_get(struct ff2c_context *ctx, struct ff2c_token *tok)
Definition:
lex.c:134
buf
Definition:
sock.c:887
ff2c_token::ft_len
size_t ft_len
Definition:
lex.h:99
ff2c_context::fc_depth
int fc_depth
Definition:
lex.h:135
FTT_ESCAPE
Definition:
lex.h:87
ff2c_token::ft_type
enum ff2c_token_type ft_type
Definition:
lex.h:95
FTT_UNION
Definition:
lex.h:73
FTT_IDENTIFIER
Definition:
lex.h:55
ff2c_token_type_name
const char * ff2c_token_type_name[]
Definition:
lex.c:241
ff2c_context::fc_pt
const char * fc_pt
Definition:
lex.h:129
ff2c_context::fc_remain
size_t fc_remain
Definition:
lex.h:131
FTT_SEMICOLON
Definition:
lex.h:83
ff2c_context::fc_size
size_t fc_size
Definition:
lex.h:127
ff2c_context::fc_stack
struct ff2c_token fc_stack[FF2C_CTX_STACK_MAX]
Definition:
lex.h:133
FTT_STRING
Definition:
lex.h:59
ff2c_context::fc_origin
const char * fc_origin
Definition:
lex.h:125
ff2c_context_loc
int ff2c_context_loc(struct ff2c_context *ctx, int nr, char *buf)
Definition:
lex.c:234
FTT_U64
Definition:
lex.h:67
ff2c_token
Definition:
lex.h:94
size
m0_bcount_t size
Definition:
di.c:39
ff2c_context::fc_col
int fc_col
Definition:
lex.h:142
ff2c_context::fc_line
int fc_line
Definition:
lex.h:138
FTT_TAG
Definition:
lex.h:85
FTT_VOID
Definition:
lex.h:61
FTT_OPEN
Definition:
lex.h:79
FTT_ARRAY
Definition:
lex.h:77
ctx
Definition:
nucleus.c:42
ff2c_token::ft_val
const char * ft_val
Definition:
lex.h:97
ff2c_context
Definition:
lex.h:123
FTT_RECORD
Definition:
lex.h:71
ff2c_context_init
void ff2c_context_init(struct ff2c_context *ctx, const char *buf, size_t size)
Definition:
lex.c:224
FTT_OPAQUE
Definition:
lex.h:69
xcode
ff2c
lex.h
Generated on Thu Apr 14 2022 14:03:01 for Motr by
1.8.14