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