versioner: Build SymbolDatabase from version scripts

This commit adds a version script parser so that versioner can build
SymbolDatabase from version scripts.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Iedcfe36b51a62693668e07b86aa13592096262db
diff --git a/tools/versioner/src/Arch.h b/tools/versioner/src/Arch.h
index 41574c1..bac9ec4 100644
--- a/tools/versioner/src/Arch.h
+++ b/tools/versioner/src/Arch.h
@@ -20,8 +20,10 @@
 
 #include <array>
 #include <initializer_list>
+#include <optional>
 #include <set>
 #include <string>
+#include <unordered_map>
 
 enum class Arch : size_t {
   arm = 0,
@@ -33,7 +35,7 @@
 };
 
 std::string to_string(const Arch& arch);
-Arch arch_from_string(const std::string& name);
+std::optional<Arch> arch_from_string(const std::string& name);
 
 template <typename T>
 class ArchMapIterator;
@@ -146,3 +148,23 @@
   { Arch::x86, 9 },
   { Arch::x86_64, 21 },
 };
+
+static constexpr int future_api = 10000;
+
+static const std::unordered_map<std::string, int> api_codename_map{
+  {"G", 9},
+  {"I", 14},
+  {"J", 16},
+  {"J-MR1", 17},
+  {"J-MR2", 18},
+  {"K", 19},
+  {"L", 21},
+  {"L-MR1", 22},
+  {"M", 23},
+  {"N", 24},
+  {"N-MR1", 25},
+  {"O", 26},
+  {"O-MR1", 27},
+  {"P", 28},
+  {"Q", 9001},
+};