@@ -917,33 +917,33 @@ the {link={https://en.wikipedia.org/wiki/Laziness}:lazy} dog"
917917
918918This macro can be described by the following EBNF grammar:
919919
920- ```ebnf
921- styledstring = { styled | interpolated | escaped | plain } ;
920+ ```styled
921+ {code: styledstring} {julia_assignment:=} {julia_type: \\ {} {code: styled} {julia_operator:|} {code: interpolated} {julia_operator:|} {code: escaped} {julia_operator:|} {code: plain} {julia_type: \\ }} {julia_comment:;}
922922
923- specialchar = '{' | '}' | '\$ ' | '\\\" ' ;
924- anychar = [ \\ u0- \\ u1fffff] ;
925- plain = { anychar - specialchar } ;
926- escaped = '\\\\ ', specialchar ;
923+ {code: specialchar} {julia_assignment:=} {julia_string:' \\ {'} {julia_operator:|} {julia_string:' \\ }'} {julia_operator:|} {julia_string: '\$ '} {julia_operator:|} {julia_string: '\\\" '} {julia_comment:;}
924+ {code: anychar} {julia_assignment:=} [{julia_char: \\ u0{julia_operator:-} \\ u1fffff}] {julia_comment:;}
925+ {code: plain} {julia_assignment:=} {julia_type: \\ {} {code: anychar} {julia_operator:-} {code: specialchar} {julia_type: \\ }} {julia_comment:;}
926+ {code: escaped} {julia_assignment:=} {julia_string: '\\\\ '}{light:,} {code: specialchar} {julia_comment:;}
927927
928- interpolated = '\$ ', ? expr ? | '\$ (', ? expr ?, ')' ;
928+ {code: interpolated} {julia_assignment:=} {julia_string: '\$ '}{light:,} {julia_macro: ? expr ?} {julia_operator:|} {julia_string: '\$ ('}{light:,} {julia_macro: ? expr ?}{light:,} {julia_string: ')'} {julia_comment:;}
929929
930- styled = '{', ws, annotations, ':', content, '}' ;
931- content = { interpolated | plain | escaped | styled } ;
932- annotations = annotation | annotations, ws, ',', ws, annotation ;
933- annotation = face | inlineface | keyvalue ;
934- ws = { ' ' | '\\ t' | '\\ n' } ; (* whitespace *)
930+ {code: styled} {julia_assignment:=} {julia_string:' \\ {'}{light:,} {code:ws}{light:,} {code: annotations}{light:,} {julia_string: ':'}{light:,} {code: content}{light:,} {julia_string:' \\ }'} {julia_comment:;}
931+ {code: content} {julia_assignment:=} {julia_type: \\ {} {code: interpolated} {julia_operator:|} {code: plain} {julia_operator:|} {code: escaped} {julia_operator:|} {code: styled} {julia_type: \\ }} {julia_comment:;}
932+ {code: annotations} {julia_assignment:=} {code: annotation} {julia_operator:|} {code: annotations}{light:,} {code:ws}{light:,} {julia_string: ','}{light:,} {code:ws}{light:,} {code: annotation} {julia_comment:;}
933+ {code: annotation} {julia_assignment:=} {code: face} {julia_operator:|} {code: inlineface} {julia_operator:|} {code: keyvalue} {julia_comment:;}
934+ {code:ws} {julia_assignment:=} {julia_type: \\ {} {julia_string: ' '} {julia_operator:|} {julia_string: '\\ t'} {julia_operator:|} {julia_string: '\\ n'} {julia_type: \\ }} {julia_comment: ; (* whitespace *)}
935935
936- face = facename | interpolated ;
937- facename = [A-Za-z0-9_]+ ;
936+ {code: face} {julia_assignment:=} {code: facename} {julia_operator:|} {code: interpolated} {julia_comment:;}
937+ {code: facename} {julia_assignment:=} [{julia_char:A{julia_operator:-}Za{julia_operator:-}z0{julia_operator:-}9_}]{julia_operator:+} {julia_comment:;}
938938
939- inlineface = '(', ws, [ faceprop ], { ws, ',', faceprop }, ws, ')' ;
940- faceprop = [a-z]+, ws, '=', ws, ( [^,)]+ | interpolated) ;
939+ {code: inlineface} {julia_assignment:=} {julia_string: '('}{light:,} {code:ws}{light:,} {julia_type:[} {code: faceprop} {julia_type:]}{light:,} {julia_type: \\ {} {code:ws}{light:,} {julia_string: ','}{light:,} {code: faceprop} {julia_type: \\ }}{light:,} {code:ws}{light:,} {julia_string: ')'} {julia_comment:;}
940+ {code: faceprop} {julia_assignment:=} [{julia_char:a{julia_operator:-}z}]{julia_operator:+}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} [{julia_operator:^}{julia_char:,)}]{julia_operator:+} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_comment:;}
941941
942- keyvalue = key, ws, '=', ws, value ;
943- key = ( [^ \\ 0\$ { }=,:], [^ \\ 0=,:]* ) | interpolated ;
944- value = simplevalue | curlybraced | interpolated ;
945- curlybraced = '{' { escaped | plain } '}' ;
946- simplevalue = [^ \$ { },:], [^,:]* ;
942+ {code: keyvalue} {julia_assignment:=} {code: key}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {code: value} {julia_comment:;}
943+ {code: key} {julia_assignment:=} {julia_type:(} [{julia_operator:^}{julia_char: \\ 0\$\\ { \\ }=,:}]{light:,} [{julia_operator:^}{julia_char: \\ 0=,:}]{julia_operator:*} {julia_type:)} {julia_operator:|} {code: interpolated} {julia_comment:;}
944+ {code: value} {julia_assignment:=} {code: simplevalue} {julia_operator:|} {code: curlybraced} {julia_operator:|} {code: interpolated} {julia_comment:;}
945+ {code: curlybraced} {julia_assignment:=} {julia_string:' \\ {'} {julia_type: \\ {} {code: escaped} {julia_operator:|} {code: plain} {julia_type: \\ }} {julia_string:' \\ }'} {julia_comment:;}
946+ {code: simplevalue} {julia_assignment:=} [{julia_operator:^}{julia_char: \$\\ { \\ },:}]{light:,} [{julia_operator:^}{julia_char:,:}]{julia_operator:*} {julia_comment:;}
947947```
948948
949949An extra stipulation not encoded in the above grammar is that `plain` should be
@@ -952,30 +952,30 @@ a valid input to [`unescape_string`](@ref), with `specialchar` kept.
952952The above grammar for `inlineface` is simplified, as the actual implementation
953953is a bit more sophisticated. The full behaviour is given below.
954954
955- ```ebnf
956- faceprop = ( 'face', ws, '=', ws, ( ? string ? | interpolated ) ) |
957- ( 'height', ws, '=', ws, ( ? number ? | interpolated ) ) |
958- ( 'weight', ws, '=', ws, ( symbol | interpolated ) ) |
959- ( 'slant', ws, '=', ws, ( symbol | interpolated ) ) |
960- ( ( 'foreground' | 'fg' | 'background' | 'bg' ) ,
961- ws, '=', ws, ( simplecolor | interpolated ) ) |
962- ( 'underline', ws, '=', ws, ( underline | interpolated ) ) |
963- ( 'strikethrough', ws, '=', ws, ( bool | interpolated ) ) |
964- ( 'inverse', ws, '=', ws, ( bool | interpolated ) ) |
965- ( 'inherit', ws, '=', ws, ( inherit | interpolated ) ) ;
966-
967- nothing = 'nothing' ;
968- bool = 'true' | 'false' ;
969- symbol = [^ ,)]+ ;
970- hexcolor = ( '#' | '0x'), [0-9a-f ]{6} ;
971- simplecolor = hexcolor | symbol | nothing ;
972-
973- underline = nothing | bool | simplecolor | underlinestyled;
974- underlinestyled = '(', ws, ('' | nothing | simplecolor | interpolated), ws ,
975- ',', ws, ( symbol | interpolated ), ws ')' ;
976-
977- inherit = ( '[', inheritval, { ',', inheritval }, ']' ) | inheritval;
978- inheritval = ws, ':'?, symbol ;
955+ ```styled
956+ {code: faceprop} {julia_assignment:=} {julia_type:(} {julia_string: 'face'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {julia_macro: ? string ?} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
957+ {julia_type:(} {julia_string: 'height'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {julia_macro: ? number ?} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
958+ {julia_type:(} {julia_string: 'weight'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: symbol} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
959+ {julia_type:(} {julia_string: 'slant'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: symbol} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
960+ {julia_type:(} {julia_type:(} {julia_string: 'foreground'} {julia_operator:|} {julia_string: 'fg'} {julia_operator:|} {julia_string: 'background'} {julia_operator:|} {julia_string: 'bg'} {julia_type:)} ,
961+ {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: simplecolor} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
962+ {julia_type:(} {julia_string: 'underline'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: underline} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
963+ {julia_type:(} {julia_string: 'strikethrough'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: bool} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
964+ {julia_type:(} {julia_string: 'inverse'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: bool} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_operator:|}
965+ {julia_type:(} {julia_string: 'inherit'}{light:,} {code:ws}{light:,} {julia_string: '='}{light:,} {code:ws}{light:,} {julia_type:(} {code: inherit} {julia_operator:|} {code: interpolated} {julia_type:)} {julia_type:)} {julia_comment:;}
966+
967+ {code: nothing} {julia_assignment:=} {julia_string: 'nothing'} {julia_comment:;}
968+ {code: bool} {julia_assignment:=} {julia_string: 'true'} {julia_operator:|} {julia_string: 'false'} {julia_comment:;}
969+ {code: symbol} {julia_assignment:=} [{julia_operator:^}{julia_char: ,)}]{julia_operator:+} {julia_comment:;}
970+ {code: hexcolor} {julia_assignment:=} {julia_type:(} {julia_string: '#'} {julia_operator:|} {julia_string: '0x'} {julia_type:)}{light:,} [{julia_char:0{julia_operator:-}9a{julia_operator:-}f} ]{6} {julia_comment:;}
971+ {code: simplecolor} {julia_assignment:=} {code: hexcolor} {julia_operator:|} {code: symbol} {julia_operator:|} {code: nothing} {julia_comment:;}
972+
973+ {code: underline} {julia_assignment:=} {code: nothing} {julia_operator:|} {code: bool} {julia_operator:|} {code: simplecolor} {julia_operator:|} {code: underlinestyled} {julia_comment:;}
974+ {code: underlinestyled} {julia_assignment:=} {julia_string: '('}{light:,} {code:ws}{light:,} {julia_type:(} {julia_string:''} {julia_operator:|} {code: nothing} {julia_operator:|} {code: simplecolor} {julia_operator:|} {code: interpolated} {julia_type:)}{light:,} {code:ws} ,
975+ {julia_string: ','}{light:,} {code:ws}{light:,} {julia_type:(} {code: symbol} {julia_operator:|} {code: interpolated} {julia_type:)}{light:,} {code:ws} {julia_string: ')'} {julia_comment:;}
976+
977+ {code: inherit} {julia_assignment:=} {julia_type:(} {julia_string: '['}{light:,} {code: inheritval}{light:,} {julia_type: \\ {} {julia_string: ','}{light:,} {code: inheritval} {julia_type: \\ }}{light:,} {julia_string: ']'} {julia_type:)} {julia_operator:|} {code: inheritval} {julia_comment:;}
978+ {code: inheritval} {julia_assignment:=} {code:ws}{light:,} {julia_string: ':'}{julia_operator:?}{light:,} {code: symbol} {julia_comment:;}
979979```
980980"""
981981macro styled_str (raw_content:: String )
0 commit comments