No more "version" keyword, new syntax is "package foo.bar.baz@3.4;"
diff --git a/AST.cpp b/AST.cpp
index a527b46..7610ba5 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -45,27 +45,20 @@
     mScanner = scanner;
 }
 
-void AST::setVersion(const char *major, const char *minor) {
-    mVersion = "@";
-    mVersion.append(major);
-    mVersion.append(".");
-    mVersion.append(minor);
-}
-
 bool AST::setPackage(const char *package) {
-    FQName fqName(package);
-    CHECK(fqName.isValid());
+    mPackage.setTo(package);
+    CHECK(mPackage.isValid());
 
-    if (!fqName.package().empty() || !fqName.version().empty()) {
+    if (mPackage.package().empty()
+            || mPackage.version().empty()
+            || !mPackage.name().empty()) {
         return false;
     }
 
-    mPackage = package;
-
     return true;
 }
 
-bool AST::addImport(const char *import) {
+bool AST::addImport(const char * /* import */) {
 #if 0
     CHECK(!importPath->empty());
 
@@ -90,11 +83,14 @@
 }
 
 Type *AST::lookupType(const char *name) {
-    LOG(INFO) << "lookupType " << name;
-
     FQName fqName(name);
     CHECK(fqName.isValid());
 
+    if (fqName.name().empty()) {
+        // Given a package and version???
+        return NULL;
+    }
+
     if (fqName.package().empty() && fqName.version().empty()) {
         // This is just a plain identifier, resolve locally first if possible.
 
@@ -107,7 +103,7 @@
         }
     }
 
-    fqName.applyDefaults(mPackage, mVersion);
+    fqName.applyDefaults(mPackage.package(), mPackage.version());
 
     LOG(INFO) << "lookupType now looking for " << fqName.debugString();
 
diff --git a/AST.h b/AST.h
index 167d5dd..227d80c 100644
--- a/AST.h
+++ b/AST.h
@@ -6,6 +6,8 @@
 #include <string>
 #include <utils/Vector.h>
 
+#include "FQName.h"
+
 namespace android {
 
 struct Formatter;
@@ -18,7 +20,6 @@
 
     static AST *Parse(const char *path);
 
-    void setVersion(const char *major, const char *minor);
     bool setPackage(const char *package);
     bool addImport(const char *import);
 
@@ -39,8 +40,7 @@
     void *mScanner;
     Scope *mRootScope;
 
-    std::string mVersion;
-    std::string mPackage;
+    FQName mPackage;
 
     DISALLOW_COPY_AND_ASSIGN(AST);
 };
diff --git a/FQName.cpp b/FQName.cpp
index cabe503..5ad6a4b 100644
--- a/FQName.cpp
+++ b/FQName.cpp
@@ -9,10 +9,15 @@
 
 static const std::regex kRE1("(" RE_PATH ")(" RE_VERSION ")?::(" RE_PATH ")");
 static const std::regex kRE2("(" RE_VERSION ")::(" RE_PATH ")");
-static const std::regex kRE3(RE_PATH);
+static const std::regex kRE3("(" RE_PATH ")(" RE_VERSION ")");
+static const std::regex kRE4(RE_PATH);
 
 namespace android {
 
+FQName::FQName()
+    : mValid(false) {
+}
+
 FQName::FQName(const std::string &s)
     : mValid(false) {
     setTo(s);
@@ -42,6 +47,11 @@
         mVersion = match.str(1);
         mName = match.str(2);
     } else if (std::regex_match(s, match, kRE3)) {
+        CHECK_EQ(match.size(), 4u);
+
+        mPackage = match.str(1);
+        mVersion = match.str(3);
+    } else if (std::regex_match(s, match, kRE4)) {
         mName = match.str(0);
     } else {
         mValid = false;
@@ -80,14 +90,25 @@
     std::string out = "FQName(";
     out.append(mPackage);
     out.append(mVersion);
-    if (!mPackage.empty() || !mVersion.empty()) {
-        out.append("::");
+    if (!mName.empty()) {
+        if (!mPackage.empty() || !mVersion.empty()) {
+            out.append("::");
+        }
+        out.append(mName);
     }
-    out.append(mName);
     out.append(")");
 
     return out;
 }
 
+void FQName::print() const {
+    if (!mValid) {
+        LOG(INFO) << "INVALID";
+        return;
+    }
+
+    LOG(INFO) << debugString();
+}
+
 }  // namespace android
 
diff --git a/FQName.h b/FQName.h
index 338bcb6..dec47dd 100644
--- a/FQName.h
+++ b/FQName.h
@@ -8,6 +8,7 @@
 namespace android {
 
 struct FQName {
+    explicit FQName();
     explicit FQName(const std::string &s);
 
     bool isValid() const;
@@ -21,6 +22,7 @@
     std::string version() const;
     std::string name() const;
 
+    void print() const;
     std::string debugString() const;
 
 private:
diff --git a/foo.hidl b/foo.hidl
index ebe6658..9730e61 100644
--- a/foo.hidl
+++ b/foo.hidl
@@ -1,5 +1,4 @@
-version 1.0;
-package android.hardware.sensors;
+package android.hardware.sensors@1.2;
 
 interface foo extends bool {
     const string aString = "foo";
@@ -9,10 +8,10 @@
     };
 
     struct bar {
-        //android.hardware.sensors@1.0::blah aBlah1;
-        //@2.3::bar aBar;
-        //foo::blah aBar;
-        blah aBlah;
+        //android.hardware.sensors@1.2::blah aBlah1;
+        //@1.2::blah aBlah2;
+        //foo::blah aBlah3;
+        blah aBlah4;
 
         int32_t[3] x;
         string y;
diff --git a/hidl-gen_l.ll b/hidl-gen_l.ll
index 5e1bbea..67239a4 100644
--- a/hidl-gen_l.ll
+++ b/hidl-gen_l.ll
@@ -61,7 +61,6 @@
 "typedef"		{ count(yyg); return(TYPEDEF); }
 "union"			{ count(yyg); return(UNION); }
 "vec"			{ count(yyg); return(VEC); }
-"version"		{ count(yyg); return(VERSION); }
 
 "char"			{ SCALAR_TYPE(KIND_CHAR); }
 "bool"			{ SCALAR_TYPE(KIND_BOOL); }
@@ -96,6 +95,7 @@
 
 {PATH}{VERSION}?"::"{PATH}      { count(yyg); yylval->str = strdup(yytext); return FQNAME; }
 {VERSION}"::"{PATH}             { count(yyg); yylval->str = strdup(yytext); return FQNAME; }
+{PATH}{VERSION}                 { count(yyg); yylval->str = strdup(yytext); return FQNAME; }
 {COMPONENT}({DOT}{COMPONENT})+  { count(yyg); yylval->str = strdup(yytext); return FQNAME; }
 {COMPONENT}                     { count(yyg); yylval->str = strdup(yytext); return IDENTIFIER; }
 
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 9b09c30..6d1b286 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -52,7 +52,6 @@
 %token<str> TYPEDEF
 %token<str> UNION
 %token<str> VEC
-%token<str> VERSION
 
 %type<str> optIdentifier package
 %type<str> const_value
@@ -92,14 +91,7 @@
 %%
 
 program
-    : version package imports body
-    ;
-
-version
-    : VERSION INTEGER '.' INTEGER ';'
-      {
-          ast->setVersion($2, $4);
-      }
+    : package imports body
     ;
 
 fqname
diff --git a/main.cpp b/main.cpp
index e415146..770d97e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -27,6 +27,7 @@
     FQName("@3.4::foo").print();
     FQName("foo").print();
     FQName("::foo").print();
+    FQName("some.package.somewhere@1.2").print();
 #endif
 
     return 0;