载入中...
搜索中...
未找到
DnutLexer.h
浏览该文件的文档.
1#pragma once
2
5#include "common/Export.h"
6#include "common/Result.h"
8
9#include <cstdint>
10#include <string>
11#include <string_view>
12#include <vector>
13
14namespace eve::dnut {
15
17enum class DnutTokenKind : std::uint8_t {
21 String,
23 Number,
28};
29
31struct DnutToken {
33 std::string text;
35 int line = 1;
37 int column = 1;
38};
39
54 const std::string& path);
55
57[[nodiscard]] EVENGINE_API_PLATFORM const char* dnutTokenKindName(DnutTokenKind kind) noexcept;
58
59} // namespace eve::dnut
Domain-neutral source diagnostics for `.dnut` documents.
#define EVENGINE_API_PLATFORM
Definition Export.h:107
TokenKind kind
std::string path
Definition PlayHost.cpp:110
Move-only, checked operation results for the common layer.
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Definition Result.h:155
eve::Result< std::vector< DnutToken > > lexDnut(std::string_view source, const std::string &path)
Lex one .dnut source buffer into owned tokens.
Definition DnutLexer.cpp:97
const char * dnutTokenKindName(DnutTokenKind kind) noexcept
Return the stable lowercase spelling of a token kind.
Definition DnutLexer.cpp:86
DnutTokenKind
Token classes produced by the shared .dnut lexer.
Definition DnutLexer.h:17
@ String
Quoted string with escapes already resolved.
@ Identifier
Bare word: keyword, field name, identifier, or bare enum value.
@ Punctuator
One- or two-character punctuator such as {, =, ==, ->.
@ EndOfFile
Synthetic terminal token; always the last element.
@ Number
Unsigned numeric literal; sign handling belongs to the parser.
One lexed token with its exact source anchor.
Definition DnutLexer.h:31
int line
One-based source line.
Definition DnutLexer.h:35
DnutTokenKind kind
Definition DnutLexer.h:32
int column
One-based source column of the first character.
Definition DnutLexer.h:37
std::string text
Definition DnutLexer.h:33