]> git.mdlowis.com Git - archive/tide-hl.git/commitdiff
Added logic to end range at end of chunk if range started but not ended
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 9 Mar 2018 21:10:07 +0000 (16:10 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 9 Mar 2018 21:10:07 +0000 (16:10 -0500)
.gitignore
colormap.ml
lex_cpp.mll
main.ml

index 463750a5a87dd425cf22aed20d9c119955d04a06..c9bcfaef12225d11edff3f3861c623ad46230146 100644 (file)
@@ -2,3 +2,4 @@
 *.o
 lex_*.ml
 tide-hl
+tide-hl.rb
index 68b398035cd3b6b920fd9ab365351e2e5d4bf029..535a706c3fdff787cfb8dc98af132851f8bff3d8 100644 (file)
@@ -44,4 +44,5 @@ let range_start ctx =
 
 let range_stop ctx clr =
   Printf.printf "%d,%d,%d\n"
-    ctx.pos (lexeme_end ctx.lbuf) (get_color clr)
+    ctx.pos (lexeme_end ctx.lbuf) (get_color clr);
+  ctx.pos <- (-1)
index 658b0da76d49b45f0bf09e74c898380cbfe47265..4ac935f2f604087c0826ca29ddafe3d35287756d 100644 (file)
@@ -57,6 +57,6 @@ and comment ctx = parse
   | eof  { raise Eof }
 
 and preproc ctx = parse
-  | sys_incl { set_color ctx Constant }
+  | sys_incl { set_color ctx String }
   | _        { (* skip *) }
   | eof      { raise Eof }
diff --git a/main.ml b/main.ml
index ae9631443b5744480838d08fa2cd1990f0069ee0..52c222698232139640e77fd55479db1b9120161f 100644 (file)
--- a/main.ml
+++ b/main.ml
@@ -36,6 +36,7 @@ let rec scan_string lexfn string =
   let ctx = Colormap.({ lbuf = lbuf; pos = 0; }) in
   try while true do lexfn ctx lbuf done
   with Colormap.Eof ->
+    if ctx.pos >= 0 then Colormap.range_stop ctx Comment;
     Printf.printf "0,0,0\n";
     flush stdout;
     scan_input lexfn