Nothing Special   »   [go: up one dir, main page]

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

WIP: Add C doxygen format #27

Closed
wants to merge 6 commits into from
Closed

WIP: Add C doxygen format #27

wants to merge 6 commits into from

Conversation

vigoux
Copy link
Contributor
@vigoux vigoux commented Jul 22, 2019

Why this PR?

C doxygen format is not yet supported, so this PR is to add support for it.
This is an early WIP PR just to keep track of the progress

@@ -13,7 +13,7 @@ let b:doge_supported_doc_standards = ['doxygen']
let b:doge_doc_standard = get(g:, 'doge_doc_standard_cpp', b:doge_supported_doc_standards[0])
if index(b:doge_supported_doc_standards, b:doge_doc_standard) < 0
echoerr printf(
\ '[DoGe] %s is not a valid Kotlin doc standard, available doc standard are: %s',
Copy link
Owner

Choose a reason for hiding this comment

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

Hah, didn't even notice this one. I'll fix it later this day as well that Kotlin will be replaced with C++.

@kkoomen kkoomen changed the title [WIP] Add C doxygen format WIP: Add C doxygen format Jul 22, 2019
@kkoomen
Copy link
Owner
kkoomen commented Jul 22, 2019

@vigoux make sure the playground file contains all possible scenarios. I recommend you first gather all the possible scenarios and then write the regex part. You can't write regex if you don't know what your input is.

Also, make sure to read the contribution guideline very well.

@vigoux
Copy link
Contributor Author
vigoux commented Jul 22, 2019

I have some problem extracting parameters, how should i do ?
I'm going to complete playground and add tests afterwards

@kkoomen
Copy link
Owner
kkoomen commented Jul 22, 2019

Are you familiar with vim regex? Because I suggest you add the playground scenarios and I'll write the regex and tests. I'm fast at it.

Make sure to use a lot of unique scenarios.

@vigoux
Copy link
Contributor Author
vigoux commented Jul 22, 2019

@kkoomen, i finaly wrapped my head around it i'm fine doing this (practicing à little and i'll be fine)

@vigoux
Copy link
Contributor Author
vigoux commented Jul 22, 2019

This version is finaly working, i'm going to search for more examples later this day

@kkoomen
Copy link
Owner
kkoomen commented Jul 22, 2019

@vigoux From 1 to 10, how would you rate your regex knowledge? Since writing proper regex can be quite difficult. Also, the amount of steps it should take for your regex to be evaluated should be as low as possible. Maybe try to use https://regex101.com to just write in PCRE with some input and then convert to vim regex afterwards. I've worked like that until I knew how to write proper vim regex with an instant.

If you're done, let me know. I'll review your regex.

@vigoux
Copy link
Contributor Author
vigoux commented Jul 22, 2019

I would say 6, i've used regex101 before, and for the c ftplugin.
I also manipulated your regexs to know how you extraxt everithing.
Those that i have written are working on the example in the playground
I'll write tests afterwards
I think i'm approximately done, you can review them and point out the problems, i'll fix them later

@@ -1,5 +1,5 @@
" ==============================================================================
" The C++ documentation should follow the 'Doxygen' conventions.
" The C documentation should follow the 'Doxygen' conventions.
Copy link
Owner

Choose a reason for hiding this comment

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

This should be C++.

@kkoomen
Copy link
Owner
kkoomen commented Jul 22, 2019

@vigoux You are by far not done. I know C, there are plenty of use cases you didn't cover. Also, your work is very sloppy. You did not update any comments in the code which should correspond to the C language.

Copy link
Owner
@kkoomen kkoomen left a comment

Choose a reason for hiding this comment

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

If you can't implement C, just let me know, instead of working sloppy. Setup a good playground of all possible scenarios you can expect in C of a function.

Look at your own PR before submitting it. I am correcting things you can easily check by yourself.

Implementing C at least takes 2 full days. A single day if you know the ins and outs of the language. If you don't want to spent 2 full days implementing it, just remove your PR and make an issue for it. I'll implement it quickly.

Browse through the linux repository. They use a lot of advanced C notation you should definitely use in your playground.

\ 'match': s:parameters_match_pattern,
\ 'match_group_names': ['name'],
\ 'format': {
\ 'doxygen': '@param {name} [TODO:description]',
Copy link
Owner

Choose a reason for hiding this comment

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

When doing contributions, make sure to read the contribution guidelines. Please read more about placeholders and have a look at the C++ file.

NOTE: The C++ got updated. This was my bad. It had raw [TODO:description], but instead should be !description. You should use this as well. Please pull from master so that you're up-to-date.

" template<typename T, typename... Args>
" static T* create(Args&& ... args) {}
call add(b:doge_patterns, {
\ 'match': '\m^\(\%(\%(static\|extern\|[[:alnum:]_]\+\|\**\)[[:space:]_]\?\)\+\)(\(.\{-}\))\s*[;{]',
Copy link
Owner
@kkoomen kkoomen Jul 22, 2019

Choose a reason for hiding this comment

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

\%(static\|extern\|[[:alnum:]_]\+\|\**\)

This is very weird. You should explicitly name the keyword you can expect in front of a function, not just [[:alnum:]_]\+ at random. \**\ is wrong as well and shouldn't even be used. It just doesn't makes sense.

Looking at your playground you only have this structure: <return-type> <func-name>(<func-params>), so your regex shoud atleast be this:

If I look at the this example in the linux repository, I should write this:

\m^\%(\%(static\|inline\)\s\+\)*\([[:alnum:]_]\+\)\s\+\([[:alnum:]_]\+\)\s*(\(.\{-}\))\s*[;{]. Something you can use within vim to test regex would be :h matchlist.

Browse through the linux repository. They use a lot of advanced C notation you should definitely use in your playground. I did mention you should first setup your playground, then write regex. Setting up a convenient playground may take 2-3 hours, depending on the language. You literally did 5 simple cases that are almost the same. Don't rush your PR, just do your work well.

@kkoomen kkoomen added the feature New feature or request label Jul 22, 2019
@vigoux vigoux closed this Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants