aboutsummaryrefslogtreecommitdiff
path: root/py/lexer.h
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-09 15:09:52 +0100
committerDamien <damien.p.george@gmail.com>2013-10-09 15:09:52 +0100
commit91d387de7df9e19bb5b00e6ad4c94790eb3422e3 (patch)
tree1af3603b73c8ab1b2dd917f1654548fc0f1aaafb /py/lexer.h
parentff8ed77cc12f707b6b0eb78ccc02bafb20bdf248 (diff)
Improve indent/dedent error checking and reporting.
Diffstat (limited to 'py/lexer.h')
-rw-r--r--py/lexer.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/py/lexer.h b/py/lexer.h
index 32ab48a08..948901259 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -12,20 +12,21 @@ typedef enum _py_token_kind_t {
PY_TOKEN_END, // 0
PY_TOKEN_INVALID,
+ PY_TOKEN_DEDENT_MISMATCH,
PY_TOKEN_LONELY_STRING_OPEN,
- PY_TOKEN_NEWLINE, // 3
- PY_TOKEN_INDENT, // 4
- PY_TOKEN_DEDENT, // 5
+ PY_TOKEN_NEWLINE, // 4
+ PY_TOKEN_INDENT, // 5
+ PY_TOKEN_DEDENT, // 6
- PY_TOKEN_NAME, // 6
+ PY_TOKEN_NAME, // 7
PY_TOKEN_NUMBER,
PY_TOKEN_STRING,
PY_TOKEN_BYTES,
PY_TOKEN_ELLIPSES,
- PY_TOKEN_KW_FALSE, // 11
+ PY_TOKEN_KW_FALSE, // 12
PY_TOKEN_KW_NONE,
PY_TOKEN_KW_TRUE,
PY_TOKEN_KW_AND,
@@ -34,7 +35,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_KW_BREAK,
PY_TOKEN_KW_CLASS,
PY_TOKEN_KW_CONTINUE,
- PY_TOKEN_KW_DEF, // 20
+ PY_TOKEN_KW_DEF, // 21
PY_TOKEN_KW_DEL,
PY_TOKEN_KW_ELIF,
PY_TOKEN_KW_ELSE,
@@ -44,7 +45,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_KW_FROM,
PY_TOKEN_KW_GLOBAL,
PY_TOKEN_KW_IF,
- PY_TOKEN_KW_IMPORT, // 30
+ PY_TOKEN_KW_IMPORT, // 31
PY_TOKEN_KW_IN,
PY_TOKEN_KW_IS,
PY_TOKEN_KW_LAMBDA,
@@ -54,12 +55,12 @@ typedef enum _py_token_kind_t {
PY_TOKEN_KW_PASS,
PY_TOKEN_KW_RAISE,
PY_TOKEN_KW_RETURN,
- PY_TOKEN_KW_TRY, // 40
+ PY_TOKEN_KW_TRY, // 41
PY_TOKEN_KW_WHILE,
PY_TOKEN_KW_WITH,
PY_TOKEN_KW_YIELD,
- PY_TOKEN_OP_PLUS, // 44
+ PY_TOKEN_OP_PLUS, // 45
PY_TOKEN_OP_MINUS,
PY_TOKEN_OP_STAR,
PY_TOKEN_OP_DBL_STAR,
@@ -69,7 +70,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_OP_LESS,
PY_TOKEN_OP_DBL_LESS,
PY_TOKEN_OP_MORE,
- PY_TOKEN_OP_DBL_MORE, // 54
+ PY_TOKEN_OP_DBL_MORE, // 55
PY_TOKEN_OP_AMPERSAND,
PY_TOKEN_OP_PIPE,
PY_TOKEN_OP_CARET,
@@ -79,7 +80,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_OP_DBL_EQUAL,
PY_TOKEN_OP_NOT_EQUAL,
- PY_TOKEN_DEL_PAREN_OPEN, // 63
+ PY_TOKEN_DEL_PAREN_OPEN, // 64
PY_TOKEN_DEL_PAREN_CLOSE,
PY_TOKEN_DEL_BRACKET_OPEN,
PY_TOKEN_DEL_BRACKET_CLOSE,
@@ -89,7 +90,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_DEL_COLON,
PY_TOKEN_DEL_PERIOD,
PY_TOKEN_DEL_SEMICOLON,
- PY_TOKEN_DEL_AT, // 73
+ PY_TOKEN_DEL_AT, // 74
PY_TOKEN_DEL_EQUAL,
PY_TOKEN_DEL_PLUS_EQUAL,
PY_TOKEN_DEL_MINUS_EQUAL,
@@ -99,7 +100,7 @@ typedef enum _py_token_kind_t {
PY_TOKEN_DEL_PERCENT_EQUAL,
PY_TOKEN_DEL_AMPERSAND_EQUAL,
PY_TOKEN_DEL_PIPE_EQUAL,
- PY_TOKEN_DEL_CARET_EQUAL, // 83
+ PY_TOKEN_DEL_CARET_EQUAL, // 84
PY_TOKEN_DEL_DBL_MORE_EQUAL,
PY_TOKEN_DEL_DBL_LESS_EQUAL,
PY_TOKEN_DEL_DBL_STAR_EQUAL,
@@ -137,5 +138,6 @@ bool py_lexer_opt_kind(py_lexer_t *lex, py_token_kind_t kind);
bool py_lexer_opt_str(py_lexer_t *lex, const char *str);
*/
bool py_lexer_show_error(py_lexer_t *lex, const char *msg);
+bool py_lexer_show_error_pythonic(py_lexer_t *lex, const char *msg);
#endif /* INCLUDED_LEXER_H */