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

Update the docs: extending.rst and optlib.rst sections #1826

Merged
merged 1 commit into from
Sep 15, 2018

Conversation

hadrielk
Copy link
Contributor

This is a first pass at updating the optlib.rst doc (and minor stuff for extending.rst).
There's still more to do, but I thought this is a big enough change to get some feedback on.
There are also a few open questions I had, which I added as comments in optlib.rst, marked .. Q:.
Feedback would be great. Even if it's: "this is crap".

@masatake masatake self-requested a review August 14, 2018 06:16
@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.433% when pulling b40096f on hadrielk:hadriel/docs-optlib into a0206b0 on universal-ctags:master.

@hadrielk
Copy link
Contributor Author

Any comments/issues with this PR? If not I'd like to merge it in. (I have more things to add to optlib.rst but don't want a conflict with this PR)

@masatake
Copy link
Member

Could you wait till next week?

@hadrielk
Copy link
Contributor Author

Could you wait till next week?

Sure, of course.

@masatake
Copy link
Member

I will concentrate on this important PR.

Copy link
Member

@masatake masatake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for updating this document.
I have one request. I don't remove the sentence about the cork API.

I wonder why you put python and/or perl after .. code-block::. I don't want to use it just for highlighting regex patterns.

I'm thinking about extending rst parser to run another parser inside code blocks.
If we use .. code-block::ctags, the rst parser can schedule to run ctags optlib parser to the blocks.

Anyway, thank again.

passed in command line.

Following file is an example of option file.

.. code-block::
.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why python?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember for this particular code block, but I generated the HTML for each of them while trying various highlighters sphinx/pygment/whatever has built-in support for, and picked the ones that looked the best.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember now - when you build the docs into html, you get warnings if the code-block language highlighting fails. For this particular code block, perl failed but python worked while still looking ok.

@@ -81,98 +103,101 @@ Quoted from man page of Exuberant-ctags::
use new lines to indicate separate command-line
arguments.

Let me explain the differences and their intentions.
What follows explains the differences and their intentions...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder ... is needed here. Just . is not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a single dot . is enough - using three is less formal, and not necessary.

e extend
i icase
=========== ===========
.. code-block:: perl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use perl here?
For highlighting the regex patterns?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows fairly nicely in the generated HTML.


NOTE: Giving a scope long flag implies setting `useCork` of the parser
to `TRUE`. See `cork API`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could keep the above sentence about cork ?
I think the sentence helps a developer understand u-ctags internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But an optlib developer (i.e., a person who creates optlib files) does not need to know anything about it, and will be confused why they should care. I mean it's just an internal implementation detail, like setting the parserDefinition.method flag METHOD_REGEX. No?

This is an example of something that confused me when reading the doc the first time: who's the target audience? Is it general users of ctags and authors of optlib files, or is it for C-code developers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I have not written well as I expect, this document is for rather C-code developers.

I assume optlib developers (== general users) read ctags-optlib.7 man page.
I will write more about this topic in #1835.


.. Q: this was fixed in https://github.com/universal-ctags/ctags/pull/331
so can we remove this section?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can remove this section because I wrote this to man/ctags-incompatibilities.7.rst.in.
I marked .. IN MAN PAGE when I wrote the topic to our man pages.
In the case, we can remove it. I planed removing all the marked topic when releasing 6.0.
However, you can remove some of them now.

That name seems like an internal detail. Users of ctags never see that
name anywhere except in these docs, and it's weird. How about
"specified" option files, or "requested" or some such? (i.e., the file
is explicitly specified or requested when ctags is run)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

The idea behind the term "optlib" is written at the head of man/ctags-optlib.7.rst.in.


.. Q: why even discuss the single-character version of the flags? Just
make everyone use the long form.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have strong reason.
The single character version (letter version) like i may be still used by users.
It is still useful if a flag is still appears frequently in a .ctags file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......................................................................

.. Q: what is the point of documenting this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this section.

start position of the whole regex pattern). You do not need to add it for
the multi-table ``--_mtable-regex-<LANG>``.

.. Q: isn't the above restriction really a bug? I think it is. I should fix it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks a bug.
Can I ask you to open an issue with an example (or .b unit test).


.. Q: this was previously titled "Byte oriented pattern matching...", presumably
because it "matched against the input at the current byte position, not line".
But that's also true for --mline-regex-<LANG>, as far as I can tell.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I agree.

@hadrielk
Copy link
Contributor Author

hadrielk commented Sep 2, 2018

I wonder why you put python and/or perl after .. code-block::. I don't want to use it just for highlighting regex patterns.

Yes it was mostly for highlighting the regex, but also it makes the # comments look like comments (makes them light gray), and generally looks better than nothing. (I even use perl syntax highlighting for .ctags files I edit, in my editor)
Oh, and it got rid of warning messages generated when you build the docs.

I'm thinking about extending rst parser to run another parser inside code blocks. If we use .. code-block::ctags, the rst parser can schedule to run ctags optlib parser to the blocks

Yes, a pygment or whatever parser for ctags optlib format in rst files would be really nice!

@masatake
Copy link
Member

masatake commented Sep 3, 2018

I will make a reply for #1835 first.

@masatake
Copy link
Member

masatake commented Sep 3, 2018

@hadrielk, could make a separated commit for changing the .. code-block: lines?
So we can know the intention of the change.

@masatake
Copy link
Member

Though I made some comments, I will merge this; the change makes the document much better.

@masatake masatake merged commit 6912b52 into universal-ctags:master Sep 15, 2018
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants