You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-40
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Micro Parser Combinators
2
2
========================
3
3
4
-
Version 0.8.8
4
+
Version 0.9.0
5
5
6
6
7
7
About
@@ -116,15 +116,15 @@ Basic Parsers
116
116
117
117
All the following functions construct new basic parsers of the type `mpc_parser_t *`. All of those parsers return a newly allocated `char *` with the character(s) they manage to match. If unsuccessful they will return an error. They have the following functionality.
118
118
119
-
* * *
119
+
* * *
120
120
121
121
```c
122
122
mpc_parser_t *mpc_any(void);
123
123
```
124
124
125
125
Matches any individual character
126
126
127
-
* * *
127
+
* * *
128
128
129
129
```c
130
130
mpc_parser_t *mpc_char(char c);
@@ -283,7 +283,7 @@ Run a parser on the contents of some file.
283
283
Combinators
284
284
-----------
285
285
286
-
Combinators are functions that take one or more parsers and return a new parser of some given functionality.
286
+
Combinators are functions that take one or more parsers and return a new parser of some given functionality.
287
287
288
288
These combinators work independently of exactly what data type the parser(s) supplied as input return. In languages such as Haskell ensuring you don't input one type of data into a parser requiring a different type is done by the compiler. But in C we don't have that luxury. So it is at the discretion of the programmer to ensure that he or she deals correctly with the outputs of different parser types.
289
289
@@ -312,13 +312,13 @@ Returns a parser that applies function `f` (optionality taking extra input `x`)
Returns a parser that applies function `f` (optionally taking extra input `x`) to the result of parser `a`. If `f` returns non-zero, then the parser succeeds and returns the value of `a` (possibly modified by `f`). If `f` returns zero, then the parser fails with message `e`.
321
+
Returns a parser that applies function `f` (optionally taking extra input `x`) to the result of parser `a`. If `f` returns non-zero, then the parser succeeds and returns the value of `a` (possibly modified by `f`). If `f` returns zero, then the parser fails with message `e`, and the result of `a` is destroyed with the destructor `da`.
322
322
323
323
* * *
324
324
@@ -556,9 +556,9 @@ To ease the task of undefining and then deleting parsers `mpc_cleanup` can be us
556
556
mpc_parser_t *mpc_copy(mpc_parser_t *a);
557
557
```
558
558
559
-
This function makes a copy of a parser `a`. This can be useful when you want to
560
-
use a parser as input for some other parsers multiple times without retaining
561
-
it.
559
+
This function makes a copy of a parser `a`. This can be useful when you want to
560
+
use a parser as input for some other parsers multiple times without retaining
By extending the regex we can easily extend this to parse many more types of
880
+
By extending the regex we can easily extend this to parse many more types of
879
881
tokens and quickly and easily build a tokenizer for whatever language we are
880
882
interested in.
881
883
@@ -991,5 +993,3 @@ When parsing from a grammar, the abstract syntax tree is tagged with different t
991
993
If you have a rule in your grammar called `string`, `char` or `regex`, you may encounter some confusion. This is because nodes will be tagged with (for example) `string`_either_ if they are a string primitive, _or_ if they were parsed via your `string` rule. If you are detecting node type using something like `strstr`, in this situation it might break. One solution to this is to always check that `string` is the innermost tag to test for string primitives, or to rename your rule called `string` to something that doesn't conflict.
992
994
993
995
Yes it is annoying but its probably not going to change!
0 commit comments