steve-chavez
b866236aad
fix: mpc_sepby1 not applying fold correctly
...
`mpc_sepby1` takes a single fold function but this doesn't apply to the
whole list of entries. Instead it applies the fold twice,
one for `mpc_and` and another for `mpc_many`.
Introduce a new repeat repeat parser type MPC_TYPE_SEPBY1 that combines
the results and applies the fold once for all entries.
2023-08-20 21:12:50 -05:00
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
Joshua Crowgey
0edd06ec44
Removed trailing whitespace
2020-01-08 22:07:32 -08:00
Daniel Holden
dbe7308b9c
Added destructor to check combinators
2019-06-15 14:30:41 -04:00
Daniel Holden
37c4de35a3
Fixed bug with end of file and parsing from a file
2018-12-15 16:11:39 -05: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
fbc5d8f9ae
Added line-reader example. Changed behaviour of eof on regex to parse either eof or a newline followed be eof (better matchers other regex engines).
2018-10-13 18:27:42 -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
10d5753b87
Fix mpc_checkf
and mpc_check_withf
tests.
2018-04-03 16:29:23 +02:00
Jerome M. BERGER
a63bedc74a
Add mpc_checkf
and mpc_check_withf
combinators.
2018-04-03 14:53:13 +02:00
Jerome M. BERGER
dfda9d3bd6
Add tests for mpc_check
and mpc_check_with
.
2018-04-03 10:07:54 +02:00
Julian de Bhal
00c69094f4
Add newline to end of ptest.h
2016-11-12 15:01:15 +10:00
Daniel Holden
f0260810f0
Avoided some ANSI C warnings and deleted generated error from parse
2016-11-08 09:59:50 +00:00
Sean Usher
2dc31a4c34
Clean up grammar test changes
2016-11-07 20:32:56 -08:00
Sean Usher
7380584a6f
Add test to ensure that referencing a non-existent rule in another rule returns the proper error
2016-11-07 20:30:14 -08:00
Daniel Holden
2a19e4c451
Fixed folding of single child asts with tags
2016-06-11 14:11:19 +01:00
Daniel Holden
14001ad332
Added test for partial grammar definition
2016-06-11 12:59:55 +01:00
Daniel Holden
4da2ae5feb
Updated copy function to work properly with larger parsers
2016-03-03 10:34:52 +00:00
Daniel Holden
4932c86ec7
Fixed bug in optimisation pass.
2015-11-09 12:06:13 +00:00
Daniel Holden
3643fbe6bb
Fixed bug in behaviour of counting parser. Removed changelog (git is the changelog).
2015-08-28 19:20:39 +01:00
Daniel Holden
6a8dc2e3f9
Fixed ptest compile errors
2015-03-10 10:50:29 +00:00
Daniel Holden
dba739cd3d
merge
2015-03-10 10:46:36 +00:00
Daniel Holden
123a7919d1
Added string stripping functions
2015-03-10 10:44:29 +00:00
Daniel Holden
7ab3140617
Updated to newer version of ptest
2015-02-22 17:22:34 +00: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
Daniel Holden
7487398279
Updated tests. Added some tests for new boundary parse.
2014-04-16 19:19:25 +01:00
Daniel Holden
8d9bf9fdda
Fixed bug in state tagging. Updated examples to use concatinated preprocessor strings
2014-04-16 17:06: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
Reuben Thomas
38884e7913
fixed 'no newline at end of file' build errors
2014-04-06 12:26:28 +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
26b6216d7a
Fixed unused warnings
2014-01-10 10:03:25 +00:00
Daniel Holden
a8257e5b8e
Regex tests
2013-11-17 18:25:06 +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
45832ff09a
Updated tests
2013-10-17 11:40:30 +01:00
Daniel Holden
bb8f889951
Various Updates
2013-10-16 13:53:00 +01:00
Daniel Holden
4add5ca6f5
WIP conversion to while loop
2013-10-04 17:58:27 +01:00
Daniel Holden
a625db585d
strictly ansi C now
2013-09-30 20:55:57 +01:00
Daniel Holden
5a50398629
Language now uses full grammar
2013-09-27 10:41:42 +01:00
Daniel Holden
3ccb23eb4c
Fixed some memory leaks
2013-09-27 00:35:34 +01:00
Daniel Holden
751e3f6b9d
Some language stuff
2013-09-26 17:58:14 +01:00
Daniel Holden
eadb0417b9
big update to readme
2013-09-26 13:15:00 +01:00
Daniel Holden
b02c6ffdfe
Linux Merge
2013-09-24 11:38:27 +01:00
Daniel Holden
48812155a1
Updated testing framework
2013-09-23 22:41:58 +01:00