-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Conversation
@@ -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', |
There was a problem hiding this comment.
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++.
@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. |
I have some problem extracting parameters, how should i do ? |
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. |
@kkoomen, i finaly wrapped my head around it i'm fine doing this (practicing à little and i'll be fine) |
This version is finaly working, i'm going to search for more examples later this day |
@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. |
I would say 6, i've used regex101 before, and for the c ftplugin. |
@@ -1,5 +1,5 @@ | |||
" ============================================================================== | |||
" The C++ documentation should follow the 'Doxygen' conventions. | |||
" The C documentation should follow the 'Doxygen' conventions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be C++.
@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. |
There was a problem hiding this 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]', |
There was a problem hiding this comment.
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*[;{]', |
There was a problem hiding this comment.
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.
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