diff options
| author | Richard M. Stallman | 1993-03-03 06:20:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-03-03 06:20:12 +0000 |
| commit | 99e0a2e0324d91d6bdc0ba1ca8a234c0d271cdfb (patch) | |
| tree | 5760d5f5df17fd1095ee464218c716ec1183b9a2 /lib-src | |
| parent | 41f48cb1bd82bfd78d5d61dbfe173906ed298149 (diff) | |
| download | emacs-99e0a2e0324d91d6bdc0ba1ca8a234c0d271cdfb.tar.gz emacs-99e0a2e0324d91d6bdc0ba1ca8a234c0d271cdfb.zip | |
(C_entries): New local variable quotednl. Used for
parsing of #define's spanning multiple lines.
(C_entries): Save the definedef status
even when a newline is met inside a string.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 25fe5507ff6..5fe855bcd6d 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -906,7 +906,7 @@ process_file (file) | |||
| 906 | 906 | ||
| 907 | /* | 907 | /* |
| 908 | * This routine sets up the boolean psuedo-functions which work | 908 | * This routine sets up the boolean psuedo-functions which work |
| 909 | * by seting boolean flags dependent upon the corresponding character | 909 | * by setting boolean flags dependent upon the corresponding character |
| 910 | * Every char which is NOT in that string is not a white char. Therefore, | 910 | * Every char which is NOT in that string is not a white char. Therefore, |
| 911 | * all of the array "_wht" is set to FALSE, and then the elements | 911 | * all of the array "_wht" is set to FALSE, and then the elements |
| 912 | * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | 912 | * subscripted by the chars in "white" are set to TRUE. Thus "_wht" |
| @@ -1413,6 +1413,7 @@ C_create_stabs () | |||
| 1413 | 1413 | ||
| 1414 | #define CNL_SAVE_DEFINEDEF \ | 1414 | #define CNL_SAVE_DEFINEDEF \ |
| 1415 | { \ | 1415 | { \ |
| 1416 | quotednl = FALSE; \ | ||
| 1416 | prev_linepos = linepos; \ | 1417 | prev_linepos = linepos; \ |
| 1417 | SET_FILEPOS (linepos, inf, charno); \ | 1418 | SET_FILEPOS (linepos, inf, charno); \ |
| 1418 | lineno++; \ | 1419 | lineno++; \ |
| @@ -1431,10 +1432,10 @@ C_entries (c_ext) | |||
| 1431 | int c_ext; /* extension of C? */ | 1432 | int c_ext; /* extension of C? */ |
| 1432 | { | 1433 | { |
| 1433 | register int c; /* latest char read; '\0' for end of line */ | 1434 | register int c; /* latest char read; '\0' for end of line */ |
| 1434 | register int tokoff; /* offset in line of beginning of latest token */ | 1435 | register int tokoff; /* offset in line of start of latest token*/ |
| 1435 | register int toklen; /* length of latest token */ | 1436 | register int toklen; /* length of latest token */ |
| 1436 | register char *lp; /* pointer one beyond the character `c' */ | 1437 | register char *lp; /* pointer one beyond the character `c' */ |
| 1437 | logical incomm, inquote, inchar, midtoken; | 1438 | logical incomm, inquote, inchar, quotednl, midtoken; |
| 1438 | int level; /* current curly brace level */ | 1439 | int level; /* current curly brace level */ |
| 1439 | char tokb[BUFSIZ]; | 1440 | char tokb[BUFSIZ]; |
| 1440 | 1441 | ||
| @@ -1444,7 +1445,7 @@ C_entries (c_ext) | |||
| 1444 | *lp = 0; | 1445 | *lp = 0; |
| 1445 | 1446 | ||
| 1446 | definedef = dnone; | 1447 | definedef = dnone; |
| 1447 | gotone = midtoken = inquote = inchar = incomm = FALSE; | 1448 | gotone = midtoken = inquote = inchar = incomm = quotednl = FALSE; |
| 1448 | level = 0; | 1449 | level = 0; |
| 1449 | tydef = none; | 1450 | tydef = none; |
| 1450 | next_token_is_func = 0; | 1451 | next_token_is_func = 0; |
| @@ -1460,7 +1461,10 @@ C_entries (c_ext) | |||
| 1460 | '\0'; don't skip it, because it's the thing that tells us | 1461 | '\0'; don't skip it, because it's the thing that tells us |
| 1461 | to read the next line. */ | 1462 | to read the next line. */ |
| 1462 | if (*lp == 0) | 1463 | if (*lp == 0) |
| 1463 | continue; | 1464 | { |
| 1465 | quotednl =TRUE; | ||
| 1466 | continue; | ||
| 1467 | } | ||
| 1464 | lp++; | 1468 | lp++; |
| 1465 | c = ' '; | 1469 | c = ' '; |
| 1466 | } | 1470 | } |
| @@ -1520,7 +1524,8 @@ C_entries (c_ext) | |||
| 1520 | if (structdef == stagseen) | 1524 | if (structdef == stagseen) |
| 1521 | structdef = scolonseen; | 1525 | structdef = scolonseen; |
| 1522 | break; | 1526 | break; |
| 1523 | /* Not a struct definition when semicolon seen in non-sinbody context. */ | 1527 | /* Not a struct definition when semicolon seen |
| 1528 | in non-sinbody context. */ | ||
| 1524 | case ';': | 1529 | case ';': |
| 1525 | if (structdef != snone && structdef != sinbody) | 1530 | if (structdef != snone && structdef != sinbody) |
| 1526 | { | 1531 | { |
| @@ -1627,7 +1632,7 @@ C_entries (c_ext) | |||
| 1627 | lp = lp_tmp; | 1632 | lp = lp_tmp; |
| 1628 | if (bingo) | 1633 | if (bingo) |
| 1629 | { | 1634 | { |
| 1630 | if (GET_CHARNO (tok.linestart) != GET_CHARNO (linepos) | 1635 | if (GET_CHARNO (tok.linestart) != GET_CHARNO(linepos) |
| 1631 | && !tok_at_end_of_line) | 1636 | && !tok_at_end_of_line) |
| 1632 | { | 1637 | { |
| 1633 | /* | 1638 | /* |
| @@ -1639,7 +1644,8 @@ C_entries (c_ext) | |||
| 1639 | tok.p = lb1.buffer + (tok.p - tok_linebuf); | 1644 | tok.p = lb1.buffer + (tok.p - tok_linebuf); |
| 1640 | tok_linebuf = lb1.buffer; | 1645 | tok_linebuf = lb1.buffer; |
| 1641 | } | 1646 | } |
| 1642 | if (structdef == sinbody && definedef == dnone && is_func) | 1647 | if (structdef == sinbody |
| 1648 | && definedef == dnone && is_func) | ||
| 1643 | { /* function defined in C++ class body */ | 1649 | { /* function defined in C++ class body */ |
| 1644 | sprintf (tokb, "%s::%.*s", | 1650 | sprintf (tokb, "%s::%.*s", |
| 1645 | structtag[0] == '\0' ? "_anonymous_" | 1651 | structtag[0] == '\0' ? "_anonymous_" |
| @@ -1669,10 +1675,10 @@ C_entries (c_ext) | |||
| 1669 | midtoken = TRUE; | 1675 | midtoken = TRUE; |
| 1670 | } | 1676 | } |
| 1671 | } | 1677 | } |
| 1672 | /* Detect end of line, after having handled the last token on the line. */ | 1678 | /* Detect end of line, having handled the last token on the line. */ |
| 1673 | if (c == 0) | 1679 | if (c == 0) |
| 1674 | { | 1680 | { |
| 1675 | if (incomm) | 1681 | if (incomm || inquote || quotednl) |
| 1676 | { | 1682 | { |
| 1677 | CNL_SAVE_DEFINEDEF; | 1683 | CNL_SAVE_DEFINEDEF; |
| 1678 | } | 1684 | } |
| @@ -1710,7 +1716,8 @@ C_entries (c_ext) | |||
| 1710 | logical | 1716 | logical |
| 1711 | consider_token (c, lpp, tokp, is_func, c_ext, level) | 1717 | consider_token (c, lpp, tokp, is_func, c_ext, level) |
| 1712 | reg char c; /* IN: first char after the token */ | 1718 | reg char c; /* IN: first char after the token */ |
| 1713 | char **lpp; /* IN OUT: *lpp points to 2nd char after the token */ | 1719 | char **lpp; /* IN OUT: *lpp points |
| 1720 | to 2nd char after the token */ | ||
| 1714 | reg TOKEN *tokp; /* IN */ | 1721 | reg TOKEN *tokp; /* IN */ |
| 1715 | logical *is_func; /* OUT */ | 1722 | logical *is_func; /* OUT */ |
| 1716 | int c_ext; /* IN */ | 1723 | int c_ext; /* IN */ |
| @@ -1844,7 +1851,8 @@ consider_token (c, lpp, tokp, is_func, c_ext, level) | |||
| 1844 | { | 1851 | { |
| 1845 | case st_C_struct: | 1852 | case st_C_struct: |
| 1846 | case st_C_enum: | 1853 | case st_C_enum: |
| 1847 | if (tydef == begin || (typedefs_and_cplusplus && level == 0 && structdef == snone)) | 1854 | if (tydef == begin |
| 1855 | || (typedefs_and_cplusplus && level == 0 && structdef == snone)) | ||
| 1848 | { | 1856 | { |
| 1849 | structdef = skeyseen; | 1857 | structdef = skeyseen; |
| 1850 | structkey = tokse; | 1858 | structkey = tokse; |
| @@ -1887,8 +1895,8 @@ consider_token (c, lpp, tokp, is_func, c_ext, level) | |||
| 1887 | structdef = snone; | 1895 | structdef = snone; |
| 1888 | (void) strcpy (structtag, "<error 3>"); | 1896 | (void) strcpy (structtag, "<error 3>"); |
| 1889 | } | 1897 | } |
| 1890 | /* Now what? And how does/should this stuff interact with tydef?? */ | 1898 | /* Now what? And how does/should this stuff interact with tydef?? */ |
| 1891 | /* Also maybe reset lp to *lpp for benefit of the function finding code. */ | 1899 | /* Also maybe reset lp to *lpp for sake of function-finding code. */ |
| 1892 | } | 1900 | } |
| 1893 | if (tydef == begin) | 1901 | if (tydef == begin) |
| 1894 | { | 1902 | { |