Start using driver, and switch to file IO.
This commit is contained in:
18
13/parser.y
18
13/parser.y
@@ -1,17 +1,21 @@
|
||||
%{
|
||||
%code requires {
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "ast.hpp"
|
||||
#include "definition.hpp"
|
||||
#include "parser.hpp"
|
||||
#include "parsed_type.hpp"
|
||||
|
||||
definition_group global_defs;
|
||||
class parse_driver;
|
||||
using yyscan_t = void*;
|
||||
}
|
||||
|
||||
extern yy::parser::symbol_type yylex();
|
||||
%param { yyscan_t scanner }
|
||||
%param { parse_driver& drv }
|
||||
|
||||
%}
|
||||
%code {
|
||||
#include "parse_driver.hpp"
|
||||
}
|
||||
|
||||
%token BACKSLASH
|
||||
%token PLUS
|
||||
@@ -59,7 +63,7 @@ extern yy::parser::symbol_type yylex();
|
||||
%%
|
||||
|
||||
program
|
||||
: definitions { global_defs = std::move($1); global_defs.vis = visibility::global; }
|
||||
: definitions { $1.vis = visibility::global; std::swap(drv.global_defs, $1); }
|
||||
;
|
||||
|
||||
definitions
|
||||
|
||||
Reference in New Issue
Block a user