tajmone / ST4-Asciidoctor

AsciiDoc Package for SublimeText 4
https://tajmone.github.io/ST4-Asciidoctor
MIT License
11 stars 6 forks source link

Group One-liner Bracketed Constructs #53

Open tajmone opened 6 months ago

tajmone commented 6 months ago

We should group together all the contexts for «one-liner constructs» in order to disentangle the Syntax, on the one hand, and to optimize its performance, on the other.

The obvious place to start is by grouping those constructs which consist of a single line within square brackets ([ … ]).

Since AsciiDoc supports many such constructs, it would probably make sense to add a «top-level interceptor context» that matches — without consuming — any line which begins with an opening square bracket and end with a matching closing bracket, and in case of a match then push a dedicated context that will attempt all the pertaining pattern-matching contexts for such one-liners.

This should increase the performance of the Syntax, since it will only attempt a single RegEx at each non-matching input line, instead of trying each and every one-liner context.