]> granicus.if.org Git - re2c/commitdiff
Skeleton: respect fixed-length contexts.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Mar 2016 21:45:42 +0000 (21:45 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Mar 2016 21:45:42 +0000 (21:45 +0000)
re2c/src/ir/skeleton/path.h

index 5cb83d1aa5cbe9728a5d29f6b2ccd1ba047bdc0a..a3452fdf9bdba31c26ebc79b1749137f0995ab63 100644 (file)
@@ -49,9 +49,14 @@ public:
        }
        size_t len_matching () const
        {
-               return rule && rule->ctx_len == ~0u
-                       ? ctx_pos
-                       : rule_pos;
+               if (rule) {
+                       switch (rule->ctx_len) {
+                               case 0:   return rule_pos;
+                               case ~0u: return ctx_pos;
+                               default:  return rule_pos - rule->ctx_len;
+                       }
+               }
+               return 0;
        }
        rule_rank_t match () const
        {