Skip to content

Commit

Permalink
Merge pull request #208 from gilch/fix-highlighting
Browse files Browse the repository at this point in the history
Fix highlighting
  • Loading branch information
gilch committed May 17, 2023
2 parents 1709835 + 9627519 commit c00679b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/lissp_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def __init__(self, **options):
"root": [
(r"^#> .*\n(?:^#\.\..*\n)*", using(LisspPromptLexer)),
(r"^>>> .*\n(?:\.\.\. .*\n)*(.+\n)*", using(PythonConsoleLexer)),
(r".+\n", pt.Generic.Error),
(r"\n", pt.Whitespace),
]
}
Expand Down
20 changes: 10 additions & 10 deletions docs/macro_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ You can use Hissp's other special form, ``quote``, to prevent evaluation.
OK, but that just turned it into a string.
We could have done that much in Python:

.. code-block:: Python
.. code-block:: pycon
>>> L = 'lambda'
That worked, but can we use it?

.. code-block:: Python
.. code-block:: pycon
>>> squares = map(L x: x * x, range(10))
Traceback (most recent call last):
Expand Down Expand Up @@ -2191,15 +2191,15 @@ Hexadecimal
You can use Python's `int` builtin to convert a string containing a hexadecimal
number to the corresponding integer value.

.. code-block:: Python
.. code-block:: pycon
>>> int("FF", 16)
255
Of course, Python already has a built-in notation for this,
disambiguated from normal base-ten ints using the ``0x`` tag.

.. code-block:: Python
.. code-block:: pycon
>>> 0xFF
255
Expand All @@ -2208,7 +2208,7 @@ But what if it didn't?

About the best Python could do would be something like this.

.. code-block:: Python
.. code-block:: pycon
>>> def b16(x):
... return int(x, 16)
Expand Down Expand Up @@ -2270,7 +2270,7 @@ but ``12`` is a valid base-ten int,
so it's read as an int.
Python's `int` builtin doesn't do base conversions for those.

.. code-block:: Python
.. code-block:: pycon
>>> int(12, 16)
Traceback (most recent call last):
Expand All @@ -2281,7 +2281,7 @@ No matter, this is an easy fix.
Convert it to a string,
and it works regardless of which type you start with.

.. code-block:: Python
.. code-block:: pycon
>>> int(str(12), 16)
18
Expand Down Expand Up @@ -2534,7 +2534,7 @@ Decimal
Floating-point numbers are very useful,
but they have some important limitations.

.. code-block:: Python
.. code-block:: pycon
>>> 0.2 * 3
0.6000000000000001
Expand Down Expand Up @@ -2735,7 +2735,7 @@ Python has a powerful and compact notation for operating on *slices* of sequence
It has three arguments: *start*, *stop*, and *step*.
Each one is optional, and defaults to ``None``.

.. code-block:: Python
.. code-block:: pycon
>>> "abcdefg"[-1::-2]
'geca'
Expand All @@ -2747,7 +2747,7 @@ but it comes at a cost.

(We'll be reusing this simple "geca" test case as we iterate. Feel free to try others.)

.. code-block:: Python
.. code-block:: pycon
>>> a = "abcdefg"
>>> b = slice(-1, None, -2)
Expand Down

0 comments on commit c00679b

Please sign in to comment.