• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 25456501308

06 May 2026 07:29PM UTC coverage: 55.935% (-0.8%) from 56.7%
25456501308

Pull #2011

github

web-flow
Merge 7ad262960 into 7054e405e
Pull Request #2011: Single-file CI and code style adoption

14612 of 26123 relevant lines covered (55.94%)

462107.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.6
/trick_source/sim_services/MemoryManager/adef_parser.l
1
%option prefix="ADEF_"
2
%option reentrant
3
%option bison-bridge
4
%option bison-locations
5
%option yylineno
6
%option noyywrap
7

8
%{
9
/*
10
 * This is a debug macro which is used to echo every character parsed by the
11
 * lex.
12
 */
13

14
#include <stdio.h>
15
#include <stdlib.h>
16
#include <ctype.h>
17
#include "trick/mm_error.h"
18
#include "trick/ADefParseContext.hh"
19
#include "adef_parser.tab.hpp"
20

21
#pragma GCC diagnostic ignored "-Wunused-parameter"
22
#pragma GCC diagnostic ignored "-Wsign-compare"
23
#pragma GCC diagnostic ignored "-Wunused-function"
24

25
#define YY_EXTRA_TYPE Trick::ADefParseContext*
26

27
#define YY_USER_ACTION yylloc->first_line = yylineno;
28

29
#define YY_INPUT(buf, result, maxsize)            \
30
{                                                 \
31
    char c;                                       \
32
    (*yyextra->is) >> std::noskipws >> c;              \
33
    if (yyextra->is->eof()) {                     \
34
        result = YY_NULL;                         \
35
    } else {                                      \
36
        buf[0] = c;                               \
37
        result = 1;                               \
38
    }                                             \
39
}
40

41
/*===== END OF INITIAL C SOURCE CODE SECTION =====*/
42

43
/*=== LEXICAL SPECIFICATIONS ===*/
44

45
%}
46
W     [ \t]
47
D     [0-9]
48
OCT   "0"[0-7]+
49
HEX   "0"[Xx][0-9a-fA-F]+
50
NAM   [_a-zA-Z][_a-zA-Z0-9:]*
51

52
%%
53

54
 yy_flex_debug = 0;
55
 Trick::ADefParseContext* context = yyextra ;
23,634✔
56

23,634✔
57
"*" |
58
"[" |
59
"]" { return( (int)yytext[0] ); }
60

7,003✔
61
"char" {
7,003✔
62
   yylval->ival = TRICK_CHARACTER ;
59✔
63
   return( TYPE ) ;
59✔
64
}
59✔
65

66
"std::string" {
67
   yylval->ival = TRICK_STRING ;
2,298✔
68
   return( TYPE ) ;
2,298✔
69
}
2,298✔
70

71
"wchar" {
72
   yylval->ival = TRICK_WCHAR ;
1✔
73
   return( TYPE ) ;
1✔
74
}
1✔
75

76
"signed char" {
77
   yylval->ival = TRICK_CHARACTER ;
1✔
78
   return( TYPE ) ;
1✔
79
}
1✔
80

81
"int8_t" {
82
   yylval->ival = TRICK_CHARACTER ;
1✔
83
   return( TYPE ) ;
1✔
84
}
1✔
85

86
"unsigned char" {
87
   yylval->ival = TRICK_UNSIGNED_CHARACTER ;
25✔
88
   return( TYPE ) ;
25✔
89
}
25✔
90

91
"uint8_t" {
92
   yylval->ival = TRICK_UNSIGNED_CHARACTER ;
1✔
93
   return( TYPE ) ;
1✔
94
}
1✔
95

96
"short" {
97
   yylval->ival = TRICK_SHORT ;
118✔
98
   return( TYPE ) ;
118✔
99
}
118✔
100

101
"signed short" {
102
   yylval->ival = TRICK_SHORT ;
1✔
103
   return( TYPE ) ;
1✔
104
}
1✔
105

106
"int16_t" {
107
   yylval->ival = TRICK_SHORT ;
1✔
108
   return( TYPE ) ;
1✔
109
}
1✔
110

111
"unsigned short" {
112
   yylval->ival = TRICK_UNSIGNED_SHORT ;
34✔
113
   return( TYPE ) ;
34✔
114
}
34✔
115

116
"uint16_t" {
117
   yylval->ival = TRICK_UNSIGNED_SHORT ;
1✔
118
   return( TYPE ) ;
1✔
119
}
1✔
120

121
"int" {
122
   yylval->ival = TRICK_INTEGER ;
645✔
123
   return( TYPE ) ;
645✔
124
}
645✔
125

126
"signed int" {
127
   yylval->ival = TRICK_INTEGER ;
1✔
128
   return( TYPE ) ;
1✔
129
}
1✔
130

131
"int32_t" {
132
   yylval->ival = TRICK_INTEGER ;
1✔
133
   return( TYPE ) ;
1✔
134
}
1✔
135

136
"unsigned int" {
137
   yylval->ival = TRICK_UNSIGNED_INTEGER ;
61✔
138
   return( TYPE ) ;
61✔
139
}
61✔
140

141
"uint32_t" {
142
   yylval->ival = TRICK_UNSIGNED_INTEGER ;
1✔
143
   return( TYPE ) ;
1✔
144
}
1✔
145

146
"int64_t" {
147
   yylval->ival = TRICK_INT64 ;
1✔
148
   return( TYPE ) ;
1✔
149
}
1✔
150

151
"uint64_t" {
152
   yylval->ival = TRICK_UINT64 ;
1✔
153
   return( TYPE ) ;
1✔
154
}
1✔
155

156
"long" {
157
   yylval->ival = TRICK_LONG ;
39✔
158
   return( TYPE ) ;
39✔
159
}
39✔
160

161
"signed long" {
162
   yylval->ival = TRICK_LONG ;
1✔
163
   return( TYPE ) ;
1✔
164
}
1✔
165

166
"unsigned long" {
167
   yylval->ival = TRICK_UNSIGNED_LONG ;
34✔
168
   return( TYPE ) ;
34✔
169
}
34✔
170

171
"long long" {
172
   yylval->ival = TRICK_LONG_LONG ;
41✔
173
   return( TYPE ) ;
41✔
174
}
41✔
175

176
"signed long long" {
177
   yylval->ival = TRICK_LONG_LONG ;
1✔
178
   return( TYPE ) ;
1✔
179
}
1✔
180

181
"unsigned long long" {
182
   yylval->ival = TRICK_UNSIGNED_LONG_LONG ;
34✔
183
   return( TYPE ) ;
34✔
184
}
34✔
185

186
"float" {
187
   yylval->ival = TRICK_FLOAT ;
60✔
188
   return( TYPE ) ;
60✔
189
}
60✔
190

191
"double" {
192
   yylval->ival = TRICK_DOUBLE ;
545✔
193
   return( TYPE ) ;
545✔
194
}
545✔
195

196
"bool" {
197
   yylval->ival = TRICK_BOOLEAN ;
47✔
198
   return( TYPE ) ;
47✔
199
}
47✔
200

201
"wchar_t" {
202
   yylval->ival = TRICK_WCHAR ;
8✔
203
   return( TYPE ) ;
8✔
204
}
8✔
205

206
{NAM} {
207
   /*
4,399✔
208
    * This rule handles general parameter and label names.
4,399✔
209
    * save the name in a YACC variable and return the token to YACC.
210
    */
211
   yylval->sval = strdup( yytext ) ;
212
   return( NAME ) ;
4,399✔
213
}
4,399✔
214

215

216
{HEX} {  
1✔
217
   int i ;
1✔
218
   /*
219
    * This rule handles integers in hexidecimal format.
220
    * convert the string to an integer value, save the value in
221
    * the YACC variable and return the YACC token.
222
    * The first two characters of yytext are the "0x" characters
223
    * which signify a hex number.
224
    */
225
   sscanf( &(yytext[2]) , "%x" , &i ) ;
226
   yylval->ival = i ;
1✔
227

1✔
228
   return( I_CON ) ;
229
}
1✔
230

231

232
{D}+ {
3,309✔
233
   /*
3,309✔
234
    * This rule handles integers in decimal format.
235
    * convert the string to an integer value, save the value in
236
    * the YACC variable and return the YACC token.
237
    * Decimals can overflow for unsigned long longs so test to
238
    * see if we are over that and covert to unsigned if it's
239
    * greater that that huge number
240
    */
241
   yylval->ival = atoi(yytext);
242
   return( I_CON );
3,309✔
243
}
3,309✔
244

245
<<EOF>> {
246
   yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner ) ;
4,859✔
247
   return( 0 );
4,859✔
248
}
4,859✔
249

250

251
{W} {}
3,741✔
252

3,741✔
253

3,741✔
254
. {
1✔
255
   /*
1✔
256
    * This rule matches all other characters not matched by a previous
257
    * rule. All lex synatx error messages are handled by the rule.
258
    * Starting at the unrecognized character, all remaining characters
259
    * to the end of the current line or the end of the file are read
260
    * and stored in a buffer which is then used as part of the syntax
261
    * error message. I->token is an input processor parameter designed
262
    * specifically for use with error messages.
263
    */
264
   context->error_str = yytext ;
265
   
1✔
266
   return(MM_SYNTAX_ERROR) ;
267
}
1✔
268

269

270
%%
×
271

×
272
void Trick::ADefParseContext::init_scanner() {
×
273

4,861✔
274
    // Allocate the scanner structure.
275
    yylex_init( &scanner);
276

4,861✔
277
    // Set the file where output messages are to go.
278
    yyset_out( stdout, scanner);
279

4,861✔
280
    yyset_extra( this, scanner);
281

4,861✔
282
}
283

4,861✔
284
void Trick::ADefParseContext::destroy_scanner() {
285

4,859✔
286
    yylex_destroy(scanner);
287

4,859✔
288
}
289

4,859✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc