• 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

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

8
%{
9

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

15
#include <stdio.h>
16
#include <stdlib.h>
17
#include <ctype.h>
18
#include "trick/mm_error.h"
19
#include "trick/RefParseContext.hh"
20
#include "ref_parser.tab.hpp"
21

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

26
#define YY_EXTRA_TYPE RefParseContext*
27

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

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

42
/*===== END OF INITIAL C SOURCE CODE SECTION =====*/
43
/*
44
 * Be careful where you put comments after this, lex doesn't like them
45
 * just anywhere. For example, the IBM needs each comment line to be its
46
 * own comment - no multi-line comments.
47
 */
48
/*=== LEXICAL SPECIFICATIONS ===*/
49

50
%}
51
W     [ \t]
52
D     [0-9]
53
OCT   "0"[0-7]+
54
HEX   "0"[Xx][0-9a-fA-F]+
55
NAM   [_a-zA-Z][_a-zA-Z0-9:]*
56

57
%%
58

59
 yy_flex_debug = 0;
60
 RefParseContext* context = yyextra ;
63,196✔
61

63,196✔
62
"." |
63
"[" |
64
"]" { return( (int)yytext[0] ); }
65

23,145✔
66
{NAM} {
23,145✔
67
   /*
16,421✔
68
    * This rule handles general parameter and label names.
16,421✔
69
    * save the name in a YACC variable and return the token to YACC.
70
    */
71
   yylval->sval = strdup( yytext ) ;
72
   return( NAME ) ;
16,421✔
73
}
16,421✔
74

75
"->" { return ( ARROW ); }
76

3✔
77
{HEX} {  
3✔
78
   int i ;
1✔
79
   /*
1✔
80
    * This rule handles integers in hexidecimal format.
81
    * convert the string to an integer value, save the value in
82
    * the YACC variable and return the YACC token.
83
    * The first two characters of yytext are the "0x" characters
84
    * which signify a hex number.
85
    */
86
   sscanf( &(yytext[2]) , "%x" , &i ) ;
87
   yylval->ival = i ;
1✔
88

1✔
89
   //fprintf(stdout,"\n%s: \"%s\"\n",__FILE__, yytext);
90
   return( I_CON ) ;
91
}
1✔
92

93

94
{D}+ {
10,168✔
95
   /*
10,168✔
96
    * This rule handles integers in decimal format.
97
    * convert the string to an integer value, save the value in
98
    * the YACC variable and return the YACC token.
99
    * Decimals can overflow for unsigned long longs so test to
100
    * see if we are over that and covert to unsigned if it's
101
    * greater that that huge number
102
    */
103
   yylval->ival = atoi(yytext);
104
   //fprintf(stdout,"\n%s: \"%s\"\n",__FILE__, yytext);
10,168✔
105
   return( I_CON );
106
}
10,168✔
107

108
<<EOF>> {
109
   yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner ) ;
13,457✔
110
   return( 0 );
13,457✔
111
}
13,457✔
112

113

114
{W} {}
×
115

×
116

×
117
. {
1✔
118
   /*
1✔
119
    * This rule matches all other characters not matched by a previous
120
    * rule. All lex synatx error messages are handled by the rule.
121
    * Starting at the unrecognized character, all remaining characters
122
    * to the end of the current line or the end of the file are read
123
    * and stored in a buffer which is then used as part of the syntax
124
    * error message. I->token is an input processor parameter designed
125
    * specifically for use with error messages.
126
    */
127
   context->error_str = yytext ;
128
   context->save_str_pos = yytext ;
1✔
129
   
1✔
130
   //fprintf(stdout,"\n%s: \"%s\"\n",__FILE__, yytext);
131
   return(MM_SYNTAX_ERROR) ;
132
}
1✔
133

134

135
%%
×
136

×
137
void RefParseContext::init_scanner() {
×
138

13,611✔
139
    // Allocate the scanner structure.
140
    yylex_init( &scanner);
141

13,611✔
142
    // Set the file where output messages are to go.
143
    yyset_out( stdout, scanner);
144

13,611✔
145
    yyset_extra( this, scanner);
146

13,611✔
147
}
148

13,611✔
149
void RefParseContext::destroy_scanner() {
150

13,611✔
151
    yylex_destroy(scanner);
152

13,611✔
153
}
154

13,611✔
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