mirror of https://github.com/MidnightCommander/mc
Ticket #267 (etags incorrect get the line number definition)
fix: etags incorrect get the line number of function definition
This commit is contained in:
parent
bf6d6bafb4
commit
2289c62c6e
18
edit/etags.c
18
edit/etags.c
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue