Passing a pointer to Scanner instead of reference.
This way, we can handle std::cin easier.
This commit is contained in:
parent
0cf45c87b4
commit
eba0efb878
|
@ -30,7 +30,7 @@ namespace monicelli {
|
||||||
|
|
||||||
class Scanner: public yyFlexLexer {
|
class Scanner: public yyFlexLexer {
|
||||||
public:
|
public:
|
||||||
Scanner(std::istream &in): yyFlexLexer(&in) {}
|
Scanner(std::istream *in): yyFlexLexer(in) {}
|
||||||
|
|
||||||
int yylex(Parser::semantic_type *lval, Parser::location_type *loc) {
|
int yylex(Parser::semantic_type *lval, Parser::location_type *loc) {
|
||||||
this->lval = lval;
|
this->lval = lval;
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -27,7 +27,7 @@ using namespace monicelli;
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
Program program;
|
Program program;
|
||||||
Scanner scanner(std::cin);
|
Scanner scanner(&std::cin);
|
||||||
Parser parser(scanner, program);
|
Parser parser(scanner, program);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
|
Reference in New Issue
Block a user