I am trying to define a simple mode for Bitcoin Script. However, I struggle with the indention for control flow statements. The ELSE keyword should basically indent and dedent at the same time to achieve the following:
OP_IF
OP_ADD
OP_ELSE
OP_ADD
OP_ENDIF
OP_ADD
With my current configuration
CodeMirror.defineSimpleMode('script', {
start: [
// ...
{ regex: /OP\_(IF|NOTIF|ELSE)\b/i, token: 'keyword', indent: true },
{ regex: /OP\_(ENDIF)\b/i, token: 'keyword', dedent: true },
// ...
],
});
I get the following
OP_IF
OP_ADD
OP_ELSE
OP_ADD
OP_ENDIF
OP_ADD
How can I solve this?