Commit Graph

248 Commits

Author SHA1 Message Date
ranchuan
d77c39d187 翻译 readme.md
Some checks failed
CI / Build and test (push) Has been cancelled
2024-10-28 16:01:33 +08:00
Daniel Holden
d4c99b753b Merge pull request #167 from steve-chavez/sepby-repeat
fix: mpc_sepby1 not applying fold correctly
2023-08-21 22:35:09 -04:00
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
b7ee5df355 refactor: rename grow_results to mpc_grow_results
To not cause naming conflicts as mentioned on
https://github.com/orangeduck/mpc/pull/166#issuecomment-1685146508
2023-08-20 21:05:46 -05:00
Daniel Holden
3e9e3a2679 Merge pull request #166 from steve-chavez/refactor
refactor: deduplicate repeat parsers alloc logic
2023-08-19 21:13:43 -04:00
steve-chavez
21286d5915 refactor: deduplicate repeat parsers alloc logic
Deduplicates the results allocation logic used in MPC_TYPE_MANY
and MPC_TYPE_MANY1 on a `grow_results` function.

This will aid in implementing new repeat parser types. A new one is
neeeded for `sepby1` as discussed on
https://github.com/orangeduck/mpc/pull/165#discussion_r1292878771.
2023-08-19 20:08:01 -05:00
Daniel Holden
55f68efeed Merge pull request #165 from steve-chavez/sepby
feat: add sepby1 combinator
2023-08-09 11:03:02 -04: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
Daniel Holden
6912695fe5 Merge pull request #164 from steve-chavez/fix-makefile-compile
fix: make check always compiles dependencies
2023-08-04 11:17:56 -04:00
steve-chavez
57ce9be868 add .dirstamp to examples 2023-08-03 20:48:45 -05:00
steve-chavez
c2feb361dc remove tags 2023-08-03 20:48:35 -05:00
steve-chavez
1523a830d8 fix: make check always compiles dependencies
Make is supposed to only compile dependencies when they change but
`make check` always compiles them, making the test suite run slow.

```
$ make check
cc ... build/mpc.o

$ make check
cc ... build/mpc.o
```

The same occurs for other targets like `build/test-dynamic` and
`build/test-static`.

This happens because these targets have the `$(DIST)` directory as a
dependency, and directories always change whenever members are added,
removed or renamed.

Fix this by changing the `$(DIST)` directory dependency to a
`$(DIST)/.dirstamp` file.

Now `make check` compiles dependencies only once.
2023-08-03 18:09:19 -05:00
Daniel Holden
1a59a5ff7a Merge pull request #163 from steve-chavez/fix-makefile
fix: pkg-config only finding mpc with sudo
2023-07-23 08:38:56 -04:00
steve-chavez
318747b270 fix: pkg-config only finding mpc with sudo
After running `make install`, pkg-config only finds mpc with sudo:

```
$ sudo pkg-config --list-all | grep mpc
mpc - Library for creating parser combinators

$ pkg-config --list-all | grep mpc
```

This is because the Makefile runs `install -d -m644`, which doesn't
include permission to access the `/usr/local/lib/pkgconfig` directory.

Fix this by changing the created directories mode to 645.
2023-07-23 00:01:21 -05:00
Daniel Holden
0d75f362d9 Merge pull request #160 from Apteryks/fix-pkg-config-installation
Makefile: Install the templated pkg-config file.
2023-04-03 21:17:15 -04:00
Maxim Cournoyer
92983ee2ff Makefile: Install the templated pkg-config file.
Otherwise, the 'prefix' variable would be left undefined:

   $ pkg-config --cflags mpc
   Variable 'prefix' not defined in '/gnu/store/...-profile/lib/pkgconfig/mpc.pc'

   $ cat /gnu/store/...-profile/lib/pkgconfig/mpc.pc
   libdir=${prefix}/lib
   includedir=${prefix}/include
   [...]

* Makefile (install): Install the templated pkg-config from the build
directory.
(all): Add the libs and $(DIST)/$(PROJ).pc targets.
2023-03-31 15:39:09 -04:00
Daniel Holden
7c910e9303 Merge pull request #156 from carueda/shared-state-155
fix #155 - char_unescape_buffer not as shared space
2023-01-09 21:41:58 -05:00
Carlos Rueda
d33037b532 fix #155 - char_unescape_buffer not as shared space 2023-01-08 18:50:09 -08:00
Daniel Holden
ddcdd4d801 Merge pull request #153 from carueda/some_adjustments
remove mpcf_maths from mpc.c and adjust maths test
2023-01-08 08:55:57 -05:00
Daniel Holden
841a792565 Merge pull request #154 from carueda/ci
add ci
2023-01-08 08:50:26 -05:00
Carlos Rueda
78a2f773d4 add ci 2023-01-05 16:16:19 -08:00
Carlos Rueda
afbaab89fe remove mpcf_maths from mpc.c and adjust maths test 2023-01-05 15:51:14 -08:00
Daniel Holden
bd32544d42 Merge pull request #148 from kazarmy/fix-Wformat-overflow
Fix `-Wformat-overflow` warnings due to gcc 12 + ASAN + `-O2`
2022-10-11 09:41:54 -04:00
Khairul Azhar Kasmiran
6e3d2d54aa Fix -Wformat-overflow warnings due to gcc 12 + ASAN + -O2 2022-10-11 13:17:47 +00:00
Daniel Holden
65f20a1a0b Merge pull request #141 from holmanb/holmanb/fix-make-install
fix makefile install target problems
2021-11-29 14:11:48 -05:00
Brett Holman
7d69afe7c8 fix makefile install target problems 2021-11-29 11:48:54 -07:00
Daniel Holden
168830fb27 Merge pull request #140 from holmanb/holmanb/fix-make-target
fix makefile libs target
2021-11-21 14:12:38 -05:00
Brett Holman
e6d92d88f7 fix makefile libs target 2021-11-21 12:05:21 -07:00
Daniel Holden
84a820c946 Update README.md 2021-03-27 20:40:08 -04:00
Daniel Holden
d59264ae27 fixed makefile when build directory doesn't exist 2020-07-19 08:57:42 -04:00
Daniel Holden
e507d34428 Merge github.com:orangeduck/mpc 2020-07-19 08:54:16 -04:00
Daniel Holden
41aecb485e fixed renaming of mpcf_freefold to mpcf_all_free 2020-07-19 08:53:43 -04:00
Daniel Holden
d00739f8c2 Merge pull request #129 from nmeum/freefold
mpc.h: Add prototype for mpcf_freefold
2020-05-03 22:12:24 -04: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
Daniel Holden
4c7d9e3d40 Merge pull request #125 from HalosGhost/pc
(#124) preliminary pkg-config file setup and install
2020-04-11 17:51:11 -04:00
Daniel Holden
2063ba18f5 Merge pull request #123 from HalosGhost/compiler-portability
Compiler portability
2020-04-11 17:48:08 -04:00
Daniel Holden
48c3142739 Merge pull request #126 from eagleoflqj/master
Fix long format
2020-04-11 17:46:51 -04:00
Liumeo
248540274d Fix long format 2020-04-07 22:30:34 -04:00
halosghost
7bc1bb0a9b (#124) preliminary pkg-config file setup and install 2020-02-09 22:04:09 -06:00
halosghost
7869e2087e (closes #122) add ^M to end of line_reader example 2020-02-03 23:39:35 -06:00
halosghost
e1f5bea982 (#122) Support building with tcc
- replace ``mpc.h`` with ``$(PROJ).h``
- ``filter-out`` ``$(PROJ).h`` when building examples
- expose ``$(STD)``
2020-02-03 23:32:25 -06:00
Daniel Holden
c059e45ba2 Merge pull request #120 from jcrowgey/lint/extraneous_whitespace
Removed trailing whitespace
2020-01-11 16:56:49 -05:00
Joshua Crowgey
0edd06ec44 Removed trailing whitespace 2020-01-08 22:07:32 -08:00
Daniel Holden
5120609e6e fixed bug with trimming string with all space characters 2019-09-01 16:21:11 -04:00
Daniel Holden
e1038bc376 Merge pull request #110 from nmeum/fix-109
Fix backtracing bug with mpc_parse_pipe
2019-09-01 13:58:53 -04:00
Daniel Holden
ea778d1b8d added maximum recursion depth 2019-09-01 13:32:36 -04:00
Daniel Holden
9716397357 Merge pull request #116 from vemakereporter/fix_fts
Fix incremental build problems.
2019-08-31 12:47:46 -04:00
vemakereporter
7812a33774 Fix dependency issues reported by Vemake 2019-08-07 10:15:39 +00:00
Vemake
217a551a0a Use tabs instead of spaces in Makefile. 2019-08-07 17:55:12 +08:00
Vemake
8cf2c1d2d7 Fix 12 dependency issues in Makefile 2019-07-23 12:14:11 +08:00