extern vector<string> startParsing(FILE*);
Publicado por Aliriux (1 intervención) el 01/02/2020 05:32:44
Hello friends, I would like to steal a few seconds of your time.
hola amigos, quisiera robar unos segundos de su tiempo
I have the following problem; I can't understand how this sentence interacts
tengo el siguiente problema; no logro entender como interactua esta sentencia
extern vector<string> startParsing(FILE*);
I tried to find information about (FILE*) but I can't find anything, I'm new in this field, thanks for your support.
traté de buscar informacion acerca de (FILE*) pero no logro encontrar nada, soy nuevo en este campo, gracias por su apoyo.
------------------------------------------------------------------------
------------------------main.cpp---------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------Parser.cpp---------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------Parser.h---------------------------------
------------------------------------------------------------------------
hola amigos, quisiera robar unos segundos de su tiempo
I have the following problem; I can't understand how this sentence interacts
tengo el siguiente problema; no logro entender como interactua esta sentencia
extern vector<string> startParsing(FILE*);
I tried to find information about (FILE*) but I can't find anything, I'm new in this field, thanks for your support.
traté de buscar informacion acerca de (FILE*) pero no logro encontrar nada, soy nuevo en este campo, gracias por su apoyo.
------------------------------------------------------------------------
------------------------main.cpp---------------------------------
------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <fstream>
#include "Parser/parser.h"
using namespace std;
int main(int argc, char** argv)
{
cout<<"Welcome to Group 01 final project."<<endl;
std::string rule_file = "urbanmodel.zoo";
// parsing
Parser parser(rule_file);
std::vector<std::string> tokens = parser.parse();
parser.printTokens();
return 1;
}
------------------------------------------------------------------------
------------------------Parser.cpp---------------------------------
------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "parser.h"
extern vector<string> startParsing(FILE*);
Parser::Parser(string filePath){
// open a file handle to a particular file:
this->myfile = fopen(filePath.c_str(), "r");
// make sure it's valid:
if (!this->myfile) {
cout << "I can't open the urbanmodel.zoo file!" << endl;
}
};
vector<string> Parser::parse(){
if(this->myfile)
this->tokens = startParsing(myfile);
return this->tokens;
};
void Parser::printTokens(){
int size = this->tokens.size();
for(int i=0;i<size;i++)
cout<<this->tokens[i];
cout<<std::endl;
};
------------------------------------------------------------------------
------------------------Parser.h---------------------------------
------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <vector>
#include <cstdio>
#include "scanner.h"
using namespace std;
class Parser{
private:
FILE* myfile;
vector<string> tokens;
public:
Parser(string filePath);
vector<string> parse();
void printTokens();
};
Valora esta pregunta


0