LGUI2:Text Scanners

From Lavish Software Wiki
Jump to navigation Jump to search

A LavishGUI 2 Text Scanner selects a Text Type and any related options for decorating text, such as colors and fonts for special portions of text (for example, syntax highlighting).

Each LavishGUI 2 Element with Text (any commandbox, textbox, textblock) can have its own Text Scanner defined.


Defining a Text Scanner

A Text Scanner is defined as a JSON Object, usually as part of an Element (currently including commandbox, textbox, textblock)


Text Scanner properties
type The Text Type, usually a type of container, to process text as
<type_name> An object specifying optional "color", "backgroundBrush" and "font" properties for a specified type
<type_name> ... (same as above, any number of these may be present)


Examples

A LavishScript 1 command lines Text Scanner, with background colors specified for Data Sequence, Index, and Type Casts
"textScanner": {
  "type": "ls1_commandlines",
  "ls1_commandline": { "color": [ 0.8,1.0,0.8] },
  "ls1_${": { "color": [ 1.0, 1.0, 0.0 ] },
  "ls1_$": { "color": [ 1.0,0.2,0.2 ] },
  "ls1_}": { "color": [ 1.0, 1.0, 0.0 ] },
  "ls1_[": { "color": [ 1.0, 0.5, 0.5 ] },
  "ls1_]": { "color": [ 1.0, 0.5, 0.5 ] },
  "ls1_(": { "color": [ 0.5, 0.5, 1.0 ] },
  "ls1_)": { "color": [ 0.5, 0.5, 1.0 ] },
  "ls1_,": { "color": [ 1.0, 0.5, 0.5 ] },
  "ls1_\"": { "color": [ 1.0, 0.5, 0.0 ] },
  "escape": { "color": [ 0.5, 0.5, 0.5 ] },
  "ls1_datasequence_inner": { },
  "ls1_datasequence": { "backgroundBrush": { "color": [ 0.2, 0.2, 0.0 ] } },
  "ls1_index": { "backgroundBrush": { "color": [ 0.2, 0.1, 0.1 ] } },
  "ls1_typecast": { "backgroundBrush": { "color": [ 0.1, 0.1, 0.2 ] } },
  "ls1_index_inner": { },
  "ls1_quoted": { },
  "ls1_other": { },
  "ls1_commandlines": { }
  }

This example requires loading relevant Text Types.


LavishGUI 2 Text Types

Built-in
any - container - crlf - escape - plain
User-defined only
character - sequence

LavishGUI 2 Topics