summaryrefslogtreecommitdiff
path: root/py/parse2.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-08-30 11:51:25 +1000
committerDamien George <damien.p.george@gmail.com>2017-08-30 11:51:25 +1000
commit414537711dd05531c63eb830bfc9c3eecf657b1e (patch)
treee885b26c0e1ef94b189955546015893d704aaa1e /py/parse2.h
parent39b465ca831d0ec866c2a137dccbfec7f7badfba (diff)
py: Add MICROPY_USE_SMALL_HEAP_COMPILER option, disabled by default.
This new option allows the original and new parser/compiler to coexist.
Diffstat (limited to 'py/parse2.h')
-rw-r--r--py/parse2.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/py/parse2.h b/py/parse2.h
index 82d963945..55b05e062 100644
--- a/py/parse2.h
+++ b/py/parse2.h
@@ -23,14 +23,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_PY_PARSE_H
-#define MICROPY_INCLUDED_PY_PARSE_H
+#ifndef MICROPY_INCLUDED_PY_PARSE2_H
+#define MICROPY_INCLUDED_PY_PARSE2_H
#include <stddef.h>
#include <stdint.h>
#include "py/obj.h"
+#if MICROPY_USE_SMALL_HEAP_COMPILER
+
struct _mp_lexer_t;
#define MP_PT_NULL (0)
@@ -42,6 +44,8 @@ struct _mp_lexer_t;
#define MP_PT_ID_BASE (10) // +16
#define MP_PT_RULE_BASE (26) // +173-ish
+typedef const byte *mp_parse_node_t;
+
extern const byte pt_const_int0[];
static inline const byte *pt_tok_extract(const byte *p, byte *tok) {
@@ -130,4 +134,6 @@ typedef struct _mp_parse_t {
mp_parse_tree_t mp_parse(struct _mp_lexer_t *lex, mp_parse_input_kind_t input_kind);
void mp_parse_tree_clear(mp_parse_tree_t *tree);
-#endif // MICROPY_INCLUDED_PY_PARSE_H
+#endif // MICROPY_USE_SMALL_HEAP_COMPILER
+
+#endif // MICROPY_INCLUDED_PY_PARSE2_H