I love the idea of yi and decided to try to make a syntax-based 
highlighting mode for it.
I started with HTML since that should be easy;  my efforts are on github:

  
https://github.com/travitch/yi/blob/html-mode/yi/src/library/Yi/Syntax/HTML.hs

I plan on setting up tag matching to highlight badly-nested tags, but right 
now the
parser only produces a list of open tags, close tags, text nodes, and 
comment nodes.
It works fine and looks great for small files, but anything large chokes 
it.  By "chokes",
I mean that enabling the mode and running 'yi /tmp/test.html' on a file 
with more than a
few dozen lines pegs a CPU for longer than I've had the patience to wait 
(it also starts
allocating all of my memory).

Are there any guidelines I should follow to make an efficient syntax-based 
mode?

I don't really understand the incremental parser, but I feel like 
re-parsing the file
each time might be more efficient than what I am seeing.  I also notice 
this same
behavior with the Javascript mode (which isn't surprising, since my mode 
looks
very similar).  The "clever" haskell mode seems much more resilient to 
large files,
but I don't see any huge differences.

-- 
-- 
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel
--- 
You received this message because you are subscribed to the Google Groups 
"yi.devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to yi-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to