add infrastructure to keep track of observed type names in the future
This commit is contained in:
parent
07fb50bb86
commit
accaed47bc
@ -6,6 +6,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
std::unordered_set<std::string> type_names;
|
||||||
|
|
||||||
extern FILE * yyin;
|
extern FILE * yyin;
|
||||||
|
|
||||||
static const char * input_fname;
|
static const char * input_fname;
|
||||||
@ -192,3 +194,8 @@ void handle_parse_error(const char * str, const YYLTYPE * yylloc)
|
|||||||
yylloc->last_column);
|
yylloc->last_column);
|
||||||
display_error_source(yylloc->last_line, yylloc->last_column);
|
display_error_source(yylloc->last_line, yylloc->last_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void observe_type_name(const std::string & type_name)
|
||||||
|
{
|
||||||
|
type_names.insert(type_name);
|
||||||
|
}
|
||||||
|
@ -3,10 +3,15 @@
|
|||||||
|
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
#include "parser.tab.hh"
|
#include "parser.tab.hh"
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define YYSTYPE Node *
|
#define YYSTYPE Node *
|
||||||
|
|
||||||
|
extern std::unordered_set<std::string> type_names;
|
||||||
|
|
||||||
void parse(const char * filename);
|
void parse(const char * filename);
|
||||||
void handle_parse_error(const char * str, const YYLTYPE * yylloc);
|
void handle_parse_error(const char * str, const YYLTYPE * yylloc);
|
||||||
|
void observe_type_name(const std::string & type_name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user