summaryrefslogtreecommitdiffstats
path: root/eo_tokenizer.rl
diff options
context:
space:
mode:
Diffstat (limited to 'eo_tokenizer.rl')
-rw-r--r--eo_tokenizer.rl21
1 files changed, 14 insertions, 7 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl
index f2ffddb..8a1f57a 100644
--- a/eo_tokenizer.rl
+++ b/eo_tokenizer.rl
@@ -23,17 +23,22 @@ _eo_tokenizer_abort(Eo_Tokenizer *toknz,
variable eof toknz->eof;
action inc_line {
- /* DBG("inc[%d]", toknz->cs); */
toknz->current_line += 1;
+ DBG("inc[%d] %d", toknz->cs, toknz->current_line);
}
- action save_start_line {
- /* DBG("save[%d] %d", toknz->cs, toknz->current_line); */
- toknz->token_start_line = toknz->current_line;
+ action save_line {
+ toknz->saved.line = toknz->current_line;
+ DBG("save[%d] %d", toknz->cs, toknz->current_line);
+ }
+
+ action save_fpc {
+ toknz->saved.tok = fpc;
+ DBG("save[%d] %d", toknz->cs, fpc);
}
action show_comment {
- DBG("comment[%d] %03d:%03d", toknz->cs, toknz->token_start_line, toknz->current_line);
+ DBG("comment[%d] %03d:%03d", toknz->cs, toknz->saved.line, toknz->current_line);
}
action show_ignore {
@@ -63,7 +68,7 @@ _eo_tokenizer_abort(Eo_Tokenizer *toknz,
c_comment = "/*" ( any | '\n' @inc_line )* :>> "*/";
cpp_comment = "//" (any - cr)* newline;
- comment = ( c_comment | cpp_comment ) > save_start_line;
+ comment = ( c_comment | cpp_comment ) > save_line;
}%%
@@ -163,7 +168,9 @@ eo_tokenizer_get()
toknz->max_nesting = 10;
toknz->current_line = 1;
toknz->current_nesting = 0;
- toknz->token_start_line = 0;
+ toknz->saved.tok = NULL;
+ toknz->saved.line = 0;
+ toknz->classes = NULL;
return toknz;
}