X-Git-Url: https://ocean-lang.org/code/?a=blobdiff_plain;f=csrc%2Fscanner.mdc;h=15306dd17494245986dbd014ebd2a2c8693c977d;hb=1330688ecf4b573ec82fc21309113dc5c35be75c;hp=0d7a62d05127697cfdfed7ff207dd923de60c69c;hpb=3ff33c4eecc9cce64827d52172c85123faac8b1c;p=ocean diff --git a/csrc/scanner.mdc b/csrc/scanner.mdc index 0d7a62d..15306dd 100644 --- a/csrc/scanner.mdc +++ b/csrc/scanner.mdc @@ -1068,8 +1068,11 @@ parsed too much already. For that there is `reset_token`. static void close_token(struct token_state *state, struct token *tk) { - tk->txt.len = (state->node->code.txt + state->offset) - - tk->txt.txt; + if (state->node != tk->node) + tk->txt.len = tk->node->code.len - (tk->txt.txt - tk->node->code.txt); + else + tk->txt.len = (state->node->code.txt + state->offset) + - tk->txt.txt; } static void reset_token(struct token_state *state, struct token *tok)