diff options
| author | Gerd Moellmann | 2000-07-10 20:36:58 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-10 20:36:58 +0000 |
| commit | d65b0571381bbd2ddf939a250796d445fa519535 (patch) | |
| tree | 9fb74e599f06b8b6df69da1deafbbbc4b33dedbc /lib-src | |
| parent | 209f68d91b9376a90684c184a8baf322a2cc9828 (diff) | |
| download | emacs-d65b0571381bbd2ddf939a250796d445fa519535.tar.gz emacs-d65b0571381bbd2ddf939a250796d445fa519535.zip | |
(yylex): Accept string literals with newlines in them.
(process_pp_line): Handle case of string literal with newline
in it in replacement text, which counts as continuing the
replacement text in GNU C.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ebrowse.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 8ebe5ff8991..8dcd830793e 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -1462,7 +1462,7 @@ do { \ | |||
| 1462 | int | 1462 | int |
| 1463 | process_pp_line () | 1463 | process_pp_line () |
| 1464 | { | 1464 | { |
| 1465 | int in_comment = 0; | 1465 | int in_comment = 0, in_string = 0; |
| 1466 | int c; | 1466 | int c; |
| 1467 | char *p = yytext; | 1467 | char *p = yytext; |
| 1468 | 1468 | ||
| @@ -1501,7 +1501,7 @@ process_pp_line () | |||
| 1501 | } | 1501 | } |
| 1502 | } | 1502 | } |
| 1503 | 1503 | ||
| 1504 | while (c && (c != '\n' || in_comment)) | 1504 | while (c && (c != '\n' || in_comment || in_string)) |
| 1505 | { | 1505 | { |
| 1506 | if (c == '\\') | 1506 | if (c == '\\') |
| 1507 | GET (c); | 1507 | GET (c); |
| @@ -1515,13 +1515,15 @@ process_pp_line () | |||
| 1515 | if (GET (c) == '/') | 1515 | if (GET (c) == '/') |
| 1516 | in_comment = 0; | 1516 | in_comment = 0; |
| 1517 | } | 1517 | } |
| 1518 | else if (c == '"') | ||
| 1519 | in_string = !in_string; | ||
| 1518 | 1520 | ||
| 1519 | if (c == '\n') | 1521 | if (c == '\n') |
| 1520 | INCREMENT_LINENO; | 1522 | INCREMENT_LINENO; |
| 1521 | 1523 | ||
| 1522 | GET (c); | 1524 | GET (c); |
| 1523 | } | 1525 | } |
| 1524 | 1526 | ||
| 1525 | return c; | 1527 | return c; |
| 1526 | } | 1528 | } |
| 1527 | 1529 | ||
| @@ -1579,6 +1581,7 @@ yylex () | |||
| 1579 | else switch (c) | 1581 | else switch (c) |
| 1580 | { | 1582 | { |
| 1581 | case '\n': | 1583 | case '\n': |
| 1584 | INCREMENT_LINENO; | ||
| 1582 | case 'a': | 1585 | case 'a': |
| 1583 | case 'b': | 1586 | case 'b': |
| 1584 | case 'f': | 1587 | case 'f': |
| @@ -1641,7 +1644,7 @@ yylex () | |||
| 1641 | else | 1644 | else |
| 1642 | yyerror ("newline in string constant"); | 1645 | yyerror ("newline in string constant"); |
| 1643 | INCREMENT_LINENO; | 1646 | INCREMENT_LINENO; |
| 1644 | goto end_string; | 1647 | break; |
| 1645 | 1648 | ||
| 1646 | default: | 1649 | default: |
| 1647 | break; | 1650 | break; |