64 Commits

Author SHA1 Message Date
steve-chavez
c24e27f0b8 feat: add sepby1 combinator
`sepby1` is a common reusable combinator in Haskell Parsec.

This adds `mpc_sepby1(mpc_fold_t f, mpc_parser_t *sep, mpc_parser_t *a)` according to Haskell's implementation:

https://hackage.haskell.org/package/parsec-3.1.16.1/docs/src/Text.Parsec.Combinator.html#sepBy1

Reuses existing `mpc_and`, `mpc_many`, and `mpcf_snd_free`.
2023-08-08 14:25:18 -05:00
Carlos Rueda
afbaab89fe remove mpcf_maths from mpc.c and adjust maths test 2023-01-05 15:51:14 -08:00
Sören Tempel
e863181763 mpc.h: Add prototype for mpcf_freefold
The mpcf_freefold is documented in the README but currently not declared
in the header file. As such, adding the latter was probably just
forgotten at some point. This change adds the required function
prototype.
2020-05-03 17:32:19 +02:00
Joshua Crowgey
0edd06ec44 Removed trailing whitespace 2020-01-08 22:07:32 -08:00
Fotis Georgatos
83393d4f4c typo: recieved -> received [ok] 2019-06-24 22:46:12 +02:00
Daniel Holden
dbe7308b9c Added destructor to check combinators 2019-06-15 14:30:41 -04:00
Daniel Holden
4a992d91ab Added mode option to regex and also changed example from a line reader to a tokenizer. 2018-10-14 17:20:11 -04:00
Daniel Holden
65060137b1 Adjust the behaviour of mpc_eoi so that it only is successful in matching the end of input once. 2018-10-13 17:35:21 -04:00
Jerome M. BERGER
a63bedc74a Add mpc_checkf and mpc_check_withf combinators. 2018-04-03 14:53:13 +02:00
Jerome M. BERGER
6ac5594c4f Add mpc_check and mpc_check_with combinators. 2018-03-23 10:50:09 +01:00
Daniel Holden
37c12b1d43 Merge branch 'master' of github.com:orangeduck/mpc 2016-09-17 15:41:34 +01:00
Daniel Holden
d6375f813d Added C++ extern declaration 2016-09-17 15:41:17 +01:00
Sean Anderson
f87ce67e70 Merge branch 'master' of https://github.com/orangeduck/mpc into nparse 2016-06-29 16:23:31 -04:00
Sean Anderson
4156d72642 Added function to only parse n bytes from input 2016-06-29 14:17:46 -04:00
Daniel Holden
2a19e4c451 Fixed folding of single child asts with tags 2016-06-11 14:11:19 +01:00
petermlm
913cc58824 Made traversal free 2016-05-31 22:32:24 +01:00
petermlm
0b287e6252 Indentation 2016-04-19 23:26:52 +01:00
petermlm
9ac854ad5a Made post order tree traversal 2016-04-19 22:27:32 +01:00
petermlm
97d634a708 Added const to declarations 2016-04-17 18:43:10 +01:00
petermlm
2b643c729b Made functions to get child nodes of AST by tag 2016-04-17 00:17:45 +01:00
Daniel Holden
c2908c37bb Added copy function 2016-02-20 14:44:08 +00:00
Daniel Holden
4472dd4363 Added basic optimise function for parsers. 2015-11-07 16:57:09 +00:00
Daniel Holden
123a7919d1 Added string stripping functions 2015-03-10 10:44:29 +00:00
Daniel Holden
f6d7d87b8b reverted state to use long type 2014-10-17 15:32:00 +01:00
Daniel Holden
5094d2c015 Removed comments describing changes. Fixed warnings reported by gcc in the test suite 2014-10-16 15:38:27 +01:00
Dalton Woodard
bd9e5d98d6 Fixed all compilation warnings for mpc.c and mpc.h. Now compiles successfully on clang with -Werror and myriad warnings invoked (see Makefile for details). Compiles successfully on gcc with -Werror (ptest.c and example code does not, however). 2014-10-14 23:18:02 -07:00
Kelong Cong
5bd7aaf004 Added function to print ast to user specified file pointer 2014-07-15 22:21:54 +01:00
Daniel Holden
f7185c9762 Refactored boundary stuff into more general anchor 2014-04-16 23:20:52 +01:00
Daniel Holden
7487398279 Updated tests. Added some tests for new boundary parse. 2014-04-16 19:19:25 +01:00
Daniel Holden
612bc046f0 Initial commit for boundary support 2014-04-16 18:16:16 +01:00
Daniel Holden
8d0ee197e1 Renamed language option constants 2014-04-15 16:06:59 +01:00
Daniel Holden
0164931350 Initial commit for recording parse state in ast 2014-04-15 16:04:07 +01:00
Daniel Holden
efabc31c06 Removed next char from state and moved it to error 2014-04-15 14:37:13 +01:00
Daniel Holden
28e50a3077 Merge github.com:orangeduck/mpc 2014-04-15 12:45:50 +01:00
Daniel Holden
c74dedbb23 Initial ability to get state 2014-04-15 12:45:35 +01:00
Yetkin Öztürk
17092f3637 Update mpc.h
mpc_state_t and mpc_err_t member order changed for better structure data alignment.
2014-04-06 18:07:12 +02:00
Daniel Holden
d5e2bdf977 Added flags to language specifiction. Added optional expect string to language specification. Added some exaple grammars for testing and demos 2014-01-26 11:25:50 +00:00
Daniel Holden
51dbf66b50 A couple more fixes and edits 2014-01-21 11:29:08 +00:00
Daniel Holden
f518fb5a1d Changed pointer syntax 2014-01-20 21:32:46 +00:00
Daniel Holden
26b6216d7a Fixed unused warnings 2014-01-10 10:03:25 +00:00
Daniel Holden
0eaaf4bba2 Various fixes 2014-01-09 11:12:59 +00:00
Daniel Holden
341c2d6211 Completed refactoring 2013-11-11 16:56:20 +00:00
Daniel Holden
fcc710df36 Fixed bad bugs 2013-11-10 16:56:59 +00:00
Daniel Holden
7059268b9b WIP refactoring 2013-11-10 14:17:32 +00:00
Daniel Holden
82aa2eefc7 Changed argument order of many functions 2013-11-10 12:52:01 +00:00
Daniel Holden
f5347e550b Removed else and also 2013-11-10 12:42:47 +00:00
Daniel Holden
0e8d2865d6 Updated regex escapes 2013-11-10 12:01:23 +00:00
Daniel Holden
51faac5778 WIP RE unescape stuff 2013-11-02 20:42:38 +00:00
Daniel Holden
8a398d0f4e more tweaks 2013-10-28 11:07:15 +00:00
Daniel Holden
929eb4ea2a Fixed some of the regex behaviour 2013-10-16 14:38:37 +01:00