[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 3 02:02:36 PST 2025
================
@@ -0,0 +1,131 @@
+//===-- DILLexer.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_VALUEOBJECT_DILLEXER_H_
+#define LLDB_VALUEOBJECT_DILLEXER_H_
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <limits.h>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace lldb_private::dil {
+
+/// Class defining the tokens generated by the DIL lexer and used by the
+/// DIL parser.
+class Token {
+public:
+ enum Kind {
+ coloncolon,
+ eof,
+ identifier,
+ l_paren,
+ r_paren,
+ unknown,
----------------
labath wrote:
Maybe that variable should be `optional<Token>` then? Though I'm not sure why it's needed as things could just call `lexer.GetCurrentToken()` instead. In either case, I'd like to remove this from this patch as its not needed here. If it turns out to be the best solution to the parsers needs, we can add the extra type then.
https://github.com/llvm/llvm-project/pull/123521
More information about the lldb-commits
mailing list