-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType.cpp
More file actions
41 lines (33 loc) · 771 Bytes
/
Type.cpp
File metadata and controls
41 lines (33 loc) · 771 Bytes
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
//
// Type.cpp
// TypeParser
//
// Created by Eric Alford on 10/30/12.
// Copyright (c) 2012 Eric Alford. All rights reserved.
//
#include "Type.h"
bool Type::addAlias(string name){
int i;
bool flag = true;
for(i = 0; i<aliases.size(); i++){
if(name == aliases[i]){
flag = false;
}
}
//if the variable was already given a type, don't add it to the list. Otherwise, add it.
if(flag)
aliases.push_back(name);
return flag;
}
bool Type::addVariable(string name){
int i;
bool flag = true;
for(i = 0; i<variables.size(); i++){
if(name == variables[i]){
flag = false;
}
}
if(flag)
variables.push_back(name);
return flag;
}