JavaFX Codeeditors – New features for Scanner rules (required to support eg Asciidoc)
Yesterday I worked on a cool addition required to develop syntax highlighting for things like Asciidoc.
Suppose you want to define lexical highlighting for Asciidoc you very likely have a rule like this:
lexical_highlighting {
// ...
rule __dftl_partition_content_type whitespace javawhitespace {
// ...
adoc_section_0 {
single_line "= "
}
// ...
}
// ...
}
But now suppose your asciidoc-File looks like this:
= This is a head line if a = b you're doing something wrong
the above rule would produce the following highlighting
which obivously is wrong. What our rule really has to express is
if a line starts with = (equal-sign) followed by a space
So the new addition I added the the ldef-DSL is that you can now define at which column in a line the rule has to start
lexical_highlighting {
// ...
rule __dftl_partition_content_type whitespace javawhitespace {
// ...
adoc_section_0 {
single_line "= " col eq 0
}
// ...
}
// ...
}
and now the result looks ok
This entry was posted in e(fx)clipse. Bookmark the permalink.
2 Responses to JavaFX Codeeditors – New features for Scanner rules (required to support eg Asciidoc)
Thanks a lot, I have crossposted this information (with some context) to the Asciidoctor ML:
http://discuss.asciidoctor.org/How-can-we-make-better-AsciidocFX-td3109.html#a3745
There is already a JavaFX tool called “AsciidocFX” to work on Asciidoc files. Maybe they should use your StyledTextArea component.
With this extension, is it possible to build a “Compensator” tool to edit and preview Asciidoc files? From the screenshot I guess you have something like that.
Are the sources availlable? Or even better for me an exe to test?
Pingback: JavaFX links of the week, September 28 // JavaFX News, Demos and Insight // FX Experience
This site uses Akismet to reduce spam. Learn how your comment data is processed.