mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 22:00:28 +01:00
Merge remote-tracking branch 'github/master' into Tree
This commit is contained in:
@@ -17,6 +17,8 @@ constexpr KDColor OperatorColor = KDColor::RGB24(0xd73a49);
|
||||
constexpr KDColor StringColor = KDColor::RGB24(0x032f62);
|
||||
constexpr KDColor BackgroundColor = KDColorWhite;
|
||||
|
||||
static inline int min(int x, int y) { return (x<y ? x : y); }
|
||||
|
||||
static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
if (tokenKind == MP_TOKEN_STRING) {
|
||||
return StringColor;
|
||||
@@ -36,7 +38,7 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
return KDColorBlack;
|
||||
}
|
||||
|
||||
static inline int TokenLength(mp_lexer_t * lex) {
|
||||
static inline size_t TokenLength(mp_lexer_t * lex) {
|
||||
if (lex->tok_kind == MP_TOKEN_STRING) {
|
||||
return lex->vstr.len + 2;
|
||||
}
|
||||
@@ -122,7 +124,7 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
* basis. This can work, however the MicroPython lexer won't accept a line
|
||||
* starting with a whitespace. So we're discarding leading whitespaces
|
||||
* beforehand. */
|
||||
int whitespaceOffset = 0;
|
||||
size_t whitespaceOffset = 0;
|
||||
while (text[whitespaceOffset] == ' ' && whitespaceOffset < length) {
|
||||
whitespaceOffset++;
|
||||
}
|
||||
@@ -130,8 +132,8 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
mp_lexer_t * lex = mp_lexer_new_from_str_len(0, text + whitespaceOffset, length - whitespaceOffset, 0);
|
||||
LOG_DRAW("Pop token %d\n", lex->tok_kind);
|
||||
|
||||
int tokenFrom = 0;
|
||||
int tokenLength = 0;
|
||||
size_t tokenFrom = 0;
|
||||
size_t tokenLength = 0;
|
||||
KDColor tokenColor = KDColorBlack;
|
||||
|
||||
while (lex->tok_kind != MP_TOKEN_NEWLINE && lex->tok_kind != MP_TOKEN_END) {
|
||||
|
||||
Reference in New Issue
Block a user