-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
========= | ||
Functions | ||
========= | ||
|
||
.. _lang_from_so Overview: | ||
|
||
``lang_from_so(path: str | pathlib.Path, name: str) -> tree_sitter.Language`` | ||
***************************************************************************** | ||
|
||
This function takes a ``.so`` file and the language name (used by the old tree sitter versions) and returns a ``tree_sitter.Language`` for usage with Albero. | ||
|
||
.. _get_lang Overview: | ||
|
||
``get_lang(language_name: str) -> tree_sitter.Language`` | ||
******************************************************** | ||
|
||
Takes a language name and attempts to get a ``tree_sitter.Language`` from the dict of builtin Tree Sitter languages. | ||
|
||
.. _get_mapping Overview: | ||
|
||
``get_mapping(language_name: str) -> dict[str, str]`` | ||
***************************************************** | ||
|
||
Takes a language name and attempts to get a mapping from the dict of pre-made mappings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
========= | ||
Variables | ||
========= | ||
|
||
.. _Token Overview: | ||
|
||
``Token`` | ||
********* | ||
|
||
The ``Token`` type is, in reality, just a type alias of ``tuple[tuple[int, int], int, str]``. Despite simply being a ``tuple``, the ``Token`` is the most frequently returned data type. That being said, what data does it signify? | ||
|
||
The ``Token`` type contains three parts: the start index, its length, and its type. The start index is that ``tuple`` at the beginning of the main ``tuple`` and the first index of that is the line the ``Token`` takes place on and the second is the column. ``Token``'s start at index ``1, 0`` so you may need to do a -1 or a +1 depending on how you need to use this data. The second ``int`` is the length of the ``Token` and the ``str`` is the type. You will use these very often so its never a bad idea to get familiar with them. | ||
|
||
.. _Generic Tokens Overview: | ||
|
||
``generic_tokens`` | ||
****************** | ||
|
||
The ``generic_tokens`` ``list`` provides all the generic ``Token`` types you will encounter when using ``Salve``. Simply print this out and you will know all possible ``Token`` types you will be working with when using ``Salve`` and yoiu will never be surprised by a random ``Token`` type. |