Skip to content

Commit

Permalink
chore!: Style symbol_names as such for all non-variables in DTO DSL…
Browse files Browse the repository at this point in the history
… Compiler
  • Loading branch information
whisperity committed Sep 23, 2023
1 parent ead4e23 commit efce74c
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 287 deletions.
10 changes: 8 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,22 @@ CheckOptions:
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
- key: readability-identifier-naming.ClassCase
value: CamelCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: camelBack
value: lower_case
- key: readability-identifier-naming.MemberCase
value: CamelCase
- key: readability-identifier-naming.ParameterCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: lower_case
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: CamelCase
2 changes: 1 addition & 1 deletion tools/dto_compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-3.0-only
add_executable(dto_compiler
DTOCompiler.cpp
Lex.cpp
lex.cpp
)
if (NOT MONOMUX_LIBRARY_TYPE STREQUAL "UNITY")
target_link_libraries(dto_compiler PUBLIC
Expand Down
14 changes: 7 additions & 7 deletions tools/dto_compiler/DTOCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>
#include <string_view>

#include "Lex.hpp"
#include "lex.hpp"

namespace
{
Expand Down Expand Up @@ -56,15 +56,15 @@ int main(int ArgC, char* ArgV[])

std::cout << "Input string:\n" << InputBuffer << std::endl;

using namespace dto_compiler;
Lexer L{InputBuffer};
using namespace monomux::tools::dto_compiler;
lexer L{InputBuffer};

Token T{};
while ((T = L.lex()) != Token::EndOfFile)
token T{};
while ((T = L.lex()) != token::EndOfFile)
{
std::cout << tokToString(L.getTokenInfoRaw()) << std::endl;
std::cout << to_string(L.get_token_info_raw()) << std::endl;

if (T == Token::SyntaxError)
if (T == token::SyntaxError)
{
std::cerr << "ERROR!" << std::endl;
return EXIT_FAILURE;
Expand Down
15 changes: 10 additions & 5 deletions tools/dto_compiler/Tokens.inc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* SPDX-License-Identifier: LGPL-3.0-only */

/**
* This file defines the "Token" kinds for the DTO DSL Compiler's lexical
* analysis implementation.
*/

#ifndef TOKEN
#define TOKEN(NAME)
#endif /* TOKEN */
Expand Down Expand Up @@ -27,8 +32,8 @@
#define CH_SPELLING_TOKEN(NAME, SPELLING) SIMPLE_TOKEN(NAME)
#endif /* CH_SPELLING_TOKEN */

#ifndef SYMBOL_TOKEN
#define SYMBOL_TOKEN(NAME, SPELLING) SIMPLE_TOKEN(NAME)
#ifndef SYMBOLIC_TOKEN
#define SYMBOLIC_TOKEN(NAME, SPELLING) SIMPLE_TOKEN(NAME)
#endif /* SYMBOL_TOKEN */

#ifndef STR_SPELLING_TOKEN
Expand Down Expand Up @@ -66,8 +71,8 @@ CH_SPELLING_TOKEN(RBrace, '}')
CH_SPELLING_TOKEN(LAcute, '<')
CH_SPELLING_TOKEN(RAcute, '>')

SYMBOL_TOKEN(Arrow, "->")
SYMBOL_TOKEN(Scope, "::")
SYMBOLIC_TOKEN(Arrow, "->")
SYMBOLIC_TOKEN(Scope, "::")

/* Keywords ... */
STR_SPELLING_TOKEN(Namespace, "namespace")
Expand All @@ -81,7 +86,7 @@ STR_SPELLING_TOKEN(Record, "record")
#undef AFTER_TOKEN
#undef TOKEN_INFO
#undef SIMPLE_TOKEN
#undef SYMBOL_TOKEN
#undef CH_SPELLING_TOKEN
#undef SYMBOLIC_TOKEN
#undef STR_SPELLING_TOKEN
#undef COMPLEX_TOKEN
Loading

0 comments on commit efce74c

Please sign in to comment.