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

Doccursor #217

Merged
merged 7 commits into from
Nov 18, 2023
Merged

Doccursor #217

merged 7 commits into from
Nov 18, 2023

Commits on Nov 16, 2023

  1. docstring: add more dedicated _get_header_lines() methods

    At the risk of duplication, add more dedicated _get_header_line() to
    make it easier to understand what is needed where.
    jnikula authored and BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    1984b99 View commit details
    Browse the repository at this point in the history
  2. doccursor: move all parser helpers to a new file

    We want to wrap these in an object, but we'll try to do so
    incrementally.
    
    By moving this code into our own `doccursor` module, it makes sense that
    we import `CursorKind` and `TokenKind` from it instead of from Clang's
    library despite them being the same by design.
    jnikula authored and BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    4772c5a View commit details
    Browse the repository at this point in the history
  3. doccursor: stub our shiny new cursor class

    As a 1st step, we make a _very_ shallow wrapper around the Clang cursor.
    There is of course no point to it yet, but with this simple trick we are
    now using `DocCursor`s everywhere past `parse()`.
    
    The only effect of this commit is to worsen performance very slightly
    due to needless invocation of path specific code on all cursors. Running
    the full test suit is now ~9% slower on my machine. We shall revisit
    this later when it actually matters.
    BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    5fc388c View commit details
    Browse the repository at this point in the history
  4. doccursor: move helpers inside the class

    Another baby step, which is again mostly cosmetic.
    
    In doing this, we can remove plenty of the attributes we defined just to
    get cursor compatibility. We may want to expose some of this again
    later, but likely through a better API. For now we simplify the code as
    much as possible.
    
    After we should start thinking of how this will play out with docstring
    and improving these methods / attributes to provide a nice API for the
    new cursor.
    BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    ebcb26a View commit details
    Browse the repository at this point in the history
  5. doccursor: always use the Clang cursor internally

    We want to start improving the API in ways that will no longer mimic the
    Clang's cursor one. We need to prevent (e.g.) our cursor `type` property
    turns out to mean something different than Clang's own namesake
    (spoiler: it will!).
    
    There might be a few cases where the result might be the same, but that
    will not be obvious most of the times and it may still pose a
    performance issue anyway. As a rule, we stick to using the Clang cursor
    everywhere we can.
    BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    67adbba View commit details
    Browse the repository at this point in the history
  6. doccursor: simplify API for current docstring behaviour

    We want to do better than this later on, but for now we need to simplify
    the parser so that we focus instead on API alone with docstring as the
    biggest consumer. In order to do that the easy way, we will start by
    providing an API that reflects the current docstring API, then pass the
    cursor to docstring directly simplifying its own API and finally
    isolating the parser from docstring entirely.
    
    The idea is _not_ to mimic Clang's cursor any more! Any similarity in
    attributes and property names is coincidental from now on.
    
    By this point we've also made up the lost performance from the stub
    commit!
    BrunoMSantos committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    34282b3 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. docstring: use cursor as input

    Finally, we get to make the parser completely oblivious to the rendering
    layer! Hopefully docstring and doccursor can now evolve to something
    better.
    
    Closes jnikula#180. Though a lot of the potential is still to be realized.
    BrunoMSantos committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    0cd1f59 View commit details
    Browse the repository at this point in the history