Skip to content

Commit 02107eb

Browse files
authored
Make theme match system theme (#107)
Also add icons to index
1 parent 5316303 commit 02107eb

11 files changed

+51
-5
lines changed

docs/alternative_parsers.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/directions-fork
3+
---
4+
15
# Alternative parsers
26

37
## `parser1 | parser2`: alternative parser

docs/contributing.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/hand-heart
3+
---
4+
15
# Contributing
26

37
Parsita is free and open source software developed under an MIT license. Development occurs at the [GitHub project](https://github.com/drhagen/parsita). Contributions, big and small, are welcome.

docs/conversion_parsers.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/function
3+
---
4+
15
# Conversion parsers
26

37
## `parser > function`: conversion parser

docs/getting_started.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/sign-direction
3+
---
4+
15
# Getting started
26

37
David Hagen gave an [introductory talk](https://www.youtube.com/watch?v=9JSGGSRgUcw) on Parsita at SciPy 2021. The documentation is more thorough, but the talk is useful for anyone looking for a quick walk-through.
@@ -29,7 +33,7 @@ In version 1 of Parsita, `ParserContext` was split into two context classes, one
2933

3034
### `Parser.parse`
3135

32-
The only method of note on a `Parser` is the `parse` method. The `parse` method takes a `str` as as argument and returns an instance of the `Result` class, which has two subclasses `Success` and `Failure`. Note that in v2.0, these classes are reexported by Parsita, but are defined by the popular Returns package in [`returns.result`](https://returns.readthedocs.io/en/latest/pages/result.html). By using the `Result` class from Returns, Parsita's error handling can be composed with that of other libraries that use Returns.
36+
The only method of note on a `Parser` is the `parse` method. The `parse` method takes a `str` as as argument and returns an instance of the `Result` class, which has two subclasses `Success` and `Failure`. Note that in v2.0, these classes are reexported by Parsita, but are defined by the popular Returns package in [`returns.result`](https://returns.readthedocs.io/en/latest/pages/result.html). By using the `Result` class from Returns, Parsita's error handling can be composed with that of other libraries that use Returns.
3337

3438
Instances of `Result` work especially well with pattern matching in the `match` statement introduced in Python 3.10:
3539

docs/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/home
3+
---
4+
15
# Parsita
26

37
Parsita is a parser combinator library written in Python. Parser combinators provide an easy way to define a grammar using code so that the grammar itself effectively parses the source. They are not the fastest at parsing, but they are the easiest to write.

docs/miscellaneous_parsers.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/shape-plus
3+
---
4+
15
# Miscellaneous parsers
26

37
## `pred(parser, predicate, description)`: predicate parser
@@ -141,6 +145,6 @@ class NumberParsers(ParserContext):
141145
scientific = reg(r'[-+]?[0-9]+e[-+]?[0-9]+') > float
142146
number = decimal | scientific | integer
143147

144-
# Assertion is broken and needs debugged
148+
# Assertion is broken and needs debugged
145149
assert isinstance(NumberParsers.number.parse('1e5').unwrap(), float)
146150
```

docs/repeated_parsers.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/repeat-variant
3+
---
4+
15
# Repeated parsers
26

37
## `rep(parser, min=0, max=inf)` and `rep1(parser)`: repeated parsers

docs/sequential_parsers.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/plus
3+
---
4+
15
# Sequential parser
26

37
## `parser1 & parser2`: sequential parser

docs/terminal_parsers.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/text-recognition
3+
---
4+
15
# Terminal parsers
26

37
Terminal parsers (those created by `lit` and `reg`) are the atoms of a parser, they match and extract the smallest meaningful words of the language.

docs/utility_functions.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
icon: material/tools
3+
---
4+
15
# Utility functions
26

37
There are several utility functions, `constant`, `splat`, and `unsplat`. They are mostly useful when used with the conversion parser (`>`). These utility functions are not exported by `from parsita import *` and must be imported from `parsita.util`.

mkdocs.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,24 @@ theme:
1818
repo: fontawesome/brands/github
1919

2020
palette:
21-
- scheme: default
21+
- media: "(prefers-color-scheme)"
22+
toggle:
23+
icon: material/link
24+
name: Switch to light mode
25+
- media: "(prefers-color-scheme: light)"
26+
scheme: default
2227
primary: black
2328
accent: yellow
2429
toggle:
2530
icon: material/weather-sunny
2631
name: Switch to dark mode
27-
- scheme: slate
32+
- media: "(prefers-color-scheme: dark)"
33+
scheme: slate
2834
primary: yellow
2935
accent: deep orange
3036
toggle:
3137
icon: material/weather-night
32-
name: Switch to light mode
38+
name: Switch to system preference
3339

3440
markdown_extensions:
3541
- pymdownx.highlight

0 commit comments

Comments
 (0)