Posts

Showing posts with the label syntax-highlight

Plan 9: Code Assist (Rio)

Image
  This is part 2 of my vision of Plan 9 as an Infinity Notebook . This focuses on the developer tools expanding on these ideas . Text color   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...

Semantic font-lock for Java in Emacs

Image
I've been working on Semantic font-lock for Java using CEDET Semantic infrastructure which uses Wisent incremental parsing under the hood. Also it only highlights the visible text on the screen to keep the delays acceptable. So far the results look promising. Builtin font-lock uses jit-lock infrastructure. cc-mode provides the keywords and regexes for language specific highlighting. However, this lacks highlighting using any contextual information. Demo: https://youtu.be/4UcPIdTJLOM Noticeable features: Static variables and functions are highlighted differently. Constant variables are highlighted differently. Not only the declaration, but the usages are highlighted also. Package is highlighted correctly. It uses following face definitions for highlighting. (defvar semantic-format-face-alist `( (function . font-lock-function-name-face) (variable . font-lock-variable-name-face) (type . font-lock-type-face) ;; These are differe...