Prettify.CreateSimpleLexer(java.util.List<java.util.List<java.lang.Object>> shortcutStylePatterns,
java.util.List<java.util.List<java.lang.Object>> fallthroughStylePatterns)
Given triples of [style, pattern, context] returns a lexing function,
The lexing function interprets the patterns to find token boundaries and
returns a decoration list of the form
[index_0, style_0, index_1, style_1, ..., index_n, style_n]
where index_n is an index into the sourceCode, and style_n is a style
constant like PR_PLAIN.
Method Summary
void
decorate(Job job)
Lexes job.sourceCode and produces an output array job.decorations of
style classes preceded by the position at which they start in
job.sourceCode in order.
Given triples of [style, pattern, context] returns a lexing function,
The lexing function interprets the patterns to find token boundaries and
returns a decoration list of the form
[index_0, style_0, index_1, style_1, ..., index_n, style_n]
where index_n is an index into the sourceCode, and style_n is a style
constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
all characters in sourceCode[index_n-1:index_n].
The stylePatterns is a list whose elements have the form
[style : string, pattern : RegExp, DEPRECATED, shortcut : string].
Style is a style constant like PR_PLAIN, or can be a string of the
form 'lang-FOO', where FOO is a language extension describing the
language of the portion of the token in $1 after pattern executes.
E.g., if style is 'lang-lisp', and group 1 contains the text
'(hello (world))', then that portion of the token will be passed to the
registered lisp handler for formatting.
The text before and after group 1 will be restyled using this decorator
so decorators should take care that this doesn't result in infinite
recursion. For example, the HTML lexer rule for SCRIPT elements looks
something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
'