sksl enum support

Bug: skia:
Change-Id: I4d505b31cf8b59de12bcdbca410aafc085977ba9
Reviewed-on: https://skia-review.googlesource.com/68621
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/ast/SkSLASTEnum.h b/src/sksl/ast/SkSLASTEnum.h
new file mode 100644
index 0000000..6fdd091
--- /dev/null
+++ b/src/sksl/ast/SkSLASTEnum.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SKSL_ASTENUM
+#define SKSL_ASTENUM
+
+#include "SkSLASTDeclaration.h"
+namespace SkSL {
+
+struct ASTEnum : public ASTDeclaration {
+    ASTEnum(int offset, StringFragment typeName, std::vector<StringFragment> names,
+            std::vector<std::unique_ptr<ASTExpression>> values)
+    : INHERITED(offset, kEnum_Kind)
+    , fTypeName(typeName)
+    , fNames(std::move(names))
+    , fValues(std::move(values)) {
+        ASSERT(fNames.size() == fValues.size());
+    }
+
+    String description() const override {
+        String result = "enum class " + fTypeName + " {\n";
+        String separator;
+        for (StringFragment name : fNames) {
+            result += separator + "    " + name;
+            separator = ",\n";
+        }
+        result += "};";
+        return result;
+    }
+
+    const StringFragment fTypeName;
+    const std::vector<StringFragment> fNames;
+    const std::vector<std::unique_ptr<ASTExpression>> fValues;
+
+    typedef ASTDeclaration INHERITED;
+};
+
+} // namespace
+
+#endif