Skip to content

Commit

Permalink
Regenerate flex/bison files to fix build on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
pefoley2 committed Nov 11, 2016
1 parent 502364e commit 3c12b19
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 210 deletions.
3 changes: 3 additions & 0 deletions dynC_API/CMakeLists.txt
Expand Up @@ -9,6 +9,9 @@ include_directories(h

set_source_files_properties(${SRC_LIST} PROPERTIES LANGUAGE CXX)
add_definitions(-DDYNC_EXPORTS)
if(WIN32)
add_definitions(-DYY_NO_UNISTD_H)
endif()

dyninst_library(dynC_API dyninstAPI)
if (USE_COTIRE)
Expand Down
12 changes: 6 additions & 6 deletions dynC_API/src/C.l
Expand Up @@ -63,7 +63,7 @@ const bool lexVerbose = false; // set to true for debug mode
"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
\n ++line_num;
"*"+"/" BEGIN(INITIAL);
<<EOF>> {yylval.context = "Syntax Error: Unterminated block comment"; return(ERROR);}
<<EOF>> {yylval.context = "Syntax Error: Unterminated block comment"; return(D_ERROR);}
}

"//".* { if(lexVerbose)printf("Inline Comment\n") /* inline comment */;}
Expand All @@ -77,7 +77,7 @@ char|int|long|float|double|short|void|bool { yylval.sval = strdup(yytext); retur
"enum" {return ENUM; }

"case" { return(CASE); }
"const" { return(CONST); }
"const" { return(D_CONST); }
"default" { return(DEFAULT); }
"else" { return(ELSE); }
"if" { return(IF); }
Expand Down Expand Up @@ -130,7 +130,7 @@ L?'(\\.|[^\\'])+' { return(CONSTANT); }
yylval.context = "Unterminated string constant";
yycolumn = 1;
//yylval.line_number = line_num; line_num++;
return ERROR;
return D_ERROR;
}

\\[0-7]{1,3} { /* octal escape sequence */
Expand All @@ -140,7 +140,7 @@ L?'(\\.|[^\\'])+' { return(CONSTANT); }
/* error, constant is out-of-bounds */
yylval.context = "constant out of bounds";
// yylval.line_number = line_num;
return ERROR;
return D_ERROR;
}
c_string_buf += result;

Expand All @@ -149,7 +149,7 @@ L?'(\\.|[^\\'])+' { return(CONSTANT); }
\\[0-9]+ { /* generate error - bad escape sequence */
yylval.context = "bad escape sequence";
// yylval.line_number = line_num;
return ERROR;
return D_ERROR;
}
\\n c_string_buf += '\n';
\\t c_string_buf += '\t';
Expand Down Expand Up @@ -216,7 +216,7 @@ L?'(\\.|[^\\'])+' { return(CONSTANT); }
"`" { if(lexVerbose)printf("Backtick\n"); return(BACKTICK); }
[ \t\v\f] { }

^([^\n;{}])+\n {if(strstr(yytext, "//") != NULL){++line_num;}else{if(strncmp(yytext,"/*", 2) == 0){BEGIN(comment);++line_num;}else{if(lexVerbose)printf("No Semi!\n"); fatalError = true; dynClloc.first_column = yycolumn; yylval.context = "syntax error: missing ';'!"; yyless(yyleng - 1); return(ERROR);}}}
^([^\n;{}])+\n {if(strstr(yytext, "//") != NULL){++line_num;}else{if(strncmp(yytext,"/*", 2) == 0){BEGIN(comment);++line_num;}else{if(lexVerbose)printf("No Semi!\n"); fatalError = true; dynClloc.first_column = yycolumn; yylval.context = "syntax error: missing ';'!"; yyless(yyleng - 1); return(D_ERROR);}}}

\n {if(lexVerbose)printf("New Line!\n"); line_num++; yycolumn = 0; lineStr = "";}

Expand Down
13 changes: 5 additions & 8 deletions dynC_API/src/C.y
Expand Up @@ -24,7 +24,6 @@
#include <sstream>

extern "C" {
// std::string lineStr;
void yyerror(const char *s);
void yyerrorNonUni(const char *s);
void yyerrorNoTok(const char *s);
Expand All @@ -34,16 +33,14 @@ extern "C" {
void makeOneTimeStatement(BPatch_snippet &statement);
void makeOneTimeStatementGbl(BPatch_snippet &statement);
void getErrorBase(char *errbase, int length);
// char *yytext;
// char *dynCSnippetName;
}

extern std::string lineStr;

#define YYDEBUG 0 //set to 1 for debug mode

//name of current snippet for error reporting
const char *dynCSnippetName = "";
// name of current snippet for error reporting
char *dynCSnippetName = "";

SnippetGenerator *snippetGen;
BPatch_point *snippetPoint = NULL;
Expand Down Expand Up @@ -112,15 +109,15 @@ std::vector<BPatch_snippet *> endSnippets;

%token <sval> IDENTIFIER CONSTANT STRING TYPE
%token <ival> NUMBER
%token <context> ERROR
%token <context> D_ERROR
%token EOL
%token SIZEOF D_TRUE D_FALSE
%token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP
%token LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
%token XOR_ASSIGN OR_ASSIGN TYPE_NAME

%token TYPEDEF EXTERN STATIC
%token CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOID
%token D_CHAR D_SHORT D_INT D_LONG SIGNED UNSIGNED D_FLOAT DOUBLE D_CONST D_VOID
%token STRUCT UNION ENUM ELLIPSIS
%token IF
%token LOCAL PARAM GLOBAL FUNC DYNINST INST REGISTER
Expand Down Expand Up @@ -391,7 +388,7 @@ statement:
$$ = new BPatch_nullExpr();
actionTaken = false;
}
| ERROR // lex error token
| D_ERROR // lex error token
{
yyerrorNoTok($1);
$$ = new BPatch_nullExpr();
Expand Down

0 comments on commit 3c12b19

Please sign in to comment.