Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tex: parse some more latex macros #3239

Merged
merged 7 commits into from
Dec 30, 2021
Merged

Conversation

techee
Copy link
Contributor

@techee techee commented Dec 27, 2021

In addition to the macros already parsed, the old Geany readline-based parser also parses the following latex macros which may be useful:

  • \renewcommand, \providecommand
  • tex \def\cmd{param}
  • \DeclareMathOperator
  • \newenvironment, \renewenvironment
  • \newtheorem

This pul request adds these and introduces the corresponding kinds for them.

@codecov
Copy link

codecov bot commented Dec 27, 2021

Codecov Report

Merging #3239 (c6cbaf9) into master (05e6ab4) will decrease coverage by 0.03%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3239      +/-   ##
==========================================
- Coverage   85.01%   84.98%   -0.04%     
==========================================
  Files         206      207       +1     
  Lines       49127    49324     +197     
==========================================
+ Hits        41765    41916     +151     
- Misses       7362     7408      +46     
Impacted Files Coverage Δ
parsers/tex.c 97.47% <93.93%> (-0.32%) ⬇️
optlib/man.c 0.00% <0.00%> (ø)
parsers/gemspec.c 98.71% <0.00%> (ø)
parsers/asm.c 99.32% <0.00%> (+0.04%) ⬆️
parsers/fortran.c 93.62% <0.00%> (+0.08%) ⬆️
main/lregex.c 83.19% <0.00%> (+0.11%) ⬆️
parsers/ruby.c 98.22% <0.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05e6ab4...c6cbaf9. Read the comment docs.

@masatake masatake changed the title Parse some more latex macros Tex: parse some more latex macros Dec 27, 2021
@masatake
Copy link
Member

masatake commented Dec 28, 2021

I took much time to design TexParseStrategy. So I’m glad that one other than I utilizes the data type.

Could you split dc57692 smaller ones as I wrote in #3236 (comment) ?
Could you use Tex as the common prefix for the headers of the commits that changes the parser?
If you made a stand-alone commit changing or adding a test case, please use Units(Tex) as prefix in the header for the commit.

Units(Tex): add unit tests for the newly introduced kinds
Tex: fix TEX_NAME_FLAG_OPTIONAL for the last macro parameter
Tex: parse \newtheorem
Tex: parse \newenvironment and \renewenvironment
Tex: parse \DeclareMathOperator{cmd}{def}
Tex: parse \def\cmd{replacement}
Tex: add \renewcommand and \providecommand

When the last parameter is optional and not present, the token is
already read by parseWithStrategy() but this token is not reported
to the caller as unprocessed which may cause missed tag for the following
macro.
Macros like \newcommand can be written both as

\newcommand{\foo}{bar}

and

\newcommand\foo{bar}

Unify \def parsing and \newcommand parsing so that when strategy type
is defined as '\\', the {} pair may or may not be present.
@techee
Copy link
Contributor Author

techee commented Dec 29, 2021

@masatake Done.

@masatake masatake merged commit de1f594 into universal-ctags:master Dec 30, 2021
@masatake
Copy link
Member

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants