Menu

Provide "sub-highlighting"

2018-04-09
2018-04-09
  • Hendrik Degener

    Hendrik Degener - 2018-04-09

    Hi,
    at the moment, the highlighters are processed on a first-come first-serve basis (which is nice) and define their result's start and end using styled blocks. However, it's not possible to override certain subsets of such a styled block. This would come in very handy for languages such as PHP, bash or powershell which provide variable expansion in strings.
    As it is right now, a proper handling of strings such as "$nr1 + $nr2 = $result" with proper handling of the embedded variables causes overhead for the user in writing a customized Highlighter or WholeHighlighter. Furthermore, if you have multiple-level overriding, it soon becomes ugly, consider for example "$nr1 + $nr2 = expr $nr1 + $nr2". A nice way of handling this would be a tree-based approach for the main highlight function. I.e. leave the highlighting logic as it is, but move the CharIter only one step forward for each loop and for every position store every (Styled)Block with its respective start position. What you will get is a cascading list of highlighting information that you can resolve depending on the highlighter hierarchy.
    Have you ever thought of this?

     
  • Hendrik Degener

    Hendrik Degener - 2018-04-09

    backticks were removed... "$nr1 + $nr2 = $(expr $nr1 + $nr2)"

     

Log in to post a comment.