Plan 9: Code Assist (Rio)
This is part 2 of my vision of Plan 9 as an Infinity Notebook . This focuses on the developer tools expanding on these ideas . Syntax Highlight Highlight comment, string and keywords. This is triggered on demand presently. For more advanced rendering requirements, use plot . In general, syntax highlighting is a computing intensive operation. Each character needs an attribute to store font size, weight, slant and color attributes. Font attributes affect which font file (regular, bold, italic or bold-italic version) is used for rendering. Each of this also affects the box size calculations for line wrap. This implementation uses a simpler approach using spans to store color information: Scanner : table-driven matchers ( mblock , mline , mstring , mident ), first match wins, each returns a length and a class. Classes : one {name, rgba, img} table indexed by an enum, initialized once. Output : waddcolorspanclass stores sorted spans; spanfirst finds the first overlapping one. Render...