diff --git a/imbecile.cc b/imbecile.cc index fe349b9..4dcc24c 100644 --- a/imbecile.cc +++ b/imbecile.cc @@ -6,6 +6,7 @@ #include "refptr/refptr.h" #include "serialize.h" #include "unicode.h" +#include "parse-input.h" using namespace std; int main(int argc, char * argv[]) @@ -37,12 +38,14 @@ int main(int argc, char * argv[]) cerr << "Error opening input file: '" << argv[optind] << "'"; return 2; } - refptr< vector > ucs_str = deserialize(encoding, ifs); - if (ucs_str.isNull()) + refptr< vector > ucs = deserialize(encoding, ifs); + if (ucs.isNull()) { cerr << "Error deserializing input file." << endl; return 1; } + parse_input(ucs); + return 0; } diff --git a/parse-input.cc b/parse-input.cc index 3062cd0..ca4fde2 100644 --- a/parse-input.cc +++ b/parse-input.cc @@ -68,6 +68,9 @@ void parse_input(refptr< vector > ucs) case '\n': SET_ERROR("Unterminated section header"); break; + default: + build_str += c; + break; } break; case RULES: diff --git a/testinput.i b/testinput.i new file mode 100644 index 0000000..c13d963 --- /dev/null +++ b/testinput.i @@ -0,0 +1,11 @@ + +[rules] + +ASSIGN := ":=" +DASSIGN := ":==" +IDENTIFIER := "[a-zA-Z_][a-zA-Z_0-9]*" + +Assignment := IDENTIFIER ASSIGN Expression + +Expression := IDENTIFIER + | Assignment diff --git a/unicode.h b/unicode.h index 57acdf2..0d8e74e 100644 --- a/unicode.h +++ b/unicode.h @@ -1,5 +1,6 @@ #ifndef UNICODE_H +#define UNICODE_H #include #include