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

Add guidance on handling comments in languages with significant indentation #1502

Merged
merged 6 commits into from
Jan 5, 2025

Conversation

nchammas
Copy link
Contributor

@nchammas nchammas commented Jan 2, 2025

  • Expand the indented tree example to show how to correctly handle comments.
  • Add a new section to Recipes that references this example, as it's perhaps the most accessible starting point for those looking to write a grammar with significant indentation.
  • Add some guidances on how to build the docs.
  • Fix a warning coming from Sphinx by configuring the language explicitly.

Related to (though perhaps not exactly a fix for) #863.

@nchammas

This comment was marked as resolved.

examples/indented_tree.py Outdated Show resolved Hide resolved
examples/indented_tree.py Show resolved Hide resolved
examples/indented_tree.py Outdated Show resolved Hide resolved
docs/recipes.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@nchammas nchammas left a comment

Choose a reason for hiding this comment

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

I added some instructions on how to build the docs and, since I am now able to review the built docs, I also fixed the markup.

@@ -12,3 +12,4 @@ tags
/build
docs/_build
docs/examples
docs/sg_execution_times.rst
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dunno if this shows up for you too after running make html, but I assume it's meant to be ignored.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think I get this. Not sure why you are.

Copy link
Contributor Author

@nchammas nchammas Jan 3, 2025

Choose a reason for hiding this comment

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

Could it be the version of Sphinx you are running? This is what I have:

$ pip list | grep -i sphinx
Sphinx                        7.3.7
sphinx-gallery                0.18.0
sphinx-markdown-tables        0.0.17
sphinx-rtd-theme              3.0.2
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         2.0.0
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dev requirements are open ended, so if you haven't updated them in a while you are likely running a much older version of Sphinx than I am (since I just installed them today).

If you're courageous, I would try pip install -U -r docs/requirements.txt and then see if you get the same behavior that I am seeing.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you're right, it gets generated by sphinx-gallery. I think it's fine to just ignore it.

@nchammas nchammas changed the title Add guidance on handling comments in whitespace-sensitive languages Add guidance on handling comments in languages with significant indentation Jan 3, 2025
@nchammas nchammas requested a review from erezsh January 3, 2025 16:14
Otherwise Sphinx complains:

```
WARNING: Invalid configuration value found: 'language = None'.
Update your configuration to a valid language code. Falling back to 'en' (English).
```
@erezsh erezsh merged commit 08c9193 into lark-parser:master Jan 5, 2025
9 checks passed
@erezsh
Copy link
Member

erezsh commented Jan 5, 2025

Thanks!

@nchammas nchammas deleted the whitespace-example branch January 5, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants