Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: chrome/tools/profile_reset/jtl_compiler.h

Issue 24998003: Compiler for the JSON Traversal Language. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/tools/profile_reset/jtl_compiler.h
diff --git a/chrome/tools/profile_reset/jtl_compiler.h b/chrome/tools/profile_reset/jtl_compiler.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7738424a1900c623d8f378d29667932028689f9
--- /dev/null
+++ b/chrome/tools/profile_reset/jtl_compiler.h
@@ -0,0 +1,48 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_TOOLS_PROFILE_RESET_JTL_COMPILER_H_
+#define CHROME_TOOLS_PROFILE_RESET_JTL_COMPILER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+// Compiles text-based JTL source code into JTL bytecode.
battre 2013/09/27 15:00:01 Please put a description of the source code syntax
engedy 2013/10/01 10:48:10 Done.
+class JtlCompiler {
+ public:
+ struct CompileError {
+ enum ErrorCode {
+ NO_ERROR,
+ PARSING_ERROR,
+ UNKNOWN_OPERATION,
+ INVALID_ARGUMENT_COUNT,
+ INVALID_ARGUMENT_TYPE,
+ };
+
+ CompileError() : line_number(0), error_code(NO_ERROR) {}
+ CompileError(size_t line_number,
+ const std::string& context,
+ ErrorCode error_code)
+ : line_number(line_number), context(context), error_code(error_code) {}
+
+ size_t line_number;
+ std::string context;
+ ErrorCode error_code;
+ };
+
+ // Compiles text-based JTL source code contained in |source_code| into JTL
+ // byte-code to |output_bytecode|. Variable and node names will be hashed
+ // using the seed in |hash_seed|. On success, returns true. Otherwise, returns
+ // false and fills |error| with more information if it is non-NULL.
+ static bool Compile(const std::string& source_code,
+ const std::string& hash_seed,
+ std::string* output_bytecode,
+ CompileError* error);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JtlCompiler);
+};
+
+#endif // CHROME_TOOLS_PROFILE_RESET_JTL_COMPILER_H_

Powered by Google App Engine
This is Rietveld 408576698