aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tokenizer.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-10 18:30:44 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-10 18:31:20 -0700
commite34a8da5d727ba26aeddd64e9b60a41c0c5312d3 (patch)
tree611cd6eeeee7a3dd466d80566779abc94464e2dd /src/tokenizer.h
parent6157a9a85890d79521e77cb4e51d4d52793ac516 (diff)
Correct the positioning of the error caret
When an error occurs midway through a token, like abc(def, make the caret point at the location of the error (i.e. the paren) instead of at the beginning of the token.
Diffstat (limited to 'src/tokenizer.h')
-rw-r--r--src/tokenizer.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tokenizer.h b/src/tokenizer.h
index ff774d9b..dca8e5c2 100644
--- a/src/tokenizer.h
+++ b/src/tokenizer.h
@@ -79,13 +79,16 @@ struct tok_t
/* If an error, this is the error code */
enum tokenizer_error error;
+ /* If an error, this is the offset of the error within the token. A value of 0 means it occurred at 'offset' */
+ size_t error_offset;
+
/* Offset of the token */
size_t offset;
/* Length of the token */
size_t length;
- tok_t() : type(TOK_NONE), error(TOK_ERROR_NONE), offset(-1), length(-1) {}
+ tok_t() : type(TOK_NONE), error(TOK_ERROR_NONE), error_offset(-1), offset(-1), length(-1) {}
};
/**
@@ -119,13 +122,15 @@ class tokenizer_t
bool show_blank_lines;
/** Last error */
tokenizer_error error;
+ /** Last error offset, in "global" coordinates (relative to orig_buff) */
+ size_t global_error_offset;
/* Whether we are squashing errors */
bool squash_errors;
/* Whether to continue the previous line after the comment */
bool continue_line_after_comment;
- void call_error(enum tokenizer_error error_type, const wchar_t *error_message);
+ void call_error(enum tokenizer_error error_type, const wchar_t *where, const wchar_t *error_message);
void read_string();
void read_comment();
void tok_next();