Ticket #267 (etags incorrect get the line number definition)

fix: etags incorrect get the line number of function definition
This commit is contained in:
Ilia Maslakov 2009-08-14 11:13:47 +00:00 committed by Ilia Maslakov
parent bf6d6bafb4
commit 2289c62c6e
1 changed files with 15 additions and 3 deletions

View File

@ -46,7 +46,7 @@
static gboolean parse_define(char *buf, char **long_name, char **short_name, long *line)
{
enum {in_longname, in_shortname, in_line, finish} def_state = in_longname;
enum {in_longname, in_shortname, in_shortname_first_char, in_line, finish} def_state = in_longname;
static char longdef[LONG_DEF_LEN];
static char shortdef[SHORT_DEF_LEN];
@ -69,13 +69,25 @@ static gboolean parse_define(char *buf, char **long_name, char **short_name, lon
}
}
break;
case in_shortname:
case in_shortname_first_char:
if ( isdigit(c) ) {
nshort = 0;
buf--;
def_state = in_line;
} else if ( c == 0x01 ) {
def_state = in_line;
} else {
if ( nshort < SHORT_DEF_LEN - 1 ) {
shortdef[nshort++] = c;
def_state = in_shortname;
}
}
break;
case in_shortname:
if ( c == 0x01 ) {
def_state = in_line;
} else if ( c == '\n' ) {
def_state = finish;
} else {
if ( nshort < SHORT_DEF_LEN - 1 ) {
shortdef[nshort++] = c;
@ -83,7 +95,7 @@ static gboolean parse_define(char *buf, char **long_name, char **short_name, lon
}
break;
case in_line:
if ( c == ',' ) {
if ( c == ',' || c == '\n') {
def_state = finish;
} else if ( isdigit(c) ) {
if ( nline < LINE_DEF_LEN - 1 ) {