Don't include . in IDENTIFIER characters

We want to parse qualified names deliberately, not everywhere we need a
name.

Change-Id: Id20fc7e6fd8d3e4b54a5048bb54c6dccc4128f40
Test: Full Android Build
Bug: 24913789
Signed-off-by: Casey Dahlin <sadmac@google.com>
diff --git a/aidl_language.cpp b/aidl_language.cpp
index 94aa38b..0eaf0c9 100644
--- a/aidl_language.cpp
+++ b/aidl_language.cpp
@@ -110,6 +110,12 @@
   yylex_init(&scanner_);
 }
 
+AidlParcelable::AidlParcelable(AidlQualifiedName* name, unsigned line,
+                               const std::string& package)
+    : AidlParcelable(name->GetDotName(), line, package) {
+  delete name;
+}
+
 AidlParcelable::AidlParcelable(const std::string& name, unsigned line,
                                const std::string& package)
     : name_(name),
@@ -132,6 +138,16 @@
   delete methods;
 }
 
+AidlQualifiedName::AidlQualifiedName(std::string term,
+                                     std::string comments)
+    : terms_({term}),
+      comments_(comments) {
+}
+
+void AidlQualifiedName::AddTerm(std::string term) {
+  terms_.push_back(term);
+}
+
 AidlImport::AidlImport(const std::string& from,
                        const std::string& needed_class, unsigned line)
     : from_(from),
@@ -185,35 +201,8 @@
   error_ = 1;
 }
 
-void Parser::AddImport(std::vector<std::string>* terms, unsigned line) {
-  std::string data;
-  bool first = true;
-
-  /* NOTE: This string building code is duplicated from below. We haven't
-   * factored it out into a function because it's hoped that when import_info
-   * becomes a class we won't need this anymore.
-   **/
-  for (const auto& term : *terms) {
-      if (first)
-          data = term;
-      else
-          data += '.' + term;
-  }
-
-  imports_.emplace_back(new AidlImport(this->FileName(), data, line));
-
-  delete terms;
-}
-
-void Parser::SetPackage(std::vector<std::string> *terms) {
-    bool first = true;
-
-    for (const auto& term : *terms) {
-        if (first)
-            package_ = term;
-        else
-            package_ += '.' + term;
-    }
-
-    delete terms;
+void Parser::AddImport(AidlQualifiedName* name, unsigned line) {
+  imports_.emplace_back(new AidlImport(this->FileName(),
+                                       name->GetDotName(), line));
+  delete name;
 }