Merge branch 'python-bindings' of https://github.com/thequux/hammer into python-bindings

Conflicts:
	src/bindings/python/SConscript
	src/bindings/python/hammer_tests.py
	src/bindings/swig/hammer.i
	src/hammer.h
This commit is contained in:
Meredith L. Patterson 2013-11-26 11:25:22 -08:00
commit 2ee82f3ac7
33 changed files with 822 additions and 328 deletions

View file

@ -1,3 +1,8 @@
/*
* NOTE: This is an internal header and installed for use by extensions. The
* API is not guaranteed stable.
*/
// This is an internal header; it provides macros to make desugaring cleaner.
#include <assert.h>
#include "../internal.h"

View file

@ -372,13 +372,13 @@ HParseResult *h_llk_parse(HAllocator* mm__, const HParser* parser, HInputStream*
// perform token reshape if indicated
if(x->reshape)
tok = (HParsedToken *)x->reshape(make_result(arena, tok));
tok = (HParsedToken *)x->reshape(make_result(arena, tok), x->user_data);
// call validation and semantic action, if present
if(x->pred && !x->pred(make_result(tarena, tok)))
if(x->pred && !x->pred(make_result(tarena, tok), x->user_data))
goto no_parse; // validation failed -> no parse
if(x->action)
tok = (HParsedToken *)x->action(make_result(arena, tok));
tok = (HParsedToken *)x->action(make_result(arena, tok), x->user_data);
// append to result sequence
h_carray_append(seq, tok);

View file

@ -307,13 +307,13 @@ bool h_lrengine_step(HLREngine *engine, const HLRAction *action)
// perform token reshape if indicated
if(symbol->reshape)
value = (HParsedToken *)symbol->reshape(make_result(arena, value));
value = (HParsedToken *)symbol->reshape(make_result(arena, value), symbol->user_data);
// call validation and semantic action, if present
if(symbol->pred && !symbol->pred(make_result(tarena, value)))
if(symbol->pred && !symbol->pred(make_result(tarena, value), symbol->user_data))
return false; // validation failed -> no parse; terminate
if(symbol->action)
value = (HParsedToken *)symbol->action(make_result(arena, value));
value = (HParsedToken *)symbol->action(make_result(arena, value), symbol->user_data);
// this is LR, building a right-most derivation bottom-up, so no reduce can
// follow a reduce. we can also assume no conflict follows for GLR if we

View file

@ -1,3 +1,8 @@
/*
* NOTE: This is an internal header and installed for use by extensions. The
* API is not guaranteed stable.
*/
// Internal defs
#ifndef HAMMER_BACKEND_REGEX__H
#define HAMMER_BACKEND_REGEX__H