* bug#46055: [PATCH] Add rust lang to etags @ 2021-01-23 19:01 Pierre-Antoine Rouby 2021-01-23 19:59 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Pierre-Antoine Rouby @ 2021-01-23 19:01 UTC (permalink / raw) To: 46055; +Cc: Pierre-Antoine Rouby * lib-src/etags.c (Rust_functions): New function to make tags for rust files. (Rust_help, Rust_suffixes): New constant. --- lib-src/etags.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/lib-src/etags.c b/lib-src/etags.c index b5c18e0e01..8243861c69 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -366,6 +366,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void Prolog_functions (FILE *); static void Python_functions (FILE *); static void Ruby_functions (FILE *); +static void Rust_functions (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -752,6 +753,12 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ static const char *Ruby_interpreters [] = { "ruby", NULL }; +static const char *Rust_suffixes [] = + { "rs", NULL }; +static const char Rust_help [] = + "In Rust code, tags anything defined with 'fn', 'enum', \n\ +'struct' or 'macro_rules!'."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -836,6 +843,7 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ NULL, Python_interpreters }, { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes, Ruby_filenames, Ruby_interpreters }, + { "rust", Rust_help, Rust_functions, Rust_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -5019,6 +5027,47 @@ Ruby_functions (FILE *inf) } } +\f +/* + * Rust support + * Look for: + * - fn: Function + * - struct: Structure + * - enum: Enumeration + * - macro_rules!: Macro + */ +static void +Rust_functions (FILE *inf) +{ + char *cp, *name; + + LOOP_ON_INPUT_LINES(inf, lb, cp) + { + cp = skip_spaces(cp); + name = cp; + + // Skip 'pub' keyworld + (void)LOOKING_AT (cp, "pub"); + + // Look for define + if (LOOKING_AT (cp, "fn") + || LOOKING_AT (cp, "enum") + || LOOKING_AT (cp, "struct") + || LOOKING_AT (cp, "macro_rules!")) + { + cp = skip_spaces (cp); + name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag (name, cp - name, true, + lb.buffer, cp - lb.buffer + 1, + lineno, linecharno); + } + } +} + \f /* * PHP support -- 2.29.2 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-23 19:01 bug#46055: [PATCH] Add rust lang to etags Pierre-Antoine Rouby @ 2021-01-23 19:59 ` Lars Ingebrigtsen 2021-01-23 20:23 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-01-23 19:59 UTC (permalink / raw) To: Pierre-Antoine Rouby; +Cc: 46055 Pierre-Antoine Rouby <contact@parouby.fr> writes: > * lib-src/etags.c (Rust_functions): New function to make tags for rust > files. > (Rust_help, Rust_suffixes): New constant. Thanks; looks good to me. This patch is too big to apply without an FSF copyright assignment, though. Would you be willing to sign such paperwork? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-23 19:59 ` Lars Ingebrigtsen @ 2021-01-23 20:23 ` Eli Zaretskii 2021-01-25 10:08 ` parouby 0 siblings, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-01-23 20:23 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: contact, 46055 > From: Lars Ingebrigtsen <larsi@gnus.org> > Date: Sat, 23 Jan 2021 20:59:56 +0100 > Cc: 46055@debbugs.gnu.org > > Pierre-Antoine Rouby <contact@parouby.fr> writes: > > > * lib-src/etags.c (Rust_functions): New function to make tags for rust > > files. > > (Rust_help, Rust_suffixes): New constant. > > Thanks; looks good to me. > > This patch is too big to apply without an FSF copyright assignment, > though. Would you be willing to sign such paperwork? Please don't forget to update etags.1 as well. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-23 20:23 ` Eli Zaretskii @ 2021-01-25 10:08 ` parouby 2021-01-25 10:09 ` Lars Ingebrigtsen ` (2 more replies) 0 siblings, 3 replies; 21+ messages in thread From: parouby @ 2021-01-25 10:08 UTC (permalink / raw) To: Eli Zaretskii, Lars Ingebrigtsen; +Cc: 46055 Hi, Thanks for review. On 23/01/2021 21:23, Eli Zaretskii wrote: >> From: Lars Ingebrigtsen <larsi@gnus.org> >> Date: Sat, 23 Jan 2021 20:59:56 +0100 >> Cc: 46055@debbugs.gnu.org >> >> Pierre-Antoine Rouby <contact@parouby.fr> writes: >> >>> * lib-src/etags.c (Rust_functions): New function to make tags for rust >>> files. >>> (Rust_help, Rust_suffixes): New constant. >> >> Thanks; looks good to me. >> >> This patch is too big to apply without an FSF copyright assignment, >> though. Would you be willing to sign such paperwork? Yes, no problem, who can I sign it ? > Please don't forget to update etags.1 as well. Ok, I have update 'etags.1' and 'maintaining.texi'. Updated patch coming soon. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 10:08 ` parouby @ 2021-01-25 10:09 ` Lars Ingebrigtsen 2021-04-21 3:19 ` Stefan Kangas 2021-01-25 10:15 ` Pierre-Antoine Rouby 2021-01-25 14:33 ` Pierre-Antoine Rouby 2 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-01-25 10:09 UTC (permalink / raw) To: parouby; +Cc: 46055 parouby <contact@parouby.fr> writes: >>> This patch is too big to apply without an FSF copyright assignment, >>> though. Would you be willing to sign such paperwork? > > Yes, no problem, who can I sign it ? Great; here's the form to get started: Please email the following information to assign@gnu.org, and we will send you the assignment form for your past and future changes. Please use your full legal name (in ASCII characters) as the subject line of the message. ---------------------------------------------------------------------- REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES [What is the name of the program or package you're contributing to?] Emacs [Did you copy any files or text written by someone else in these changes? Even if that material is free software, we need to know about it.] [Do you have an employer who might have a basis to claim to own your changes? Do you attend a school which might make such a claim?] [For the copyright registration, what country are you a citizen of?] [What year were you born?] [Please write your email address here.] [Please write your postal address here.] [Which files have you changed so far, and which new files have you written so far?] ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 10:09 ` Lars Ingebrigtsen @ 2021-04-21 3:19 ` Stefan Kangas 2021-04-21 8:54 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Stefan Kangas @ 2021-04-21 3:19 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: parouby, 46055 Lars Ingebrigtsen <larsi@gnus.org> writes: > parouby <contact@parouby.fr> writes: > >>>> This patch is too big to apply without an FSF copyright assignment, >>>> though. Would you be willing to sign such paperwork? >> >> Yes, no problem, who can I sign it ? > > Great; here's the form to get started: That was 12 weeks ago. Is this copyright assignment all processed and finished now? ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-04-21 3:19 ` Stefan Kangas @ 2021-04-21 8:54 ` Eli Zaretskii 0 siblings, 0 replies; 21+ messages in thread From: Eli Zaretskii @ 2021-04-21 8:54 UTC (permalink / raw) To: Stefan Kangas; +Cc: larsi, contact, 46055 > From: Stefan Kangas <stefan@marxist.se> > Date: Tue, 20 Apr 2021 22:19:52 -0500 > Cc: parouby <contact@parouby.fr>, Eli Zaretskii <eliz@gnu.org>, 46055@debbugs.gnu.org > > >>>> This patch is too big to apply without an FSF copyright assignment, > >>>> though. Would you be willing to sign such paperwork? > >> > >> Yes, no problem, who can I sign it ? > > > > Great; here's the form to get started: > > That was 12 weeks ago. Is this copyright assignment all processed and > finished now? Yes, the assignment is on file now. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 10:08 ` parouby 2021-01-25 10:09 ` Lars Ingebrigtsen @ 2021-01-25 10:15 ` Pierre-Antoine Rouby 2021-01-25 14:33 ` Pierre-Antoine Rouby 2 siblings, 0 replies; 21+ messages in thread From: Pierre-Antoine Rouby @ 2021-01-25 10:15 UTC (permalink / raw) To: 46055; +Cc: Pierre-Antoine Rouby * lib-src/etags.c (Rust_functions): New function to make tags for rust files. (Rust_help, Rust_suffixes): New constant. * doc/emacs/maintaining.texi (Tag Syntax): Add Rust item. * doc/man/etags.1: Add Rust. --- doc/emacs/maintaining.texi | 4 ++++ doc/man/etags.1 | 2 +- lib-src/etags.c | 49 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 415815473e..0f96dc65d1 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -2639,6 +2639,10 @@ Tag Syntax @item In Ruby code, @code{def} or @code{class} or @code{module} at the beginning of a line generate a tag. Constants also generate tags. + +@item +In Rust code, tags anything defined with @code{fn}, @code{enum}, +@code{struct} or @code{macro_rules!}. @end itemize You can also generate tags based on regexp matching (@pxref{Etags diff --git a/doc/man/etags.1 b/doc/man/etags.1 index c5c15fb182..354f6ca88b 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 @@ -51,7 +51,7 @@ format understood by \&. Both forms of the program understand the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, Forth, Go, HTML, LaTeX, Emacs Lisp/Common Lisp, Lua, Makefile, Pascal, Perl, -Ruby, PHP, PostScript, Python, Prolog, Scheme and +Ruby, Rust, PHP, PostScript, Python, Prolog, Scheme and most assembler\-like syntaxes. Both forms read the files specified on the command line, and write a tag table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for diff --git a/lib-src/etags.c b/lib-src/etags.c index b5c18e0e01..8243861c69 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -366,6 +366,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void Prolog_functions (FILE *); static void Python_functions (FILE *); static void Ruby_functions (FILE *); +static void Rust_functions (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -752,6 +753,12 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ static const char *Ruby_interpreters [] = { "ruby", NULL }; +static const char *Rust_suffixes [] = + { "rs", NULL }; +static const char Rust_help [] = + "In Rust code, tags anything defined with 'fn', 'enum', \n\ +'struct' or 'macro_rules!'."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -836,6 +843,7 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ NULL, Python_interpreters }, { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes, Ruby_filenames, Ruby_interpreters }, + { "rust", Rust_help, Rust_functions, Rust_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -5019,6 +5027,47 @@ Ruby_functions (FILE *inf) } } +\f +/* + * Rust support + * Look for: + * - fn: Function + * - struct: Structure + * - enum: Enumeration + * - macro_rules!: Macro + */ +static void +Rust_functions (FILE *inf) +{ + char *cp, *name; + + LOOP_ON_INPUT_LINES(inf, lb, cp) + { + cp = skip_spaces(cp); + name = cp; + + // Skip 'pub' keyworld + (void)LOOKING_AT (cp, "pub"); + + // Look for define + if (LOOKING_AT (cp, "fn") + || LOOKING_AT (cp, "enum") + || LOOKING_AT (cp, "struct") + || LOOKING_AT (cp, "macro_rules!")) + { + cp = skip_spaces (cp); + name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag (name, cp - name, true, + lb.buffer, cp - lb.buffer + 1, + lineno, linecharno); + } + } +} + \f /* * PHP support -- 2.29.2 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 10:08 ` parouby 2021-01-25 10:09 ` Lars Ingebrigtsen 2021-01-25 10:15 ` Pierre-Antoine Rouby @ 2021-01-25 14:33 ` Pierre-Antoine Rouby 2021-04-21 12:39 ` Stefan Kangas 2021-05-17 15:21 ` Lars Ingebrigtsen 2 siblings, 2 replies; 21+ messages in thread From: Pierre-Antoine Rouby @ 2021-01-25 14:33 UTC (permalink / raw) To: 46055; +Cc: larsi, Pierre-Antoine Rouby * lib-src/etags.c (Rust_functions): New function to make tags for rust files. (Rust_help, Rust_suffixes): New constant. * doc/emacs/maintaining.texi (Tag Syntax): Add Rust item. * doc/man/etags.1: Add Rust. --- doc/emacs/maintaining.texi | 4 +++ doc/man/etags.1 | 2 +- lib-src/etags.c | 51 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 415815473e..0f96dc65d1 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -2639,6 +2639,10 @@ Tag Syntax @item In Ruby code, @code{def} or @code{class} or @code{module} at the beginning of a line generate a tag. Constants also generate tags. + +@item +In Rust code, tags anything defined with @code{fn}, @code{enum}, +@code{struct} or @code{macro_rules!}. @end itemize You can also generate tags based on regexp matching (@pxref{Etags diff --git a/doc/man/etags.1 b/doc/man/etags.1 index c5c15fb182..354f6ca88b 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 @@ -51,7 +51,7 @@ format understood by \&. Both forms of the program understand the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, Forth, Go, HTML, LaTeX, Emacs Lisp/Common Lisp, Lua, Makefile, Pascal, Perl, -Ruby, PHP, PostScript, Python, Prolog, Scheme and +Ruby, Rust, PHP, PostScript, Python, Prolog, Scheme and most assembler\-like syntaxes. Both forms read the files specified on the command line, and write a tag table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for diff --git a/lib-src/etags.c b/lib-src/etags.c index b5c18e0e01..d703183cef 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -366,6 +366,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void Prolog_functions (FILE *); static void Python_functions (FILE *); static void Ruby_functions (FILE *); +static void Rust_entries (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -752,6 +753,12 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ static const char *Ruby_interpreters [] = { "ruby", NULL }; +static const char *Rust_suffixes [] = + { "rs", NULL }; +static const char Rust_help [] = + "In Rust code, tags anything defined with 'fn', 'enum', \n\ +'struct' or 'macro_rules!'."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -836,6 +843,7 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ NULL, Python_interpreters }, { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes, Ruby_filenames, Ruby_interpreters }, + { "rust", Rust_help, Rust_entries, Rust_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -5019,6 +5027,49 @@ Ruby_functions (FILE *inf) } } +\f +/* + * Rust support + * Look for: + * - fn: Function + * - struct: Structure + * - enum: Enumeration + * - macro_rules!: Macro + */ +static void +Rust_entries (FILE *inf) +{ + char *cp, *name; + bool is_func = false; + + LOOP_ON_INPUT_LINES(inf, lb, cp) + { + cp = skip_spaces(cp); + name = cp; + + // Skip 'pub' keyworld + (void)LOOKING_AT (cp, "pub"); + + // Look for define + if ((is_func = LOOKING_AT (cp, "fn")) + || LOOKING_AT (cp, "enum") + || LOOKING_AT (cp, "struct") + || (is_func = LOOKING_AT (cp, "macro_rules!"))) + { + cp = skip_spaces (cp); + name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag (name, cp - name, is_func, + lb.buffer, cp - lb.buffer + 1, + lineno, linecharno); + is_func = false; + } + } +} + \f /* * PHP support -- 2.29.2 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 14:33 ` Pierre-Antoine Rouby @ 2021-04-21 12:39 ` Stefan Kangas 2021-04-21 15:02 ` Francesco Potortì 2021-05-17 15:21 ` Lars Ingebrigtsen 1 sibling, 1 reply; 21+ messages in thread From: Stefan Kangas @ 2021-04-21 12:39 UTC (permalink / raw) To: Pierre-Antoine Rouby; +Cc: larsi, 46055 Your patch looks good to me, but I didn't test it. I have one question, though. In "test/manual/etags", we have manual tests for etags including source code examples and which tags they should generate. Should we add a manual test also for Rust? Pierre-Antoine Rouby <contact@parouby.fr> writes: > * lib-src/etags.c (Rust_functions): New function to make tags for rust > files. > (Rust_help, Rust_suffixes): New constant. > * doc/emacs/maintaining.texi (Tag Syntax): Add Rust item. > * doc/man/etags.1: Add Rust. > --- > doc/emacs/maintaining.texi | 4 +++ > doc/man/etags.1 | 2 +- > lib-src/etags.c | 51 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 56 insertions(+), 1 deletion(-) > > diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi > index 415815473e..0f96dc65d1 100644 > --- a/doc/emacs/maintaining.texi > +++ b/doc/emacs/maintaining.texi > @@ -2639,6 +2639,10 @@ Tag Syntax > @item > In Ruby code, @code{def} or @code{class} or @code{module} at the > beginning of a line generate a tag. Constants also generate tags. > + > +@item > +In Rust code, tags anything defined with @code{fn}, @code{enum}, > +@code{struct} or @code{macro_rules!}. > @end itemize > > You can also generate tags based on regexp matching (@pxref{Etags > diff --git a/doc/man/etags.1 b/doc/man/etags.1 > index c5c15fb182..354f6ca88b 100644 > --- a/doc/man/etags.1 > +++ b/doc/man/etags.1 > @@ -51,7 +51,7 @@ format understood by > \&. Both forms of the program understand > the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, > Forth, Go, HTML, LaTeX, Emacs Lisp/Common Lisp, Lua, Makefile, Pascal, Perl, > -Ruby, PHP, PostScript, Python, Prolog, Scheme and > +Ruby, Rust, PHP, PostScript, Python, Prolog, Scheme and > most assembler\-like syntaxes. > Both forms read the files specified on the command line, and write a tag > table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for > diff --git a/lib-src/etags.c b/lib-src/etags.c > index b5c18e0e01..d703183cef 100644 > --- a/lib-src/etags.c > +++ b/lib-src/etags.c > @@ -366,6 +366,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) > static void Prolog_functions (FILE *); > static void Python_functions (FILE *); > static void Ruby_functions (FILE *); > +static void Rust_entries (FILE *); > static void Scheme_functions (FILE *); > static void TeX_commands (FILE *); > static void Texinfo_nodes (FILE *); > @@ -752,6 +753,12 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ > static const char *Ruby_interpreters [] = > { "ruby", NULL }; > > +static const char *Rust_suffixes [] = > + { "rs", NULL }; > +static const char Rust_help [] = > + "In Rust code, tags anything defined with 'fn', 'enum', \n\ > +'struct' or 'macro_rules!'."; > + > /* Can't do the `SCM' or `scm' prefix with a version number. */ > static const char *Scheme_suffixes [] = > { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; > @@ -836,6 +843,7 @@ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ > NULL, Python_interpreters }, > { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes, > Ruby_filenames, Ruby_interpreters }, > + { "rust", Rust_help, Rust_entries, Rust_suffixes }, > { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, > { "tex", TeX_help, TeX_commands, TeX_suffixes }, > { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, > @@ -5019,6 +5027,49 @@ Ruby_functions (FILE *inf) > } > } > > +\f > +/* > + * Rust support > + * Look for: > + * - fn: Function > + * - struct: Structure > + * - enum: Enumeration > + * - macro_rules!: Macro > + */ > +static void > +Rust_entries (FILE *inf) > +{ > + char *cp, *name; > + bool is_func = false; > + > + LOOP_ON_INPUT_LINES(inf, lb, cp) > + { > + cp = skip_spaces(cp); > + name = cp; > + > + // Skip 'pub' keyworld > + (void)LOOKING_AT (cp, "pub"); > + > + // Look for define > + if ((is_func = LOOKING_AT (cp, "fn")) > + || LOOKING_AT (cp, "enum") > + || LOOKING_AT (cp, "struct") > + || (is_func = LOOKING_AT (cp, "macro_rules!"))) > + { > + cp = skip_spaces (cp); > + name = cp; > + > + while (!notinname (*cp)) > + cp++; > + > + make_tag (name, cp - name, is_func, > + lb.buffer, cp - lb.buffer + 1, > + lineno, linecharno); > + is_func = false; > + } > + } > +} > + > \f > /* > * PHP support ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-04-21 12:39 ` Stefan Kangas @ 2021-04-21 15:02 ` Francesco Potortì 2021-05-17 15:23 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Francesco Potortì @ 2021-04-21 15:02 UTC (permalink / raw) To: Stefan Kangas; +Cc: larsi, Pierre-Antoine Rouby, 46055 >I have one question, though. In "test/manual/etags", we have manual >tests for etags including source code examples and which tags they >should generate. Should we add a manual test also for Rust? I'd say definitely yes. Ideally, the regression tests should be updated every time a new feature is added or a bug is corrected. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-04-21 15:02 ` Francesco Potortì @ 2021-05-17 15:23 ` Lars Ingebrigtsen 2021-05-17 15:51 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-17 15:23 UTC (permalink / raw) To: Francesco Potortì; +Cc: Stefan Kangas, Pierre-Antoine Rouby, 46055 Francesco Potortì <pot@gnu.org> writes: >>I have one question, though. In "test/manual/etags", we have manual >>tests for etags including source code examples and which tags they >>should generate. Should we add a manual test also for Rust? > > I'd say definitely yes. Ideally, the regression tests should be updated > every time a new feature is added or a bug is corrected. I looked into adding a Rust test there... but it's unclear how, or what it's checking. A "make check" in that directory fails. I looked in admin/* for an explanation of what's supposed to be done in test/manual/etags, but found nothing. Perhaps a README should be added to that directory to explain how to use it? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 15:23 ` Lars Ingebrigtsen @ 2021-05-17 15:51 ` Eli Zaretskii 2021-05-17 16:08 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-05-17 15:51 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: stefan, contact, 46055 > From: Lars Ingebrigtsen <larsi@gnus.org> > Date: Mon, 17 May 2021 17:23:44 +0200 > Cc: Stefan Kangas <stefan@marxist.se>, > Pierre-Antoine Rouby <contact@parouby.fr>, 46055@debbugs.gnu.org > > Francesco Potortì <pot@gnu.org> writes: > > >>I have one question, though. In "test/manual/etags", we have manual > >>tests for etags including source code examples and which tags they > >>should generate. Should we add a manual test also for Rust? > > > > I'd say definitely yes. Ideally, the regression tests should be updated > > every time a new feature is added or a bug is corrected. > > I looked into adding a Rust test there... but it's unclear how, or what > it's checking. A "make check" in that directory fails. I looked in > admin/* for an explanation of what's supposed to be done in > test/manual/etags, but found nothing. > > Perhaps a README should be added to that directory to explain how to use > it? Just say "make" in that directory, it should finish with no errors. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 15:51 ` Eli Zaretskii @ 2021-05-17 16:08 ` Lars Ingebrigtsen 2021-05-17 16:14 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-17 16:08 UTC (permalink / raw) To: Eli Zaretskii; +Cc: stefan, contact, 46055 Eli Zaretskii <eliz@gnu.org> writes: > Just say "make" in that directory, it should finish with no errors. If I do that, I get an enormous diff in the terminal, and it then finishes with: y-src/parse.c,520 #define YYBISON 4,64 make[1]: *** [Makefile:63: ediff_1] Error 1 make[1]: Leaving directory '/home/larsi/src/emacs/trunk/test/manual/etags' make: *** [Makefile:54: check] Error 2 -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 16:08 ` Lars Ingebrigtsen @ 2021-05-17 16:14 ` Eli Zaretskii 2021-05-17 16:27 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-05-17 16:14 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: stefan, contact, 46055 > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: pot@gnu.org, stefan@marxist.se, contact@parouby.fr, > 46055@debbugs.gnu.org > Date: Mon, 17 May 2021 18:08:09 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > Just say "make" in that directory, it should finish with no errors. > > If I do that, I get an enormous diff in the terminal, and it then > finishes with: > > y-src/parse.c,520 > #define YYBISON 4,64 > make[1]: *** [Makefile:63: ediff_1] Error 1 > make[1]: Leaving directory '/home/larsi/src/emacs/trunk/test/manual/etags' > make: *** [Makefile:54: check] Error 2 Try again, I just fixed this. The problem is that people make mechanic changes to all our sources, and forget that files in this particular directory shall NOT be changed, or else if they are, the '*good*' files with expected results should be updated at that very moment. Examples of such changes include: yearly update of copyright years, removal of obsolete variables across the board, spelling fixes, etc. Just do git log test/manual/etags/c-src/abbrev.c and you will see what I mean. Each such change breaks this test suite, and requires manual inspection of the diffs to convince ourselves that the new results are correct and not bugs. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 16:14 ` Eli Zaretskii @ 2021-05-17 16:27 ` Lars Ingebrigtsen 2021-05-17 16:31 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-17 16:27 UTC (permalink / raw) To: Eli Zaretskii; +Cc: stefan, contact, 46055 Eli Zaretskii <eliz@gnu.org> writes: > The problem is that people make mechanic changes to all our sources, > and forget that files in this particular directory shall NOT be > changed, or else if they are, the '*good*' files with expected results > should be updated at that very moment. Examples of such changes > include: yearly update of copyright years, removal of obsolete > variables across the board, spelling fixes, etc. Just do > > git log test/manual/etags/c-src/abbrev.c > > and you will see what I mean. Yes, I was most puzzled when trying to find out just what was going on in that directory. I wondered whether the test cases were somehow... copying files from the main Emacs source directories (since many of them have the same names and are updated in this way). > Each such change breaks this test suite, and requires manual > inspection of the diffs to convince ourselves that the new results are > correct and not bugs. Yup. So I think a README to explain what's going on in that directory would be helpful. :-) I've now added a test case for Rust. (Note: I don't know Rust at all.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 16:27 ` Lars Ingebrigtsen @ 2021-05-17 16:31 ` Lars Ingebrigtsen 2021-05-17 16:40 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-17 16:31 UTC (permalink / raw) To: Eli Zaretskii; +Cc: stefan, contact, 46055 Lars Ingebrigtsen <larsi@gnus.org> writes: > I've now added a test case for Rust. I spoke too soon -- I guessed that ETAGS.good_1 was to be copied over from ETAGS after saying "make", but I have no idea what the other good_* files are supposed to be, so now "make" complains again. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 16:31 ` Lars Ingebrigtsen @ 2021-05-17 16:40 ` Eli Zaretskii 2021-05-18 13:44 ` Lars Ingebrigtsen 0 siblings, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-05-17 16:40 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: stefan, contact, 46055 > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: pot@gnu.org, stefan@marxist.se, contact@parouby.fr, > 46055@debbugs.gnu.org > Date: Mon, 17 May 2021 18:31:53 +0200 > > Lars Ingebrigtsen <larsi@gnus.org> writes: > > > I've now added a test case for Rust. > > I spoke too soon -- I guessed that ETAGS.good_1 was to be copied over > from ETAGS after saying "make", but I have no idea what the other good_* > files are supposed to be, so now "make" complains again. The test suite uses the same source files for 7 different runs, each time invoking etags with different command-line switches. So whenever you add a new source file, you need to run make, and each time it fails, copy the left-over ETAGS file into ETAGS.good_1, ETAGS.good_2, etc., one by one. Which I just did. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-17 16:40 ` Eli Zaretskii @ 2021-05-18 13:44 ` Lars Ingebrigtsen 2021-05-20 10:03 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-18 13:44 UTC (permalink / raw) To: Eli Zaretskii; +Cc: stefan, contact, 46055 Eli Zaretskii <eliz@gnu.org> writes: > The test suite uses the same source files for 7 different runs, each > time invoking etags with different command-line switches. So whenever > you add a new source file, you need to run make, and each time it > fails, copy the left-over ETAGS file into ETAGS.good_1, ETAGS.good_2, > etc., one by one. Ah, I see. Putting this info in a README in that directory would be helpful for the next person who wonders how it works, though. > Which I just did. Thanks. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-05-18 13:44 ` Lars Ingebrigtsen @ 2021-05-20 10:03 ` Eli Zaretskii 0 siblings, 0 replies; 21+ messages in thread From: Eli Zaretskii @ 2021-05-20 10:03 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: stefan, contact, 46055 > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: pot@gnu.org, stefan@marxist.se, contact@parouby.fr, > 46055@debbugs.gnu.org > Date: Tue, 18 May 2021 15:44:50 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > The test suite uses the same source files for 7 different runs, each > > time invoking etags with different command-line switches. So whenever > > you add a new source file, you need to run make, and each time it > > fails, copy the left-over ETAGS file into ETAGS.good_1, ETAGS.good_2, > > etc., one by one. > > Ah, I see. Putting this info in a README in that directory would be > helpful for the next person who wonders how it works, though. Done. ^ permalink raw reply [flat|nested] 21+ messages in thread
* bug#46055: [PATCH] Add rust lang to etags 2021-01-25 14:33 ` Pierre-Antoine Rouby 2021-04-21 12:39 ` Stefan Kangas @ 2021-05-17 15:21 ` Lars Ingebrigtsen 1 sibling, 0 replies; 21+ messages in thread From: Lars Ingebrigtsen @ 2021-05-17 15:21 UTC (permalink / raw) To: Pierre-Antoine Rouby; +Cc: 46055 Pierre-Antoine Rouby <contact@parouby.fr> writes: > * lib-src/etags.c (Rust_functions): New function to make tags for rust > files. > (Rust_help, Rust_suffixes): New constant. > * doc/emacs/maintaining.texi (Tag Syntax): Add Rust item. > * doc/man/etags.1: Add Rust. Thanks; applied to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2021-05-20 10:03 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-01-23 19:01 bug#46055: [PATCH] Add rust lang to etags Pierre-Antoine Rouby 2021-01-23 19:59 ` Lars Ingebrigtsen 2021-01-23 20:23 ` Eli Zaretskii 2021-01-25 10:08 ` parouby 2021-01-25 10:09 ` Lars Ingebrigtsen 2021-04-21 3:19 ` Stefan Kangas 2021-04-21 8:54 ` Eli Zaretskii 2021-01-25 10:15 ` Pierre-Antoine Rouby 2021-01-25 14:33 ` Pierre-Antoine Rouby 2021-04-21 12:39 ` Stefan Kangas 2021-04-21 15:02 ` Francesco Potortì 2021-05-17 15:23 ` Lars Ingebrigtsen 2021-05-17 15:51 ` Eli Zaretskii 2021-05-17 16:08 ` Lars Ingebrigtsen 2021-05-17 16:14 ` Eli Zaretskii 2021-05-17 16:27 ` Lars Ingebrigtsen 2021-05-17 16:31 ` Lars Ingebrigtsen 2021-05-17 16:40 ` Eli Zaretskii 2021-05-18 13:44 ` Lars Ingebrigtsen 2021-05-20 10:03 ` Eli Zaretskii 2021-05-17 15:21 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.