-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecker.cpp
More file actions
92 lines (77 loc) · 1.47 KB
/
Copy pathchecker.cpp
File metadata and controls
92 lines (77 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// checker.cpp
// pa3
//
// Created by Adam on 4/9/17.
// Copyright © 2017 Adam. All rights reserved.
//
#include <iostream>
#include "checker.h"
void checker::readFile(string fileName, Stack s)
{
ifstream myfile (fileName);
string lineText;
int i = 0;
while (getline(myfile, lineText))
{
string temp;
istringstream record(lineText);
textBreakup(record.str(), s);
i++;
}
myfile.close();
}
void checker::textBreakup(string text, Stack s)
{
bool textRemaining = true;
string::size_type length = text.length();
int i = 0;
while (textRemaining)
{
string temp = "";
if (text.at(i) - 0x28 > 0)
{
while (text.at(i) - 0x28 > 0)
{
temp += text.at(i);
i++;
}
cout << temp << endl;
s.push(temp);
}
else
{
i++;
}
if (length == (unsigned)i)
{
textRemaining = false;
}
}
}
void checker::findDelimiter(string *storage, Stack s)
{
for (int i = 0; i < s.getCapacity(); i++)
{
if (*(storage + i) == ";" || *(storage + i) == ",")
{
s.push(*(storage + i));
}
}
}
void checker::findKeywords(string *storage, Stack s)
{
for (int i = 0; i < s.getCapacity(); i++)
{
if ((*(storage + i) == "FOR" || *(storage + i) == "BEGIN") || *(storage + i) == "END")
{
s.push(*(storage + 1));
}
}
}
void checker::findConstants(string *storage, Stack s)
{
for (int i = 0; i < s.getCapacity(); i++)
{
}
}