Rename fileUngetc() to ungetcToInputFile()

This commit is contained in:
Jiří Techet 2016-07-30 12:31:59 +02:00
parent acdc44074f
commit 357e4fe1bd
14 changed files with 79 additions and 79 deletions

View File

@ -183,7 +183,7 @@ static boolean readDirective (int c, char *const name, unsigned int maxLength)
c = getcFromInputFile ();
if (c == EOF || ! isalpha (c))
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
}
@ -205,7 +205,7 @@ static void readIdentifier (int c, vString *const name)
vStringPut (name, c);
c = getcFromInputFile ();
} while (c != EOF && isident (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (name);
}
@ -335,7 +335,7 @@ static void directiveDefine (const int c)
{
readIdentifier (c, Cpp.directive.name);
nc = getcFromInputFile ();
fileUngetc (nc);
ungetcToInputFile (nc);
parameterized = (boolean) (nc == '(');
if (! isIgnore ())
makeDefineTag (vStringValue (Cpp.directive.name), parameterized);
@ -445,7 +445,7 @@ static Comment isComment (void)
comment = COMMENT_D;
else
{
fileUngetc (next);
ungetcToInputFile (next);
comment = COMMENT_NONE;
}
return comment;
@ -550,7 +550,7 @@ static int skipToEndOfCxxRawLiteralString (void)
if (c != '(' && ! isCxxRawLiteralDelimiterChar (c))
{
fileUngetc (c);
ungetcToInputFile (c);
c = skipToEndOfString (FALSE);
}
else
@ -578,7 +578,7 @@ static int skipToEndOfCxxRawLiteralString (void)
if (i == delimLen && c == DOUBLE_QUOTE)
break;
else
fileUngetc (c);
ungetcToInputFile (c);
}
}
while ((c = getcFromInputFile ()) != EOF);
@ -605,14 +605,14 @@ static int skipToEndOfChar (void)
break;
else if (c == NEWLINE)
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
else if (count == 1 && strchr ("DHOB", toupper (c)) != NULL)
veraBase = c;
else if (veraBase != '\0' && ! isalnum (c))
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
}
@ -687,7 +687,7 @@ process:
{
c = skipOverCplusComment ();
if (c == NEWLINE)
fileUngetc (c);
ungetcToInputFile (c);
}
else if (comment == COMMENT_D)
c = skipOverDComment ();
@ -703,7 +703,7 @@ process:
if (next == NEWLINE)
continue;
else
fileUngetc (next);
ungetcToInputFile (next);
break;
}
@ -711,7 +711,7 @@ process:
{
int next = getcFromInputFile ();
if (next != '?')
fileUngetc (next);
ungetcToInputFile (next);
else
{
next = getcFromInputFile ();
@ -727,8 +727,8 @@ process:
case '-': c = '~'; break;
case '=': c = '#'; goto process;
default:
fileUngetc ('?');
fileUngetc (next);
ungetcToInputFile ('?');
ungetcToInputFile (next);
break;
}
}
@ -745,7 +745,7 @@ process:
{
case ':': c = '['; break;
case '%': c = '{'; break;
default: fileUngetc (next);
default: ungetcToInputFile (next);
}
goto enter;
}
@ -755,7 +755,7 @@ process:
if (next == '>')
c = ']';
else
fileUngetc (next);
ungetcToInputFile (next);
goto enter;
}
case '%':
@ -765,7 +765,7 @@ process:
{
case '>': c = '}'; break;
case ':': c = '#'; goto process;
default: fileUngetc (next);
default: ungetcToInputFile (next);
}
goto enter;
}
@ -781,7 +781,7 @@ process:
break;
}
else
fileUngetc (next);
ungetcToInputFile (next);
}
else if (c == 'R' && Cpp.hasCxxRawLiteralStrings)
{
@ -812,7 +812,7 @@ process:
{
int next = getcFromInputFile ();
if (next != DOUBLE_QUOTE)
fileUngetc (next);
ungetcToInputFile (next);
else
{
Cpp.directive.accept = FALSE;

View File

@ -416,7 +416,7 @@ readnext:
return c;
}
extern void fileUngetc (int c)
extern void ungetcToInputFile (int c)
{
const size_t len = sizeof File.ungetchBuf / sizeof File.ungetchBuf[0];

View File

@ -109,7 +109,7 @@ extern void fileClose (void);
extern int getcFromInputFile (void);
extern int fileGetNthPrevC (unsigned int nth, int def);
extern int fileSkipToCharacter (int c);
extern void fileUngetc (int c);
extern void ungetcToInputFile (int c);
extern const unsigned char *fileReadLine (void);
extern char *readLine (vString *const vLine, MIO *const mio);
extern char *readSourceLine (vString *const vLine, MIOPos location, long *const pSeekValue);

View File

@ -62,7 +62,7 @@ static void parseSelector (vString *const string, const int firstChar)
vStringPut (string, (char) c);
c = getcFromInputFile ();
} while (isSelectorChar (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (string);
}
@ -106,7 +106,7 @@ getNextChar:
int d = getcFromInputFile ();
if (d != '*')
{
fileUngetc (d);
ungetcToInputFile (d);
vStringPut (token->string, c);
token->type = c;
}

View File

@ -648,7 +648,7 @@ static int getFixedFormChar (void)
if (c2 == '\n')
longjmp (Exception, (int) ExceptionFixedFormat);
else
fileUngetc (c2);
ungetcToInputFile (c2);
}
}
while (Column == 0)
@ -691,7 +691,7 @@ static int getFixedFormChar (void)
Column = 0;
else if (Column > 6)
{
fileUngetc (c);
ungetcToInputFile (c);
c = ' ';
}
break;
@ -734,7 +734,7 @@ static int getFreeFormChar (boolean inComment)
advanceLine = TRUE;
else
{
fileUngetc (c);
ungetcToInputFile (c);
c = '&';
}
}

View File

@ -203,7 +203,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
c = getcFromInputFile ();
} while (isIdentChar (c));
vStringTerminate (string);
fileUngetc (c); /* always unget, LF might add a semicolon */
ungetcToInputFile (c); /* always unget, LF might add a semicolon */
}
static void readToken (tokenInfo *const token)
@ -264,7 +264,7 @@ getNextChar:
* continue through the next
* newline. A line comment acts
* like a newline. */
fileUngetc ('\n');
ungetcToInputFile ('\n');
goto getNextChar;
case '*':
do
@ -282,14 +282,14 @@ getNextChar:
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
} while (c != EOF && c != '\0');
fileUngetc (hasNewline ? '\n' : ' ');
ungetcToInputFile (hasNewline ? '\n' : ' ');
goto getNextChar;
default:
token->type = TOKEN_OTHER;
fileUngetc (d);
ungetcToInputFile (d);
break;
}
}
@ -311,7 +311,7 @@ getNextChar:
token->type = TOKEN_LEFT_ARROW;
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_OTHER;
}
}

View File

@ -81,7 +81,7 @@ static int get_next_char(void)
nxt = getcFromInputFile();
if (nxt == EOF)
return c;
fileUngetc(nxt);
ungetcToInputFile(nxt);
if (c == '-' && nxt == '-') {
skip_rest_of_line();
@ -127,7 +127,7 @@ static int get_token(char *token, int n)
if (c == EOF)
return 0;
if (i != n) {
fileUngetc(c);
ungetcToInputFile(c);
return 1;
} else {
return 0;

View File

@ -357,7 +357,7 @@ static void parseString (vString *const string, const int delimiter)
{
c = getcFromInputFile();
if (c != '\n')
fileUngetc (c);
ungetcToInputFile (c);
}
}
else if (c == delimiter)
@ -368,7 +368,7 @@ static void parseString (vString *const string, const int delimiter)
end = TRUE;
/* we don't want to eat the newline itself to let the automatic
* semicolon insertion code kick in */
fileUngetc (c);
ungetcToInputFile (c);
}
else
vStringPut (string, c);
@ -390,7 +390,7 @@ static void parseRegExp (void)
{
c = getcFromInputFile ();
} while (isalpha (c));
fileUngetc (c);
ungetcToInputFile (c);
break;
}
else if (c == '\\')
@ -415,7 +415,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
c = getcFromInputFile ();
} while (isIdentChar (c));
vStringTerminate (string);
fileUngetc (c); /* unget non-identifier character */
ungetcToInputFile (c); /* unget non-identifier character */
}
static keywordId analyzeToken (vString *const name)
@ -480,7 +480,7 @@ getNextChar:
token->type = TOKEN_POSTFIX_OPERATOR;
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_BINARY_OPERATOR;
}
break;
@ -547,7 +547,7 @@ getNextChar:
case '\\':
c = getcFromInputFile ();
if (c != '\\' && c != '"' && !isspace (c))
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_CHARACTER;
token->lineNumber = getSourceLineNumber ();
token->filePosition = getInputFilePosition ();
@ -559,7 +559,7 @@ getNextChar:
if ( (d != '*') && /* is this the start of a comment? */
(d != '/') ) /* is a one line comment? */
{
fileUngetc (d);
ungetcToInputFile (d);
switch (LastTokenType)
{
case TOKEN_CHARACTER:
@ -592,7 +592,7 @@ getNextChar:
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
} while (c != EOF && c != '\0');
goto getNextChar;
}
@ -601,7 +601,7 @@ getNextChar:
skipToCharacter ('\n');
/* if we care about newlines, put it back so it is seen */
if (include_newlines)
fileUngetc ('\n');
ungetcToInputFile ('\n');
goto getNextChar;
}
}
@ -614,7 +614,7 @@ getNextChar:
token->type = TOKEN_UNDEFINED;
else if ((c = getcFromInputFile ()) != '!')
{
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_UNDEFINED;
}
else

View File

@ -200,7 +200,7 @@ static void readTokenFull (tokenInfo *const token,
}
while (c != EOF && isIdentChar (c));
vStringTerminate (token->string);
fileUngetc (c);
ungetcToInputFile (c);
switch (lookupKeyword (vStringValue (token->string), Lang_json))
{
case KEYWORD_true: token->type = TOKEN_TRUE; break;

View File

@ -58,7 +58,7 @@ static void skipLine (void)
c = nextChar ();
while (c != EOF && c != '\n');
if (c == '\n')
fileUngetc (c);
ungetcToInputFile (c);
}
static int skipToNonWhite (int c)
@ -119,7 +119,7 @@ static void readIdentifier (const int first, vString *const id)
vStringPut (id, c);
c = nextChar ();
}
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (id);
}
@ -159,14 +159,14 @@ static void findMakeTags (void)
else if (variable_possible && c == '?')
{
c = nextChar ();
fileUngetc (c);
ungetcToInputFile (c);
variable_possible = (c == '=');
}
else if (variable_possible && c == ':' &&
stringListCount (identifiers) > 0)
{
c = nextChar ();
fileUngetc (c);
ungetcToInputFile (c);
if (c != '=')
{
unsigned int i;
@ -207,7 +207,7 @@ static void findMakeTags (void)
c = nextChar ();
}
if (c == '\n')
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (name);
vStringStripTrailing (name);
newMacro (name);

View File

@ -590,14 +590,14 @@ static void parseHeredoc (vString *const string)
c = getcFromInputFile ();
if (delimiter[len] != 0)
fileUngetc (c);
ungetcToInputFile (c);
else
{
/* line start matched the delimiter, now check whether there
* is anything after it */
if (c == '\r' || c == '\n')
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
else if (c == ';')
@ -608,14 +608,14 @@ static void parseHeredoc (vString *const string)
/* put back the semicolon since it's not part of the
* string. we can't put back the newline, but it's a
* whitespace character nobody cares about it anyway */
fileUngetc (';');
ungetcToInputFile (';');
break;
}
else
{
/* put semicolon in the string and continue */
extra = ';';
fileUngetc (d);
ungetcToInputFile (d);
}
}
}
@ -634,7 +634,7 @@ static void parseHeredoc (vString *const string)
return;
error:
fileUngetc (c);
ungetcToInputFile (c);
}
static void parseIdentifier (vString *const string, const int firstChar)
@ -645,7 +645,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
vStringPut (string, (char) c);
c = getcFromInputFile ();
} while (isIdentChar (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (string);
}
@ -739,7 +739,7 @@ static int findPhpStart (void)
/* <script language="php"> */
else
{
fileUngetc (c);
ungetcToInputFile (c);
if (isOpenScriptLanguagePhp ('<'))
break;
}
@ -760,7 +760,7 @@ static int skipSingleComment (void)
{
int next = getcFromInputFile ();
if (next != '\n')
fileUngetc (next);
ungetcToInputFile (next);
else
c = next;
}
@ -771,7 +771,7 @@ static int skipSingleComment (void)
if (next == '>')
InPhp = FALSE;
else
fileUngetc (next);
ungetcToInputFile (next);
}
} while (InPhp && c != EOF && c != '\n' && c != '\r');
return c;
@ -823,7 +823,7 @@ getNextChar:
token->type = TOKEN_OPERATOR;
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_EQUAL_SIGN;
}
break;
@ -856,7 +856,7 @@ getNextChar:
}
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
}
@ -867,7 +867,7 @@ getNextChar:
}
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
break;
@ -885,7 +885,7 @@ getNextChar:
{
int d = getcFromInputFile ();
if (d != '=')
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_OPERATOR;
break;
}
@ -909,7 +909,7 @@ getNextChar:
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
}
} while (c != EOF && c != '\0');
goto getNextChar;
@ -917,7 +917,7 @@ getNextChar:
else
{
if (d != '=')
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_OPERATOR;
}
break;
@ -928,7 +928,7 @@ getNextChar:
int d = getcFromInputFile ();
if (! isIdentChar (d))
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
else
@ -949,7 +949,7 @@ getNextChar:
}
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
break;

View File

@ -226,7 +226,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
vStringPut (string, (char) c);
c = getcFromInputFile ();
} while (isIdentChar (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (string);
}
@ -259,7 +259,7 @@ static int skipSingleComment (void)
{
int next = getcFromInputFile ();
if (next != '\n')
fileUngetc (next);
ungetcToInputFile (next);
else
c = next;
}
@ -320,14 +320,14 @@ getNextChar:
if (c == '>')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
}
} while (c != EOF);
goto getNextChar;
}
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
break;
@ -346,7 +346,7 @@ getNextChar:
{
int d = getcFromInputFile ();
if (d != '=')
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_OPERATOR;
break;
}
@ -356,7 +356,7 @@ getNextChar:
int d = getcFromInputFile ();
if (! isIdentChar (d))
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
else

View File

@ -497,7 +497,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
} while (isIdentChar (c));
vStringTerminate (string);
if (!isspace (c))
fileUngetc (c); /* unget non-identifier character */
ungetcToInputFile (c); /* unget non-identifier character */
}
static void readToken (tokenInfo *const token)
@ -560,7 +560,7 @@ getNextChar:
else
{
if (!isspace (c))
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_OPERATOR;
}
break;
@ -579,7 +579,7 @@ getNextChar:
}
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_UNDEFINED;
}
break;
@ -588,7 +588,7 @@ getNextChar:
case '\\':
c = getcFromInputFile ();
if (c != '\\' && c != '"' && c != '\'' && !isspace (c))
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_CHARACTER;
token->lineNumber = getSourceLineNumber ();
token->filePosition = getInputFilePosition ();
@ -601,7 +601,7 @@ getNextChar:
(d != '/') ) /* is a one line comment? */
{
token->type = TOKEN_FORWARD_SLASH;
fileUngetc (d);
ungetcToInputFile (d);
}
else
{
@ -614,7 +614,7 @@ getNextChar:
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
} while (c != EOF && c != '\0');
goto getNextChar;
}

View File

@ -145,7 +145,7 @@ static int vGetc (void)
}
else
{
fileUngetc (c2);
ungetcToInputFile (c2);
}
}
else if (c == '"') /* strip string contents */