From 66257bcd0e428d4cfffc225fd2a91d4ef73f7707 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Fri, 29 Aug 2025 15:55:11 -0400 Subject: [PATCH] Rename DSL: DeviceAttachmentSpec => deviceAttachmentPipeSpec The new name is nicer and more distinguishing. --- smocore/deviceManager/CMakeLists.txt | 20 +++++++++---------- ...cpp => deviceAttachmentPipeSpecParser.cpp} | 8 ++++---- ...eSpecl.ll => deviceAttachmentPipeSpecl.ll} | 14 ++++++------- ...eSpecp.yy => deviceAttachmentPipeSpecp.yy} | 10 +++++----- 4 files changed, 26 insertions(+), 26 deletions(-) rename smocore/deviceManager/{deviceSpecParser.cpp => deviceAttachmentPipeSpecParser.cpp} (90%) rename smocore/deviceManager/{deviceSpecl.ll => deviceAttachmentPipeSpecl.ll} (77%) rename smocore/deviceManager/{deviceSpecp.yy => deviceAttachmentPipeSpecp.yy} (94%) diff --git a/smocore/deviceManager/CMakeLists.txt b/smocore/deviceManager/CMakeLists.txt index 82cb036..cceca56 100644 --- a/smocore/deviceManager/CMakeLists.txt +++ b/smocore/deviceManager/CMakeLists.txt @@ -1,27 +1,27 @@ # Flex/Bison generated files -set(LEX_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecl.cc) -set(YACC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecp.cc) -set(YACC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecp.hh) +set(LEX_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecl.cc) +set(YACC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecp.cc) +set(YACC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecp.hh) # Generate Flex/Bison files using custom commands add_custom_command( OUTPUT ${LEX_OUTPUT} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecl.ll ${YACC_HEADER} - COMMAND ${FLEX_EXECUTABLE} --header-file=${CMAKE_CURRENT_BINARY_DIR}/deviceSpecl.hh -o ${LEX_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecl.ll - COMMENT "Generating deviceSpecl.cc from deviceSpecl.ll" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecl.ll ${YACC_HEADER} + COMMAND ${FLEX_EXECUTABLE} --header-file=${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecl.hh -o ${LEX_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecl.ll + COMMENT "Generating deviceAttachmentPipeSpecl.cc from deviceAttachmentPipeSpecl.ll" ) add_custom_command( OUTPUT ${YACC_OUTPUT} ${YACC_HEADER} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecp.yy - COMMAND ${BISON_EXECUTABLE} -p deviceSpecp --header=${YACC_HEADER} -o ${YACC_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecp.yy - COMMENT "Generating deviceSpecp.cc and deviceSpecp.hh from deviceSpecp.yy" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecp.yy + COMMAND ${BISON_EXECUTABLE} -p deviceAttachmentPipeSpecp --header=${YACC_HEADER} -o ${YACC_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecp.yy + COMMENT "Generating deviceAttachmentPipeSpecp.cc and deviceAttachmentPipeSpecp.hh from deviceAttachmentPipeSpecp.yy" ) # Device manager library add_library(deviceManager STATIC deviceManager.cpp - deviceSpecParser.cpp + deviceAttachmentPipeSpecParser.cpp ${LEX_OUTPUT} ${YACC_OUTPUT} ) diff --git a/smocore/deviceManager/deviceSpecParser.cpp b/smocore/deviceManager/deviceAttachmentPipeSpecParser.cpp similarity index 90% rename from smocore/deviceManager/deviceSpecParser.cpp rename to smocore/deviceManager/deviceAttachmentPipeSpecParser.cpp index fead45b..75980c8 100644 --- a/smocore/deviceManager/deviceSpecParser.cpp +++ b/smocore/deviceManager/deviceAttachmentPipeSpecParser.cpp @@ -7,8 +7,8 @@ #include #include #include -#include "deviceSpecp.hh" -#include "deviceSpecl.hh" +#include "deviceAttachmentPipeSpecp.hh" +#include "deviceAttachmentPipeSpecl.hh" namespace smo { namespace device { @@ -58,8 +58,8 @@ void DeviceManager::parseAllDeviceSpecs(void) "parsing device specs"); } - deviceSpeclin = input.get(); - if (deviceSpecpparse()) + deviceAttachmentPipeSpeclin = input.get(); + if (deviceAttachmentPipeSpecpparse()) { throw std::runtime_error( std::string(__func__) + ": Failed to parse device specs. " diff --git a/smocore/deviceManager/deviceSpecl.ll b/smocore/deviceManager/deviceAttachmentPipeSpecl.ll similarity index 77% rename from smocore/deviceManager/deviceSpecl.ll rename to smocore/deviceManager/deviceAttachmentPipeSpecl.ll index d8c21e9..2ca0b9a 100644 --- a/smocore/deviceManager/deviceSpecl.ll +++ b/smocore/deviceManager/deviceAttachmentPipeSpecl.ll @@ -1,4 +1,4 @@ -%option prefix="deviceSpecl" +%option prefix="deviceAttachmentPipeSpecl" %option nounput %option noinput %{ @@ -6,20 +6,20 @@ #include #include #include -#include "deviceSpecp.hh" +#include "deviceAttachmentPipeSpecp.hh" %} %% "+adev" { - deviceSpecplval.chr = yytext[1]; + deviceAttachmentPipeSpecplval.chr = yytext[1]; return KEYWORD_SPECTYPE_ACTUATOR; } "+edev" { - deviceSpecplval.chr = yytext[1]; + deviceAttachmentPipeSpecplval.chr = yytext[1]; return KEYWORD_SPECTYPE_EXTROSPECTOR; } "+idev" { - deviceSpecplval.chr = yytext[1]; + deviceAttachmentPipeSpecplval.chr = yytext[1]; return KEYWORD_SPECTYPE_INTEROSPECTOR; } "||" { return DOUBLE_PIPE; } @@ -49,14 +49,14 @@ unescaped.push_back(token[++i]); } - deviceSpecplval.str = strdup(unescaped.c_str()); + deviceAttachmentPipeSpecplval.str = strdup(unescaped.c_str()); return STRING; } [ \t\r\n]+ { /* ignore all whitespace, including newlines */ } . { return yytext[0]; } %% -int deviceSpeclwrap(void) +int deviceAttachmentPipeSpeclwrap(void) { return 1; // Indicate end of input } diff --git a/smocore/deviceManager/deviceSpecp.yy b/smocore/deviceManager/deviceAttachmentPipeSpecp.yy similarity index 94% rename from smocore/deviceManager/deviceSpecp.yy rename to smocore/deviceManager/deviceAttachmentPipeSpecp.yy index f5e27c4..c835b9e 100644 --- a/smocore/deviceManager/deviceSpecp.yy +++ b/smocore/deviceManager/deviceAttachmentPipeSpecp.yy @@ -12,8 +12,8 @@ #ifndef yylex /* We use different prefixes for the lexer and parser. - * * Our lexer's prefix is deviceSpecl. - * * Our parser's prefix is deviceSpecp. + * * Our lexer's prefix is deviceAttachmentPipeSpecl. + * * Our parser's prefix is deviceAttachmentPipeSpecp. * * Yacc and Bison don't have a way to handle the scenario where the lexer has * a different prefix from the parser that they generate. They assume that the @@ -23,12 +23,12 @@ #error "Yacc should have defined yylex as a preprocessor token, and we need to override it to tell yacc the name of our lex function." #endif #undef yylex -#define yylex deviceSpecllex +#define yylex deviceAttachmentPipeSpecllex #ifdef yytext #undef yytext #endif -#define yytext deviceSpecltext +#define yytext deviceAttachmentPipeSpecltext // Declare the symbols that our lexer will export. int yylex(void); @@ -36,7 +36,7 @@ extern char* yytext; // Declare yytext to access the current token text void yyerror(const char *message) { throw std::runtime_error( - std::string("deviceSpec parser error: ") + std::string("deviceAttachmentPipeSpec parser error: ") + std::string(message) + " at token: " + std::string(yytext)); }