Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 14 Jun 2015 16:25:38 UTC Commit: dbbc042786e7d78e16a7b63dc2fd58cae0fab8f1 https://github.com/geany/geany/commit/dbbc042786e7d78e16a7b63dc2fd58cae0fab8...
Log Message: ----------- c family: Add support for digraphs
See http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf 6.4.6§3.
Note: This is not exactly the upstream Universal CTags commit because it depends on another change for adding the `enter` label, which was then included here.
X-Universal-CTags-Commit-ID: 3b3b60c7664a321a31ec87de336fc6bda90c405e
Modified Paths: -------------- tagmanager/ctags/get.c tests/ctags/Makefile.am tests/ctags/c-digraphs.c tests/ctags/c-digraphs.c.tags
Modified: tagmanager/ctags/get.c 37 lines changed, 37 insertions(+), 0 deletions(-) =================================================================== @@ -680,6 +680,42 @@ extern int cppGetc (void) } } break;
+ /* digraphs: + * input: <: :> <% %> %: %:%: + * output: [ ] { } # ## + */ + case '<': + { + int next = fileGetc (); + switch (next) + { + case ':': c = '['; break; + case '%': c = '{'; break; + default: fileUngetc (next); + } + goto enter; + } + case ':': + { + int next = fileGetc (); + if (next == '>') + c = ']'; + else + fileUngetc (next); + goto enter; + } + case '%': + { + int next = fileGetc (); + switch (next) + { + case '>': c = '}'; break; + case ':': c = '#'; goto process; + default: fileUngetc (next); + } + goto enter; + } + default: if (c == '@' && Cpp.hasAtLiteralStrings) { @@ -691,6 +727,7 @@ extern int cppGetc (void) break; } } + enter: Cpp.directive.accept = FALSE; if (directive) ignore = handleDirective (c);
Modified: tests/ctags/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -108,6 +108,7 @@ test_sources = \ bug960316.v \ bug961001.v \ byte.f \ + c-digraphs.c \ c-trigraphs.c \ case_sensitivity.php \ char-selector.f90 \
Modified: tests/ctags/c-digraphs.c 35 lines changed, 35 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,35 @@ + +/* simple trigraphs */ +%:define A 1 +%:define B 2 +%:define STRINGIFY_INTERN(x) %:x +%:define STRINGIFY(x) STRINGIFY_INTERN(x) + +%:define M3_INIT(a, b, c) <% a, b, c %> +typedef int matrix3<:3:>; + +struct str <% + char *buf; + unsigned int len, size; +%>; + +int main(void) +<% + const char *hello = STRINGIFY(hello); + matrix3 m = M3_INIT(1, 2, 3); + + return m<:2:>; +%> + +%:if 0 +#define bug4 +%:endif + + +/* test the same with untaken preprocessor paths (as they are then not read by + * the C parser but get.c) */ +#if 0 +%:define if0d_A 1 +%:define if0d_B 2 +#endif +
Modified: tests/ctags/c-digraphs.c.tags 12 lines changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,12 @@ +# format=tagmanager +A�65536�0 +B�65536�0 +M3_INIT�131072�(a, b, c)�0 +STRINGIFY�131072�(x)�0 +STRINGIFY_INTERN�131072�(x)�0 +buf�64�str�0�char +len�64�str�0�int +main�16�(void)�0�int +matrix3�4096�0�int +size�64�str�0�int +str�2048�0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).