Use getInputLineNumber() instead of getSourceLineNumber() in parsers
We want the line number of the tag appearance, not the line after #line directives are processed.
This commit is contained in:
parent
4fbd38f690
commit
781f4ef1ca
@ -607,7 +607,7 @@ static void initToken (tokenInfo* const token)
|
||||
{
|
||||
token->type = TOKEN_NONE;
|
||||
token->keyword = KEYWORD_NONE;
|
||||
token->lineNumber = getSourceLineNumber();
|
||||
token->lineNumber = getInputLineNumber();
|
||||
token->filePosition = getInputFilePosition();
|
||||
vStringClear(token->name);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static void findCssTags (void)
|
||||
vStringCat (selector, token.string);
|
||||
|
||||
kind = classifySelector (token.string);
|
||||
lineNumber = getSourceLineNumber ();
|
||||
lineNumber = getInputLineNumber ();
|
||||
filePosition = getInputFilePosition ();
|
||||
|
||||
readToken (&token);
|
||||
|
@ -429,7 +429,7 @@ static tokenInfo *newToken (void)
|
||||
token->tag = TAG_UNDEFINED;
|
||||
token->string = vStringNew ();
|
||||
token->secondary = NULL;
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
return token;
|
||||
@ -966,7 +966,7 @@ static void readToken (tokenInfo *const token)
|
||||
getNextChar:
|
||||
c = getChar ();
|
||||
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
switch (c)
|
||||
|
@ -142,7 +142,7 @@ static tokenInfo *newToken (void)
|
||||
token->type = TOKEN_NONE;
|
||||
token->keyword = KEYWORD_NONE;
|
||||
token->string = vStringNew ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
return token;
|
||||
}
|
||||
@ -221,7 +221,7 @@ getNextChar:
|
||||
do
|
||||
{
|
||||
c = getcFromInputFile ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
if (c == '\n' && (lastTokenType == TOKEN_IDENTIFIER ||
|
||||
lastTokenType == TOKEN_STRING ||
|
||||
@ -300,7 +300,7 @@ getNextChar:
|
||||
case '`':
|
||||
token->type = TOKEN_STRING;
|
||||
parseString (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
@ -357,7 +357,7 @@ getNextChar:
|
||||
if (isStartIdentChar (c))
|
||||
{
|
||||
parseIdentifier (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
token->keyword = lookupKeyword (vStringValue (token->string), Lang_go);
|
||||
if (isKeyword (token, KEYWORD_NONE))
|
||||
|
@ -190,7 +190,7 @@ static tokenInfo *newToken (void)
|
||||
token->scope = vStringNew ();
|
||||
token->nestLevel = 0;
|
||||
token->ignoreTag = FALSE;
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
return token;
|
||||
@ -445,7 +445,7 @@ getNextChar:
|
||||
while (c == '\t' || c == ' ' ||
|
||||
((c == '\r' || c == '\n') && ! include_newlines));
|
||||
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
if (repr)
|
||||
@ -533,7 +533,7 @@ getNextChar:
|
||||
case '"':
|
||||
token->type = TOKEN_STRING;
|
||||
parseString (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
if (repr)
|
||||
{
|
||||
@ -547,7 +547,7 @@ getNextChar:
|
||||
if (c != '\\' && c != '"' && !isspace (c))
|
||||
ungetcToInputFile (c);
|
||||
token->type = TOKEN_CHARACTER;
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
@ -572,7 +572,7 @@ getNextChar:
|
||||
default:
|
||||
token->type = TOKEN_REGEXP;
|
||||
parseRegExp ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
}
|
||||
@ -628,7 +628,7 @@ getNextChar:
|
||||
else
|
||||
{
|
||||
parseIdentifier (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
token->keyword = analyzeToken (token->string);
|
||||
if (isKeyword (token, KEYWORD_NONE))
|
||||
|
@ -87,7 +87,7 @@ static tokenInfo *newToken (void)
|
||||
token->scopeKind = TAG_NONE;
|
||||
token->string = vStringNew ();
|
||||
token->scope = vStringNew ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
return token;
|
||||
@ -150,7 +150,7 @@ static void readTokenFull (tokenInfo *const token,
|
||||
c = getcFromInputFile ();
|
||||
while (c == '\t' || c == ' ' || c == '\r' || c == '\n');
|
||||
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
switch (c)
|
||||
|
@ -377,7 +377,7 @@ static tokenInfo *newToken (void)
|
||||
token->keyword = KEYWORD_NONE;
|
||||
token->string = vStringNew ();
|
||||
token->scope = vStringNew ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
token->parentKind = -1;
|
||||
|
||||
@ -794,7 +794,7 @@ getNextChar:
|
||||
|
||||
c = skipWhitespaces (c);
|
||||
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
switch (c)
|
||||
@ -829,7 +829,7 @@ getNextChar:
|
||||
case '"':
|
||||
token->type = TOKEN_STRING;
|
||||
parseString (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
|
@ -151,7 +151,7 @@ static tokenInfo *newToken (void)
|
||||
token->type = TOKEN_UNDEFINED;
|
||||
token->string = vStringNew ();
|
||||
token->scope = vStringNew ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
token->parentKind = -1;
|
||||
|
||||
@ -277,7 +277,7 @@ getNextChar:
|
||||
c = getcFromInputFile ();
|
||||
c = skipWhitespaces (c);
|
||||
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
switch (c)
|
||||
@ -299,7 +299,7 @@ getNextChar:
|
||||
case '"':
|
||||
token->type = TOKEN_STRING;
|
||||
parseString (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
|
@ -346,7 +346,7 @@ static void scanCharacterOrLifetime (lexerState *lexer)
|
||||
static int advanceToken (lexerState *lexer, boolean skip_whitspace)
|
||||
{
|
||||
boolean have_whitespace = FALSE;
|
||||
lexer->line = getSourceLineNumber();
|
||||
lexer->line = getInputLineNumber();
|
||||
lexer->pos = getInputFilePosition();
|
||||
while (lexer->cur_c != EOF)
|
||||
{
|
||||
@ -367,7 +367,7 @@ static int advanceToken (lexerState *lexer, boolean skip_whitspace)
|
||||
break;
|
||||
}
|
||||
}
|
||||
lexer->line = getSourceLineNumber();
|
||||
lexer->line = getInputLineNumber();
|
||||
lexer->pos = getInputFilePosition();
|
||||
while (lexer->cur_c != EOF)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ static tokenInfo *newToken (void)
|
||||
token->scope = vStringNew ();
|
||||
token->scopeKind = SQLTAG_COUNT;
|
||||
token->begin_end_nest_lvl = 0;
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
|
||||
return token;
|
||||
@ -510,7 +510,7 @@ getNextChar:
|
||||
do
|
||||
{
|
||||
c = getcFromInputFile ();
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
/*
|
||||
* Added " to the list of ignores, not sure what this
|
||||
@ -544,7 +544,7 @@ getNextChar:
|
||||
case '"':
|
||||
token->type = TOKEN_STRING;
|
||||
parseString (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
@ -588,7 +588,7 @@ getNextChar:
|
||||
if (c != '\\' && c != '"' && c != '\'' && !isspace (c))
|
||||
ungetcToInputFile (c);
|
||||
token->type = TOKEN_CHARACTER;
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
break;
|
||||
|
||||
@ -631,7 +631,7 @@ getNextChar:
|
||||
else
|
||||
{
|
||||
parseIdentifier (token->string, c);
|
||||
token->lineNumber = getSourceLineNumber ();
|
||||
token->lineNumber = getInputLineNumber ();
|
||||
token->filePosition = getInputFilePosition ();
|
||||
token->keyword = analyzeToken (token->string, Lang_sql);
|
||||
if (isKeyword (token, KEYWORD_rem))
|
||||
|
Loading…
x
Reference in New Issue
Block a user