diff options
author | vityaman <[email protected]> | 2025-03-28 18:29:24 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-03-28 18:50:04 +0300 |
commit | 60b99f11bcb2386c2a1c36ffd2e96e69d0105dac (patch) | |
tree | 08c15d732484c6accf16658b09ed8f07286a9338 /yql/essentials/sql/v1/reflect/sql_reflect.h | |
parent | 1e214be59cbf130bee433c422b42f16148e5acff (diff) |
YQL-19616 Convert YQL lexer grammar to regexes
- [x] Parse YQL grammar to extract lexer grammar into `TLexerGrammar`.
- [x] Translate `TLexerGrammar` into regexes.
- [x] Implement a lexer via regexes `TRegexLexer` to test generated regexes validity.
- [x] Test on `Default` syntax mode.
- [x] Test on `ANSI` syntax mode.
---
- Related to https://github.com/ydb-platform/ydb/issues/15129
- Requirement for https://github.com/ytsaurus/ytsaurus/pull/1112
---
Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1127
commit_hash:03ffffe81cdafe7f93a4d3fd9a3212fe67f1c72d
Diffstat (limited to 'yql/essentials/sql/v1/reflect/sql_reflect.h')
-rw-r--r-- | yql/essentials/sql/v1/reflect/sql_reflect.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/yql/essentials/sql/v1/reflect/sql_reflect.h b/yql/essentials/sql/v1/reflect/sql_reflect.h new file mode 100644 index 00000000000..5225a3c996b --- /dev/null +++ b/yql/essentials/sql/v1/reflect/sql_reflect.h @@ -0,0 +1,18 @@ +#pragma once + +#include <util/generic/string.h> +#include <util/generic/hash_set.h> +#include <util/generic/hash.h> + +namespace NSQLReflect { + + struct TLexerGrammar { + THashSet<TString> KeywordNames; + THashSet<TString> PunctuationNames; + THashSet<TString> OtherNames; + THashMap<TString, TString> BlockByName; + }; + + TLexerGrammar LoadLexerGrammar(); + +} // namespace NSQLReflect |