aboutsummaryrefslogtreecommitdiff
path: root/py/lexer.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-07-25 13:15:54 +1000
committerDamien George <damien.p.george@gmail.com>2019-09-26 15:12:39 +1000
commit2069c563f9e944d8f45e524b425fff23208e8153 (patch)
tree97d78474d36e2283e6de86ef5d621b04ae03e87f /py/lexer.h
parent14e203282af6eb987edcbef746089cb906ebae30 (diff)
py: Add support for matmul operator @ as per PEP 465.
To make progress towards MicroPython supporting Python 3.5, adding the matmul operator is important because it's a really "low level" part of the language, being a new token and modifications to the grammar. It doesn't make sense to make it configurable because 1) it would make the grammar and lexer complicated/messy; 2) no other operators are configurable; 3) it's not a feature that can be "dynamically plugged in" via an import. And matmul can be useful as a general purpose user-defined operator, it doesn't have to be just for numpy use. Based on work done by Jim Mussared.
Diffstat (limited to 'py/lexer.h')
-rw-r--r--py/lexer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/py/lexer.h b/py/lexer.h
index 321185f10..34126a08f 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -106,7 +106,7 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_OP_MORE_EQUAL,
MP_TOKEN_OP_NOT_EQUAL,
- // Order of these 12 matches corresponding mp_binary_op_t operator
+ // Order of these 13 matches corresponding mp_binary_op_t operator
MP_TOKEN_OP_PIPE,
MP_TOKEN_OP_CARET,
MP_TOKEN_OP_AMPERSAND,
@@ -115,12 +115,13 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_OP_PLUS,
MP_TOKEN_OP_MINUS,
MP_TOKEN_OP_STAR,
+ MP_TOKEN_OP_AT,
MP_TOKEN_OP_DBL_SLASH,
MP_TOKEN_OP_SLASH,
MP_TOKEN_OP_PERCENT,
MP_TOKEN_OP_DBL_STAR,
- // Order of these 12 matches corresponding mp_binary_op_t operator
+ // Order of these 13 matches corresponding mp_binary_op_t operator
MP_TOKEN_DEL_PIPE_EQUAL,
MP_TOKEN_DEL_CARET_EQUAL,
MP_TOKEN_DEL_AMPERSAND_EQUAL,
@@ -129,6 +130,7 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_DEL_PLUS_EQUAL,
MP_TOKEN_DEL_MINUS_EQUAL,
MP_TOKEN_DEL_STAR_EQUAL,
+ MP_TOKEN_DEL_AT_EQUAL,
MP_TOKEN_DEL_DBL_SLASH_EQUAL,
MP_TOKEN_DEL_SLASH_EQUAL,
MP_TOKEN_DEL_PERCENT_EQUAL,
@@ -144,7 +146,6 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_DEL_COLON,
MP_TOKEN_DEL_PERIOD,
MP_TOKEN_DEL_SEMICOLON,
- MP_TOKEN_DEL_AT,
MP_TOKEN_DEL_EQUAL,
MP_TOKEN_DEL_MINUS_MORE,
} mp_token_kind_t;