add infrastructure to keep track of observed type names in the future

This commit is contained in:
Josh Holtrop 2018-05-08 20:03:20 -04:00
parent 07fb50bb86
commit accaed47bc
2 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,8 @@
#include <unistd.h>
#include <stdbool.h>
std::unordered_set<std::string> type_names;
extern FILE * yyin;
static const char * input_fname;
@ -192,3 +194,8 @@ void handle_parse_error(const char * str, const YYLTYPE * yylloc)
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);
}

View File

@ -3,10 +3,15 @@
#include "Node.h"
#include "parser.tab.hh"
#include <unordered_set>
#include <string>
#define YYSTYPE Node *
extern std::unordered_set<std::string> type_names;
void parse(const char * filename);
void handle_parse_error(const char * str, const YYLTYPE * yylloc);
void observe_type_name(const std::string & type_name);
#endif