Skip to content

Commit 7b4fb93

Browse files
Its-Just-NansStephen Gutekanst
authored andcommitted
Update zig-parser-combinators-and-why-theyre-awesome.md
1 parent 6e46534 commit 7b4fb93

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/2021/zig-parser-combinators-and-why-theyre-awesome.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ Suppose that for `a[bc].*abc`:
6262

6363
Now that we have these _parsers_, we can define _parser combinators_ to help us parse the full regular expression. First, we need something to parse a string `abc` which we can define as:
6464

65-
<img class="color-autoc="https://user-images.githubusercontent.com/3173176/110413375-fa49ae00-804a-11eb-8311-64e737513000.png">
65+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/110413375-fa49ae00-804a-11eb-8311-64e737513000.png">
6666

6767
What is `OneOrMore`, though? That's our first parser combinator!
6868

6969
It takes a single parser as input (in this case, `RegexLiteralParser`) and uses it to parse the input one or more times. If it succeeded once, the parser combinator succeeded. Otherwise, it failed to parse anything.
7070

7171
Now if we want to parse the `[bc]` part of our regex, let's say it can only contain a literal like `bc` (of course, real regex allows far more than this) we can e.g. reuse our new `RegexStringLiteralParser`:
7272

73-
<img class="color-autoc="https://user-images.githubusercontent.com/3173176/110413643-780db980-804b-11eb-8fe5-8ca97b2e96ca.png">
73+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/110413643-780db980-804b-11eb-8fe5-8ca97b2e96ca.png">
7474

7575
In this case, `Sequence` is a parser combinator which takes multiple parsers and tries to parse them one-after-the-other in order, requiring all to succeed or failing otherwise.
7676

0 commit comments

Comments
 (0)