Make RunParser return consistent/consistently used
Change-Id: I054e296fe9922c19d9c79adb1a11c8f138ad0191
Signed-off-by: Casey Dahlin <sadmac@google.com>
diff --git a/aidl.cpp b/aidl.cpp
index 546a93f..c996e99 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -732,8 +732,8 @@
// parse the main file
Parser p{options.input_file_name_};
if (!p.OpenFileFromDisk())
- return -1;
- err = p.RunParser();
+ return 1;
+ err = p.RunParser() ? 0 : 1;
document_item_type* mainDoc = p.GetDocument();
// parse the imports
@@ -750,7 +750,7 @@
Parser p{import->filename};
err |= p.OpenFileFromDisk() ? 0 : 1;
if (! err)
- err |= p.RunParser();
+ err |= p.RunParser() ? 0 : 1;
import->doc = p.GetDocument();
if (import->doc == NULL) {
err |= 1;
@@ -832,18 +832,15 @@
int preprocess_aidl(const JavaOptions& options) {
vector<string> lines;
- int err;
// read files
int N = options.files_to_preprocess_.size();
for (int i=0; i<N; i++) {
Parser p{options.files_to_preprocess_[i]};
- if (! p.OpenFileFromDisk())
+ if (!p.OpenFileFromDisk())
return 1;
- err = p.RunParser();
- if (err != 0) {
- return err;
- }
+ if (!p.RunParser())
+ return 1;
document_item_type* doc = p.GetDocument();
string line;
if (doc->item_type == USER_DATA_TYPE) {