Moving hidl-gen parser stack outside of AST

Move compiler stack outside of AST members,
adding a parent member to NamedType to make AST
a real tree.

Add a check that interface must be declared in global scope,
that was not checked in hidl-gen.

Also move scanner outside of AST.

Test: compiles, links, boots, hidl_test
Change-Id: Ida0c192b258e40c8cfe033f00a842444df0130ad
diff --git a/Interface.cpp b/Interface.cpp
index 5974288..26bdf3c 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -67,11 +67,9 @@
     LAST_HIDL_TRANSACTION   = 0x0fffffff,
 };
 
-Interface::Interface(const char *localName, const Location &location, Interface *super)
-    : Scope(localName, location),
-      mSuperType(super),
-      mIsJavaCompatibleInProgress(false) {
-}
+Interface::Interface(const char* localName, const Location& location, Scope* parent,
+                     Interface* super)
+    : Scope(localName, location, parent), mSuperType(super), mIsJavaCompatibleInProgress(false) {}
 
 std::string Interface::typeName() const {
     return "interface " + localName();