rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.35k stars 739 forks source link

Support multiple states when parsing rules #2078

Closed tancnle closed 1 week ago

tancnle commented 1 month ago

Prior to this change, we can only push one state per rule. Many lexers need multiple states to work as expected. For example, some languages allow multiline comments to be nested.

For example, if we want to match a comment containing a directive, something like:

/* <processing directive>    rest of comment */

This also allows us to have parity with Pygments support of multiple states .