Rename DSL: DeviceAttachmentSpec => deviceAttachmentPipeSpec
The new name is nicer and more distinguishing.
This commit is contained in:
@@ -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}
|
||||
)
|
||||
|
||||
+4
-4
@@ -7,8 +7,8 @@
|
||||
#include <memory>
|
||||
#include <cstdio>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#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. "
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
%option prefix="deviceSpecl"
|
||||
%option prefix="deviceAttachmentPipeSpecl"
|
||||
%option nounput
|
||||
%option noinput
|
||||
%{
|
||||
@@ -6,20 +6,20 @@
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#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
|
||||
}
|
||||
+5
-5
@@ -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));
|
||||
}
|
||||
Reference in New Issue
Block a user