Skip to content

Commit 2cdbaf7

Browse files
committed
Variable Base (FPL main file)
1 parent 0717344 commit 2cdbaf7

File tree

18 files changed

+338
-37
lines changed

18 files changed

+338
-37
lines changed
33 KB
Binary file not shown.
16.6 MB
Binary file not shown.
Binary file not shown.

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": "Aucune configuration"
3+
}

.vs/VSWorkspaceState.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"SelectedNode": "\\FPL.cpp",
6+
"PreviewInSolutionExplorer": false
7+
}

.vs/slnx.sqlite

88 KB
Binary file not shown.

FPL.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
#include <string>
33
#include <iterator>
44

5-
#include <fstream> // Pour le fichier de base: Programme.fpl
5+
#include <fstream> // Pour le fichier de base
66

7-
#include "headers/Utils.h" // Utilitaire
7+
#include "headers/Utils/Utils.h" // Utilitaire
88
#include "headers/FPL_F.h" // Les functions de base
9+
#include "headers/VariablesManagement.h"
910

1011
int main()
1112
{
@@ -14,13 +15,15 @@ int main()
1415
std::string line;
1516
std::vector<std::string> content_lines_splitted;
1617

18+
VariablesManagement variables;
19+
1720
while (std::getline(file, line))
1821
{
1922
if (line == " " || line == "") { continue; }
2023

2124
content_lines_splitted = split(line);
2225

23-
FrenchProgrammingLanguage_Init(content_lines_splitted, line);
26+
FrenchProgrammingLanguage_Init(variables, content_lines_splitted, line);
2427
}
2528

2629
std::cin.ignore();

headers/FPL_F.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "FPL_F.h"
2+
3+
void FrenchProgrammingLanguage_Init(VariablesManagement& var, std::vector<std::string>& content_line_slitted, std::string& line) {
4+
if (content_line_slitted[0] == "envoyer") {
5+
FPL_Print_Init(var, line);
6+
}
7+
else if (content_line_slitted[0] == "variable") {
8+
var.init(line);
9+
}
10+
else {
11+
errorInstruction();
12+
}
13+
}

headers/FPL_F.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55
#include <vector>
66
#include <sstream>
77
#include <algorithm>
8+
#include <unordered_map>
89
#include <iterator>
910

1011

11-
#include "Utils.h" // Utilitaires
12-
#include "Management_Envoyer.h" // Pour executer: envoyer
12+
#include "Utils/Utils.h" // Utilitaires
13+
#include "Utils/ErrorsFPL.h" // Management Erreurs
14+
15+
#include "Management_Envoyer.h" // Pour l'instruction: envoyer
16+
#include "VariablesManagement.h" // Pour init les variables
1317

1418
// FPL
1519

16-
void FrenchProgrammingLanguage_Init(std::vector<std::string>& content_line_slitted, std::string& line) {
17-
if (content_line_slitted[0] == "envoyer") {
18-
FPL_Print_Init(content_line_slitted, line);
19-
}
20-
else {
21-
std::cout << "FPL Erreur : Je n'ai pas trouve votre demande !" << std::endl;
22-
}
23-
}
20+
void FrenchProgrammingLanguage_Init(VariablesManagement& var, std::vector<std::string>& content_line_slitted, std::string& line);

headers/Management_Envoyer.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "Management_Envoyer.h"
2+
3+
void FPL_Print_Init(VariablesManagement& var, std::string& line) {
4+
// Préparation
5+
std::string whatReplace = "envoyer ";
6+
std::string print_content = replaceFPL(line, whatReplace);
7+
std::vector<std::string> vec = split(print_content);
8+
9+
bool continuer = true;
10+
if (vec.size() == 1) {
11+
if (var.isVariable(vec[0])) {
12+
std::cout << var.getVariableValue(vec[0]) << std::endl;
13+
}
14+
continuer = false;
15+
}
16+
17+
if (continuer) {
18+
int i = 0;
19+
for (auto const e : vec) {
20+
if (e == "/n") {
21+
vec[i] = "";
22+
std::cout << "\n";
23+
continue;
24+
}
25+
std::cout << e << " ";
26+
i++;
27+
}
28+
std::cout << "\n";
29+
}
30+
}

0 commit comments

Comments
 (0)