New "Project" for Scanner

This commit is contained in:
Victor Fernandes 2017-03-15 03:19:27 -04:00
parent 73adc465b4
commit 0b5fb5befa
3 changed files with 20 additions and 11 deletions

View File

@ -177,7 +177,7 @@ size_t b_incfactor(Buffer* const pBD) {
*/
short b_mark(Buffer* const pBD) {
if (!pBD) { return R_FAIL1; }
return pBD->mark_coffset;
return pBD->mark_offset;
}
/* Reports if the character buffer's memory space was relocated after resizing
@ -431,7 +431,7 @@ int b_reset(Buffer* const pBD) {
pBD->addc_offset = OFFSET_RESET;
pBD->getc_offset = OFFSET_RESET;
pBD->mark_coffset = OFFSET_RESET;
pBD->mark_offset = OFFSET_RESET;
pBD->eob = UNSET_EOB_FLAG;
pBD->r_flag = UNSET_R_FLAG;
return TRUE;
@ -448,11 +448,11 @@ int b_reset(Buffer* const pBD) {
short b_retract_to_mark(Buffer* const pBD) {
/* Check if any offsets are out of bounds */
if(!pBD ||
pBD->mark_coffset < OFFSET_RESET ||
pBD->mark_coffset > pBD->capacity){
pBD->mark_offset < OFFSET_RESET ||
pBD->mark_offset > pBD->capacity){
return R_FAIL1;
}
pBD->getc_offset = pBD->mark_coffset;
pBD->getc_offset = pBD->mark_offset;
return pBD->getc_offset;
}

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buffer", "buffer\buffer.vcxproj", "{034E0E4B-DAFA-45D4-882B-1815AC73DA9E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scanner", "scanner\scanner.vcxproj", "{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -21,6 +23,14 @@ Global
{034E0E4B-DAFA-45D4-882B-1815AC73DA9E}.Release|x64.Build.0 = Release|x64
{034E0E4B-DAFA-45D4-882B-1815AC73DA9E}.Release|x86.ActiveCfg = Release|Win32
{034E0E4B-DAFA-45D4-882B-1815AC73DA9E}.Release|x86.Build.0 = Release|Win32
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Debug|x64.ActiveCfg = Debug|x64
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Debug|x64.Build.0 = Debug|x64
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Debug|x86.ActiveCfg = Debug|Win32
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Debug|x86.Build.0 = Debug|Win32
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Release|x64.ActiveCfg = Release|x64
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Release|x64.Build.0 = Release|x64
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Release|x86.ActiveCfg = Release|Win32
{C53261F2-8A2D-4F75-8E54-DBFD16A621BB}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -116,13 +116,14 @@ which is being processed by the scanner.
case '/': t.code = ART_OP_T; t.attribute.arr_op = DIV; return t; /* Devision operator */
case '>': t.code = REL_OP_T; t.attribute.rel_op = GT; return t; /* Greater-than relational operator */
case '<':
/* MSVC will complain about this assignment inside a conditional expression*/
if (c = b_getc(sc_buf) == '>') {
t.code = REL_OP_T;
t.attribute.rel_op = NE; /* Negation operator */
return t;
}
else if (c == '<') {
t.code == SCC_OP_T; /* String concatenation operator */
t.code = SCC_OP_T; /* String concatenation operator */
}
else {
t.code = REL_OP_T;
@ -441,6 +442,7 @@ Token aa_func02(char lexeme[]) {
break;
default:
/* Floating point*/
break;
}
return t;
@ -466,15 +468,13 @@ REPLACE XX WITH THE CORRESPONDING ACCEPTING STATE NUMBER
*/
Token aa_func03(char lexeme[]) {
Token t;
int offset;
int i;
char* temp_str;
if ((temp_str = (char*)calloc(VID_LEN + 2, sizeof(char))) == NULL) {
return aa_table[ES]("RUN TIME ERROR");
}
strcpy(temp_str, lexeme, VID_LEN);
temp_str[strlen(temp_str)] = "#"; /* Append # to end of the SVID */
strncpy(temp_str, lexeme, VID_LEN);
temp_str[strlen(temp_str)] = '#'; /* Add# to end of the SVID */
strncpy(t.attribute.vid_lex, temp_str, VID_LEN);
free(temp_str);
@ -491,7 +491,6 @@ Token aa_func03(char lexeme[]) {
AND THEN THE # CHARACTER IS APPENDED TO THE NAME.
ADD \0 AT THE END TO MAKE A C-type STRING.
*/
return t;
}
/*ACCEPTING FUNCTION FOR THE integer literal(IL)-decimal constant(DIL)*/