4 file.open(fileName.c_str(), std::ios::in);
6 cout <<
"File open error"
13 while ((c ==
' ' || c ==
'\n') || c ==
'\t') {
16 if ((c ==
' ' || c ==
'\n') && !
file.good()) {
18 throw std::logic_error(
"Ran out of tokens");
19 }
else if (!
file.good()) {
34 cout <<
"Exhaused tokens"
51 }
else if (c ==
'{') {
53 }
else if (c ==
'}') {
55 }
else if (c ==
'-' || (c >=
'0' && c <=
'9')) {
60 std::streampos prevCharPos =
file.tellg();
61 while ((c ==
'-') || (c >=
'0' && c <=
'9') || c ==
'.') {
62 prevCharPos =
file.tellg();
68 if ((c ==
'-') || (c >=
'0' && c <=
'9') || (c ==
'.')) {
71 file.seekg(prevCharPos);
75 }
else if (c ==
'f') {
77 token.
value =
"False";
78 file.seekg(4, std::ios_base::cur);
79 }
else if (c ==
't') {
82 file.seekg(3, std::ios_base::cur);
83 }
else if (c ==
'n') {
85 file.seekg(3, std::ios_base::cur);
86 }
else if (c ==
'[') {
88 }
else if (c ==
']') {
90 }
else if (c ==
':') {
92 }
else if (c ==
',') {
Tokenizer(string fileName)
char getWithoutWhiteSpace()