]> ocean-lang.org Git - ocean/blobdiff - csrc/scanner.mdc
scanner: fix at_son()
[ocean] / csrc / scanner.mdc
index 84eaf4af60f427d7f7f90adc7753833b786894b1..fa27a89524a85d4eeb9a16019558e61a993afb5f 100644 (file)
@@ -934,6 +934,7 @@ a flag that tells us whether or not we need to strip.
        int    offset;
        int    line;
        int    col;
+       int    strip_offset;
 
 ###### internal functions
 
@@ -973,6 +974,7 @@ a flag that tells us whether or not we need to strip.
                                return WEOF;
                        state->line = state->node->line_no;
                        state->col = do_strip(state);
+                       state->strip_offset = state->offset;
                }
 
                ## before get_char
@@ -1126,7 +1128,7 @@ differently there.
 
        static int at_son(struct token_state *state)
        {
-               return state->offset == 0;
+               return state->prev_offset <= state->strip_offset;
        }
 
        static int at_eon(struct token_state *state)
@@ -1210,6 +1212,7 @@ As well as getting tokens, we need to be able to create the
                state->node = code;
                state->line = code->line_no;
                state->col = do_strip(state);
+               state->strip_offset = state->offset;
                state->conf = conf;
                return state;
        }