Minor reorganization, move ParseFile to the lexer


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7432 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/FileLexer.l b/utils/TableGen/FileLexer.l
index 7289ca0..c61e9de 100644
--- a/utils/TableGen/FileLexer.l
+++ b/utils/TableGen/FileLexer.l
@@ -32,6 +32,28 @@
 
 static int CommentDepth = 0;
 
+int Fileparse();
+
+void ParseFile(const std::string &Filename) {
+  FILE *F = stdin;
+  if (Filename != "-") {
+    F = fopen(Filename.c_str(), "r");
+
+    if (F == 0) {
+      std::cerr << "Could not open input file '" + Filename + "'!\n";
+      abort();
+    }
+  }
+
+  Filein = F;
+  Filelineno = 1;
+  Fileparse();
+
+  if (F != stdin)
+    fclose(F);
+  Filein = stdin;
+}
+
 %}
 
 Comment     \/\/.*