Commit graph

865 commits

Author SHA1 Message Date
Sven M. Hallberg
c4bcc86ed0 don't disable -Wclobber on clang 2019-11-20 18:02:14 +01:00
Meredith L. Patterson
1bd778f52e the Great Merge continues 2019-10-08 17:13:31 +02:00
Meredith L. Patterson
8a545c4dcf dotnet and php bindings have bitrotted, but packrat is faster now 2019-10-08 17:11:18 +02:00
Meredith L. Patterson
72146e1c77
Merge pull request #190 from moreati/python3
Add support for Python 3.x bindings
2019-10-08 01:05:28 +02:00
Meredith L. Patterson
d02c4b55d2
Merge pull request #161 from pesco/sloballoc
add SLOB allocator
2019-10-08 01:03:11 +02:00
Meredith L. Patterson
321600b68f build with -std=c99 2019-10-08 00:53:18 +02:00
Alex Willmer
59ba68ef84 Use byte literals in examples and unit tests
In Python 2.x an unprefixed string literal produces a byte string.
In Python 3.x an unprefixed string literal produces a textual string.

To produce a byte string in both a b prefix is needed, e.g. b'foo'.
Since I believe Hammer works predominantly with byte strings I have used
b prefixes throughout.
2019-05-10 21:59:03 +01:00
Alex Willmer
8b4b8ddc57 Use PyBytes_* Python CAPI functions
This removes any doubts about what type of string is in use.
2019-05-10 21:59:03 +01:00
Alex Willmer
c82390941d Allow Python interpreter to be specified during build
This allows the library to be built and tested with a non-default
version of CPython, e.g.

scons bindings=python python=python3.6
scons bindings=python python=python3.6 testpython
2019-05-10 21:59:03 +01:00
Alex Willmer
287f71d561 Fix uses of retired builtins and builtin methods
In Python 3.x

- int and long types are unified. The unified type is called int.
- the text string type (unicode) is renamed to str.
- the byte string type (str) is renamed to bytes.
- chr returns a text string (i.e. str)
- xrange is renamed to range.
- dict.has_key() is removed
-
2019-05-10 21:59:03 +01:00
Alex Willmer
0f3cadcc3e Enable absolute imports, true division, & print()
These have no effect in Python 3.x, they are the default. Enabling them
in Python 2.x, enabling them in Python 2.x allows single source
compatiblity.
2019-05-10 21:13:32 +01:00
Sven M. Hallberg
631ca40f91 avoid embedding data[] in struct block to satisfy windows build 2016-12-07 12:39:49 +01:00
Sven M. Hallberg
ec8249513c avoid more void pointer arithmetic 2016-12-07 12:06:53 +01:00
Sven M. Hallberg
fedb36ed89 avoid arithmetic on void pointers to be more standard-conforming 2016-12-07 12:00:27 +01:00
Sven M. Hallberg
d9c4492fd9 silence gcc about "possible" (impossible) use of uninitialized variable 2016-12-06 18:21:59 +01:00
Sven M. Hallberg
0f9be192b6 Merge remote-tracking branch 'upstream/master' into sloballoc 2016-12-06 18:21:06 +01:00
Prashant
6dd481de1f Add attr_reader for dont_gc 2016-11-05 20:37:08 -04:00
Prashant
f1810153c5 Fix the filenames in the gemspec file 2016-10-24 23:20:47 -04:00
Prashant
262675fa4e Change version number to reflect change of filenames 2016-10-24 23:19:51 -04:00
Prashant Anantharaman
971e4e4f70 Change documentation and examples to reflect filename change 2016-09-11 10:05:18 -07:00
Prashant Anantharaman
7b4d208bf3 Change filenames to hammer-parser.rb 2016-09-11 09:48:05 -07:00
Prashant Anantharaman
257ba3ff7d Add email, home page and license to gemspec 2016-09-09 10:33:50 -07:00
Prashant Anantharaman
b86349fde7 Add more documentation for Ruby binding 2016-09-09 10:23:29 -07:00
Steven Dee
2b6b300f91 Custom printers for user token types
I did this in a hurry, but it appears to work locally. I tested it with
a couple boring custom token type printers.
2016-08-12 15:30:30 -04:00
TQ Hirsch
5abdeea9b8 Fix clobbered variable warning in regex.c:run_trace. Fixes #162 2016-08-10 16:20:07 +02:00
nicolas
39e101df03 Note for later about windows port 2016-05-22 13:33:55 +02:00
nicolas
88420038f9 Replace all double quotes with single quotes
To homogenize the file and allow keys/strings to be searched easily.
2016-05-22 13:33:46 +02:00
nicolas
69d3e70211 Port scons build files for Windows users
We disable:
- the tests (which require glib) although they can be
  reactivated with the `--tests` command line flag
- shared library (lack of export symbol declarations
  means that although it can be built, no symbol is
  exported and therefore it can't be used)

The `install` target installs the library and headers
under the `build` folder, because it's a traditional practice
to move libraries to a central location on Windows, unless
you are using cygwin. In which case pass `prefix` to the
command line.

We adapt tools\windows\build_examples.bat to take the library
that is built using scons or using tools\windows\build.bat
2016-05-22 13:29:12 +02:00
Meredith L. Patterson
9ee4fbd87c backports swig is named swig3.0, so fix that across bindings 2016-02-25 23:21:12 +01:00
Nicolas Léveillé
9a7752b9a6 Finish porting hammer's library to windows
We port registry by importing the (public domain) openbsd implementation
of the tfind/tsearch POSIX binary tree search functions.

These are only necessary when building on non-posix platforms
2016-01-31 17:27:19 +01:00
Nicolas Léveillé
206f5044a8 Remove warning about tail "potentially uninitialized"
MSVC was complaining that the `tail` variable was potentially
uninitialized in the while branch. Since the while loop is actually
coupled to the if (head != NULL) that initializes the tail variable,
we move them together, which makes the warning disappear.
2016-01-31 16:55:17 +01:00
Sven M. Hallberg
30cc709b8c add SLOB allocator 2015-12-27 14:45:21 +01:00
Nicolas Léveillé
62d793b939 Remove warning about parser signature being wrong 2015-12-20 11:51:01 +01:00
Nicolas Léveillé
c95b2987b1 Support variable array length instantiation on MSVC
As MSVC doesn't implement C99, variable-length arrays
are not supported. We use _alloca instead.
2015-12-20 11:50:58 +01:00
Sven M. Hallberg
50a73f6ab2 Merge remote-tracking branch 'upstream/master' into fix-wrong_bit_length 2015-12-07 11:05:05 +01:00
Sven M. Hallberg
d28f182c4f clear arena exception handler when exiting llk_parse_chunk_ 2015-12-04 13:28:26 +01:00
Sven M. Hallberg
9602caf64f test out-of-memory handling with a mock allocator 2015-12-02 14:10:12 +01:00
Sven M. Hallberg
7b13a82851 add __m variants to some check macros 2015-12-02 13:28:24 +01:00
Sven M. Hallberg
db4fd66eaf try it with a smaller alloc 2015-12-01 18:12:21 +01:00
Sven M. Hallberg
e89d9f9134 delete results properly in parser test macros 2015-12-01 17:51:45 +01:00
Sven M. Hallberg
22b5611cdf add oom handling to iterative LR engine 2015-12-01 17:10:47 +01:00
Sven M. Hallberg
384a7b9390 reset arena jmp_bufs at end of h_llk_parse_chunk 2015-12-01 17:07:04 +01:00
Sven M. Hallberg
3ce4f61cf9 add test for out-of-memory handling 2015-12-01 16:56:08 +01:00
Sven M. Hallberg
2309bd6da9 out-of-memory support for iterative LL(k) 2015-12-01 16:48:01 +01:00
Sven M. Hallberg
d5f3e13309 out-of-memory handling in LL(k), LR, and GLR backends 2015-11-30 18:07:33 +01:00
Sven M. Hallberg
5996477a5e out-of-memory handling in packrat backend 2015-11-30 18:01:23 +01:00
Sven M. Hallberg
3fc56a0dc3 add h_alloc() which calls errx() on failure and use it for all basic allocation
Rationale: "Basic allocation" refers to things outside of parsing proper,
mostly initialization. If such allocations fail, the system is globally
emory-starved from which it will likely not recover by returning failure.
In this case, terminating the process is in fact the most robust strategy as
it may mean the difference between a permanent hang and a temporary crash.
2015-11-30 16:37:00 +01:00
Sven M. Hallberg
ca1d8df06c don't allocate a new arena in h_bind, use the existing one
Rationale: If memory allocation fails in the inner parse and we
longjump up the stack, the temporary arena will be missed and leak.

NB: This change means that any allocations done by the continuation
(in the form of new parsers, probably) will persist for the
lifetime of the parse result. Beware of wasting too much memory
this way! The bind continuation should generally keep dynamic
allocations to a minimum.
2015-11-30 14:19:40 +01:00
Sven M. Hallberg
5b3cb46c96 avoid GCC warning about potential longjmp clobbers 2015-11-14 23:26:04 +01:00
Sven M. Hallberg
6aa7db833e Merge remote-tracking branch 'upstream/master' into fix-alloc-failures 2015-11-14 23:24:06 +01:00