diff options
| author | Jan Stranik | 2022-10-28 16:13:42 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2022-11-17 12:07:45 +0200 |
| commit | 8a6c5be683a283d12cc795f091d52d6d75e2e5e8 (patch) | |
| tree | e6117cd668341796dee9af4f7ba47f1253e22993 /lib-src | |
| parent | 67d08daa97019ae11f5a85fc40cf95138e4837dc (diff) | |
| download | emacs-8a6c5be683a283d12cc795f091d52d6d75e2e5e8.tar.gz emacs-8a6c5be683a283d12cc795f091d52d6d75e2e5e8.zip | |
Support multi-line C++11 strings in Ebrowse
* lib-src/ebrowse.c (yylex): Support C++11 multi-line strings.
(bug#58847)
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ebrowse.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 641570da02e..d3af926b634 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -1574,6 +1574,67 @@ yylex (void) | |||
| 1574 | 1574 | ||
| 1575 | end_string: | 1575 | end_string: |
| 1576 | return end_char == '\'' ? CCHAR : CSTRING; | 1576 | return end_char == '\'' ? CCHAR : CSTRING; |
| 1577 | case 'R': | ||
| 1578 | if (GET (c) == '"') | ||
| 1579 | { | ||
| 1580 | /* C++11 rstrings. */ | ||
| 1581 | |||
| 1582 | #define RSTRING_EOF_CHECK \ | ||
| 1583 | do { \ | ||
| 1584 | if (c == '\0') \ | ||
| 1585 | { \ | ||
| 1586 | yyerror ("unterminated c++11 rstring", NULL); \ | ||
| 1587 | UNGET (); \ | ||
| 1588 | return CSTRING; \ | ||
| 1589 | } \ | ||
| 1590 | } while (0) | ||
| 1591 | |||
| 1592 | char *rstring_prefix_start = in; | ||
| 1593 | |||
| 1594 | while (GET (c) != '(') | ||
| 1595 | { | ||
| 1596 | RSTRING_EOF_CHECK; | ||
| 1597 | if (c == '"') | ||
| 1598 | { | ||
| 1599 | yyerror ("malformed c++11 rstring", NULL); | ||
| 1600 | return CSTRING; | ||
| 1601 | } | ||
| 1602 | } | ||
| 1603 | char *rstring_prefix_end = in - 1; | ||
| 1604 | while (TRUE) | ||
| 1605 | { | ||
| 1606 | switch (GET (c)) | ||
| 1607 | { | ||
| 1608 | default: | ||
| 1609 | RSTRING_EOF_CHECK; | ||
| 1610 | break; | ||
| 1611 | case '\n': | ||
| 1612 | INCREMENT_LINENO; | ||
| 1613 | break; | ||
| 1614 | case ')': | ||
| 1615 | { | ||
| 1616 | char *in_saved = in; | ||
| 1617 | char *prefix = rstring_prefix_start; | ||
| 1618 | while (prefix != rstring_prefix_end && GET (c) == *prefix) | ||
| 1619 | { | ||
| 1620 | RSTRING_EOF_CHECK; | ||
| 1621 | prefix++; | ||
| 1622 | } | ||
| 1623 | if (prefix == rstring_prefix_end) | ||
| 1624 | { | ||
| 1625 | if (GET (c) == '"') | ||
| 1626 | return CSTRING; | ||
| 1627 | RSTRING_EOF_CHECK; | ||
| 1628 | } | ||
| 1629 | in = in_saved; | ||
| 1630 | } | ||
| 1631 | } | ||
| 1632 | } | ||
| 1633 | } | ||
| 1634 | |||
| 1635 | UNGET (); | ||
| 1636 | /* Fall through to identifiers and keywords. */ | ||
| 1637 | FALLTHROUGH; | ||
| 1577 | 1638 | ||
| 1578 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': | 1639 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': |
| 1579 | case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': | 1640 | case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': |
| @@ -1581,7 +1642,7 @@ yylex (void) | |||
| 1581 | case 'v': case 'w': case 'x': case 'y': case 'z': | 1642 | case 'v': case 'w': case 'x': case 'y': case 'z': |
| 1582 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': | 1643 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': |
| 1583 | case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': | 1644 | case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': |
| 1584 | case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': | 1645 | case 'O': case 'P': case 'Q': case 'S': case 'T': case 'U': |
| 1585 | case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': | 1646 | case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': |
| 1586 | { | 1647 | { |
| 1587 | /* Identifier and keywords. */ | 1648 | /* Identifier and keywords. */ |