Skip to content

Commit e7706bb

Browse files
#TDP - 24 make folder for test file
1 parent a1b7ad8 commit e7706bb

File tree

6 files changed

+13
-73
lines changed

6 files changed

+13
-73
lines changed

CodeCSharp.txt

Lines changed: 0 additions & 54 deletions
This file was deleted.

Translator.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,8 @@ bool Translator::isELSECondition(std::string word_code)
6767

6868
std::string Translator::nameType(std::string token)
6969
{
70-
bool isConst = false;
71-
if (token.length() > 3)
72-
{
73-
token.erase(0, 4);
74-
isConst = true;
75-
}
76-
if (isConst == true)
77-
return "const " + getServiceWord(token, false);
70+
if (token.find("W19")!=std::string::npos)
71+
return "const " + getServiceWord(token.erase(0,4), false);
7872
else
7973
return getServiceWord(token, false);
8074
}

Translator_LanguageC.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "SyntaxAnalisator.h"
44
#include "ReversePolishNotation.h"
55
#include "translate_csharp.h"
6+
#include <direct.h>
67

78
using namespace System;
89
using namespace System::Windows::Forms;
@@ -44,6 +45,8 @@ System::Void MethodsDevelopmentTranslator::Translator_LanguageC::Btn_loadFile_Cl
4445
file->Close();
4546
marshalString(filePathName, fileText_C);
4647
btn_analisator->Enabled = true;
48+
mkdir("translator_file");
49+
4750
}
4851
catch (const std::exception&)
4952
{
@@ -61,12 +64,11 @@ System::Void MethodsDevelopmentTranslator::Translator_LanguageC::Btn_analisator_
6164
{
6265
if (tb_nameFileAnylize->Text != "" && isExtensionTXT(tb_nameFileAnylize->Text)==true)
6366
{
64-
6567
std::string fileName = "";
6668
marshalString(tb_nameFileAnylize->Text, fileName);
67-
analisator.analyze(fileText_C, fileName);
69+
analisator.analyze(fileText_C, "./translator_file/lexical.txt");
6870

69-
StreamReader^ fileAnalyze = File::OpenText(tb_nameFileAnylize->Text);
71+
StreamReader^ fileAnalyze = File::OpenText("./translator_file/lexical.txt");
7072
tb_syntaxAnalisator->Text = fileAnalyze->ReadToEnd();
7173
fileAnalyze->Close();
7274
btn_analisator->Enabled = false;
@@ -81,13 +83,12 @@ System::Void MethodsDevelopmentTranslator::Translator_LanguageC::Btn_reversePoli
8183
{
8284
if (tb_nameFileAnylize->Text != "" && isExtensionTXT(tb_nameFileAnylize->Text) == true)
8385
{
84-
8586
RPN.initialize(analisator.getIdentifier(), analisator.getNumbers(), analisator.getSymbols());
86-
std::string file = "";
87-
marshalString(tb_nameFileAnylize->Text, file);
88-
RPN.reversePolishNotationAnalyze(file, "RPN.txt");
87+
/*std::string file = "";
88+
marshalString(tb_nameFileAnylize->Text, file);*/
89+
RPN.reversePolishNotationAnalyze("./translator_file/lexical.txt", "./translator_file/RPN.txt");
8990

90-
StreamReader^ fileAnalyze = gcnew StreamReader("RPN.txt", System::Text::Encoding::GetEncoding(1251));
91+
StreamReader^ fileAnalyze = gcnew StreamReader("./translator_file/RPN.txt", System::Text::Encoding::GetEncoding(1251));
9192
tb_reversePolishNotation->Text = fileAnalyze->ReadToEnd();
9293
fileAnalyze->Close();
9394
btn_analisator->Enabled = false;
@@ -105,10 +106,9 @@ System::Void MethodsDevelopmentTranslator::Translator_LanguageC::Btn_toCSharp_Cl
105106
{
106107
codeCSharp.initialize(RPN.getIdentifier(), RPN.getNumbers(), RPN.getSymbols());
107108
std::string file = "";
108-
marshalString(tb_nameFileAnylize->Text, file);
109-
codeCSharp.transalteToCSharp("RPN.txt", "CodeCSharp.cs");
109+
codeCSharp.transalteToCSharp("./translator_file/RPN.txt", "./translator_file/CodeCSharp.cs");
110110

111-
StreamReader^ fileAnalyze = gcnew StreamReader("CodeCSharp.cs", System::Text::Encoding::GetEncoding(1251));
111+
StreamReader^ fileAnalyze = gcnew StreamReader("./translator_file/CodeCSharp.cs", System::Text::Encoding::GetEncoding(1251));
112112
tb_codeCSharp->Text = fileAnalyze->ReadToEnd();
113113
fileAnalyze->Close();
114114
btn_analisator->Enabled = false;
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)