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
|
# Flex/Bison generated files
|
||||||
set(LEX_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecl.cc)
|
set(LEX_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecl.cc)
|
||||||
set(YACC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecp.cc)
|
set(YACC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecp.cc)
|
||||||
set(YACC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/deviceSpecp.hh)
|
set(YACC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecp.hh)
|
||||||
|
|
||||||
# Generate Flex/Bison files using custom commands
|
# Generate Flex/Bison files using custom commands
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${LEX_OUTPUT}
|
OUTPUT ${LEX_OUTPUT}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecl.ll ${YACC_HEADER}
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecl.ll ${YACC_HEADER}
|
||||||
COMMAND ${FLEX_EXECUTABLE} --header-file=${CMAKE_CURRENT_BINARY_DIR}/deviceSpecl.hh -o ${LEX_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecl.ll
|
COMMAND ${FLEX_EXECUTABLE} --header-file=${CMAKE_CURRENT_BINARY_DIR}/deviceAttachmentPipeSpecl.hh -o ${LEX_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecl.ll
|
||||||
COMMENT "Generating deviceSpecl.cc from deviceSpecl.ll"
|
COMMENT "Generating deviceAttachmentPipeSpecl.cc from deviceAttachmentPipeSpecl.ll"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${YACC_OUTPUT} ${YACC_HEADER}
|
OUTPUT ${YACC_OUTPUT} ${YACC_HEADER}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecp.yy
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecp.yy
|
||||||
COMMAND ${BISON_EXECUTABLE} -p deviceSpecp --header=${YACC_HEADER} -o ${YACC_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceSpecp.yy
|
COMMAND ${BISON_EXECUTABLE} -p deviceAttachmentPipeSpecp --header=${YACC_HEADER} -o ${YACC_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/deviceAttachmentPipeSpecp.yy
|
||||||
COMMENT "Generating deviceSpecp.cc and deviceSpecp.hh from deviceSpecp.yy"
|
COMMENT "Generating deviceAttachmentPipeSpecp.cc and deviceAttachmentPipeSpecp.hh from deviceAttachmentPipeSpecp.yy"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Device manager library
|
# Device manager library
|
||||||
add_library(deviceManager STATIC
|
add_library(deviceManager STATIC
|
||||||
deviceManager.cpp
|
deviceManager.cpp
|
||||||
deviceSpecParser.cpp
|
deviceAttachmentPipeSpecParser.cpp
|
||||||
${LEX_OUTPUT}
|
${LEX_OUTPUT}
|
||||||
${YACC_OUTPUT}
|
${YACC_OUTPUT}
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-4
@@ -7,8 +7,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <deviceManager/deviceManager.h>
|
#include <deviceManager/deviceManager.h>
|
||||||
#include "deviceSpecp.hh"
|
#include "deviceAttachmentPipeSpecp.hh"
|
||||||
#include "deviceSpecl.hh"
|
#include "deviceAttachmentPipeSpecl.hh"
|
||||||
|
|
||||||
namespace smo {
|
namespace smo {
|
||||||
namespace device {
|
namespace device {
|
||||||
@@ -58,8 +58,8 @@ void DeviceManager::parseAllDeviceSpecs(void)
|
|||||||
"parsing device specs");
|
"parsing device specs");
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceSpeclin = input.get();
|
deviceAttachmentPipeSpeclin = input.get();
|
||||||
if (deviceSpecpparse())
|
if (deviceAttachmentPipeSpecpparse())
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string(__func__) + ": Failed to parse device specs. "
|
std::string(__func__) + ": Failed to parse device specs. "
|
||||||
+7
-7
@@ -1,4 +1,4 @@
|
|||||||
%option prefix="deviceSpecl"
|
%option prefix="deviceAttachmentPipeSpecl"
|
||||||
%option nounput
|
%option nounput
|
||||||
%option noinput
|
%option noinput
|
||||||
%{
|
%{
|
||||||
@@ -6,20 +6,20 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <deviceManager/deviceManager.h>
|
#include <deviceManager/deviceManager.h>
|
||||||
#include "deviceSpecp.hh"
|
#include "deviceAttachmentPipeSpecp.hh"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
"+adev" {
|
"+adev" {
|
||||||
deviceSpecplval.chr = yytext[1];
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
||||||
return KEYWORD_SPECTYPE_ACTUATOR;
|
return KEYWORD_SPECTYPE_ACTUATOR;
|
||||||
}
|
}
|
||||||
"+edev" {
|
"+edev" {
|
||||||
deviceSpecplval.chr = yytext[1];
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
||||||
return KEYWORD_SPECTYPE_EXTROSPECTOR;
|
return KEYWORD_SPECTYPE_EXTROSPECTOR;
|
||||||
}
|
}
|
||||||
"+idev" {
|
"+idev" {
|
||||||
deviceSpecplval.chr = yytext[1];
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
||||||
return KEYWORD_SPECTYPE_INTEROSPECTOR;
|
return KEYWORD_SPECTYPE_INTEROSPECTOR;
|
||||||
}
|
}
|
||||||
"||" { return DOUBLE_PIPE; }
|
"||" { return DOUBLE_PIPE; }
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
unescaped.push_back(token[++i]);
|
unescaped.push_back(token[++i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceSpecplval.str = strdup(unescaped.c_str());
|
deviceAttachmentPipeSpecplval.str = strdup(unescaped.c_str());
|
||||||
return STRING;
|
return STRING;
|
||||||
}
|
}
|
||||||
[ \t\r\n]+ { /* ignore all whitespace, including newlines */ }
|
[ \t\r\n]+ { /* ignore all whitespace, including newlines */ }
|
||||||
. { return yytext[0]; }
|
. { return yytext[0]; }
|
||||||
%%
|
%%
|
||||||
|
|
||||||
int deviceSpeclwrap(void)
|
int deviceAttachmentPipeSpeclwrap(void)
|
||||||
{
|
{
|
||||||
return 1; // Indicate end of input
|
return 1; // Indicate end of input
|
||||||
}
|
}
|
||||||
+5
-5
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
#ifndef yylex
|
#ifndef yylex
|
||||||
/* We use different prefixes for the lexer and parser.
|
/* We use different prefixes for the lexer and parser.
|
||||||
* * Our lexer's prefix is deviceSpecl.
|
* * Our lexer's prefix is deviceAttachmentPipeSpecl.
|
||||||
* * Our parser's prefix is deviceSpecp.
|
* * Our parser's prefix is deviceAttachmentPipeSpecp.
|
||||||
*
|
*
|
||||||
* Yacc and Bison don't have a way to handle the scenario where the lexer has
|
* 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
|
* 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."
|
#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
|
#endif
|
||||||
#undef yylex
|
#undef yylex
|
||||||
#define yylex deviceSpecllex
|
#define yylex deviceAttachmentPipeSpecllex
|
||||||
|
|
||||||
#ifdef yytext
|
#ifdef yytext
|
||||||
#undef yytext
|
#undef yytext
|
||||||
#endif
|
#endif
|
||||||
#define yytext deviceSpecltext
|
#define yytext deviceAttachmentPipeSpecltext
|
||||||
|
|
||||||
// Declare the symbols that our lexer will export.
|
// Declare the symbols that our lexer will export.
|
||||||
int yylex(void);
|
int yylex(void);
|
||||||
@@ -36,7 +36,7 @@ extern char* yytext; // Declare yytext to access the current token text
|
|||||||
void yyerror(const char *message)
|
void yyerror(const char *message)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string("deviceSpec parser error: ")
|
std::string("deviceAttachmentPipeSpec parser error: ")
|
||||||
+ std::string(message)
|
+ std::string(message)
|
||||||
+ " at token: " + std::string(yytext));
|
+ " at token: " + std::string(yytext));
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user