I have the following rule in a complex grammar:
rule predicate {
:my rule _in_expr { <IN> '(' [ <subselect> | <expr_list> ] ')' }
[
<AND> <bit_expr> <BETWEEN> <not>?
|
<bit_expr>
]
[
<_in_expr>
|
<not> [
<_in_expr>
|
<LIKE> <simple_expr> <escape>?
|
<REGEXP> <bit_expr>
]
|
[ <SOUNDS> <LIKE> | <REGEXP> ] <bit_expr>
|
<LIKE> <simple_expr> <escape>?
]?
}
If I want to improve the readability, can I expand it to multiple lines using the ':' strategy?
rule predicate {
:my rule _in_expr {
: <IN> '(' [
: <subselect>
: |
: <expr_list>
: ] ')'
:}
[
<AND> <bit_expr> <BETWEEN> <not>?
|
<bit_expr>
]
[
<_in_expr>
|
<not> [
<_in_expr>
|
<LIKE> <simple_expr> <escape>?
|
<REGEXP> <bit_expr>
]
|
[ <SOUNDS> <LIKE> | <REGEXP> ] <bit_expr>
|
<LIKE> <simple_expr> <escape>?
]?
}
You only need a single
:
, not one prefixed to each line. You'll be back in the grammar slang after a statement terminator, ie a;
or a closing brace followed by a newline: