haxscramper / hcparse

High-level nim bindings for parsing C/C++ code
https://haxscramper.github.io/hcparse-doc/src/hcparse/libclang.html
Apache License 2.0
37 stars 2 forks source link

Do not reimplement ad-hoc comment scraper, use proper tools to extract this data #24

Open haxscramper opened 2 years ago

haxscramper commented 2 years ago

https://github.com/libgit2/libgit2/blob/2998a84ab644ad39b62553baf9c4b30269be7d75/include/git2/checkout.h#L107-L125

typedef enum {
    GIT_CHECKOUT_NONE = 0, /**< default is a dry run, no actual updates */

    /**
     * Allow safe updates that cannot overwrite uncommitted data.
     * If the uncommitted changes don't conflict with the checked out files,
     * the checkout will still proceed, leaving the changes intact.
     *
     * Mutually exclusive with GIT_CHECKOUT_FORCE.
     * GIT_CHECKOUT_FORCE takes precedence over GIT_CHECKOUT_SAFE.
     */
    GIT_CHECKOUT_SAFE = (1u << 0),

    /**
     * Allow all updates to force working directory to look like index.
     *
     * Mutually exclusive with GIT_CHECKOUT_SAFE.
     * GIT_CHECKOUT_FORCE takes precedence over GIT_CHECKOUT_SAFE.
     */
    GIT_CHECKOUT_FORCE = (1u << 1),

is wrapped as https://github.com/haxscramper/hlibgit2/blob/2b3ba88ffd4848b13d06cfd1843236df8aa563a0/src/hlibgit2/checkout.nim#L18-L40

  c_git_checkout_strategy_t* = enum
    c_GIT_CHECKOUT_NONE                         = 0 shl 0                                                                                   
    c_GIT_CHECKOUT_SAFE                         = 1 shl 0  ## default is a dry run, no actual updates                                       
    c_GIT_CHECKOUT_FORCE                        = 1 shl 1                                                                                   
    c_GIT_CHECKOUT_RECREATE_MISSING             = 1 shl 2  ## Allow checkout to recreate missing files                                      
    c_GIT_CHECKOUT_ALLOW_CONFLICTS              = 1 shl 4  ## Allow checkout to make safe updates even if conflicts are found               
    c_GIT_CHECKOUT_REMOVE_UNTRACKED             = 1 shl 5  ## Remove untracked files not in index (that are not ignored)                    
    c_GIT_CHECKOUT_REMOVE_IGNORED               = 1 shl 6  ## Remove ignored files not in index                                             
    c_GIT_CHECKOUT_UPDATE_ONLY                  = 1 shl 7  ## Only update existing files, don't create new ones                             
    c_GIT_CHECKOUT_DONT_UPDATE_INDEX            = 1 shl 8                                                                                   
    c_GIT_CHECKOUT_NO_REFRESH                   = 1 shl 9  ## Don't refresh index/config/etc before doing checkout                          
    c_GIT_CHECKOUT_SKIP_UNMERGED                = 1 shl 10 ## Allow checkout to skip unmerged files                                         
    c_GIT_CHECKOUT_USE_OURS                     = 1 shl 11 ## For unmerged files, checkout stage 2 from index                               
    c_GIT_CHECKOUT_USE_THEIRS                   = 1 shl 12 ## For unmerged files, checkout stage 3 from index                               
    c_GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH       = 1 shl 13 ## Treat pathspec as simple list of exact match file paths                       
    c_GIT_CHECKOUT_UPDATE_SUBMODULES            = 1 shl 16 ## Recursively checkout submodules with same options (NOT IMPLEMENTED)           
    c_GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = 1 shl 17 ## Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED) 
    c_GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES      = 1 shl 18 ## Ignore directories in use, they will be left empty                            
    c_GIT_CHECKOUT_DONT_OVERWRITE_IGNORED       = 1 shl 19 ## Don't overwrite ignored files that exist in the checkout target               
    c_GIT_CHECKOUT_CONFLICT_STYLE_MERGE         = 1 shl 20 ## Write normal merge files for conflicts                                        
    c_GIT_CHECKOUT_CONFLICT_STYLE_DIFF3         = 1 shl 21 ## Include common ancestor data in diff3 format files for conflicts              
    c_GIT_CHECKOUT_DONT_REMOVE_EXISTING         = 1 shl 22 ## Don't overwrite existing files or folders                                     
    c_GIT_CHECKOUT_DONT_WRITE_INDEX             = 1 shl 23 ## Normally checkout writes the index upon completion; this prevents that.  

Which misses parts of the documentation comments. This is caused by incorrect boost::wave file expansion. I already have Doxygen XML parser, maybe I should use it directly, instead of reimplementing the own ad-hoc converter that does not even translate documentation comment semantics.

haxscramper commented 2 years ago

Related #16