The Toolbar customization syntax

The syntax for the toolbar customization option is written using Extended Backus–Naur form.

Note: For simplicity: White space has been omitted, single quoted strings have been used, and object properties have been given a strict ordering. These restrictions can be relaxed according to normal JavaScript syntax.
string = ? JavaScript string ? ;

icon = ? JavaScript string containing a path to an SVG icon ? ;

action = ? JavaScript function taking no arguments ? ;

tinymce_button_id = ? identifier of a TinyMCE button or menu-button ? ;

command_object = "{" ,
                    "'id':" , string , "," ,
                  [ "'text':" , string , "," ] ,
                    "'icon':" , icon , "," ,
                    "'action':" , action ,
                  "}" ;

escaped_tinymce_button_id = "'tmce-" , tinymce_button_id , "'" ;

command_id = "'undo'" | "'redo'" | "'link'" | "'bookmark'" | "'fileupload'"
           | "'table'" | "'specialchar'" | "'media'" | "'hr'" | "'styles'"
           | "'bold'" | "'italic'" | "'underline'" | "'strikethrough'"
           | "'superscript'" | "'subscript'" | "'alignment'" | "'ul'" | "'ol'"
           | "'indent'" | "'outdent'" | "'blockquote'" | "'font-face'"
           | "'font-size'" | "'font-color'" | "'formatpainter'"
           | "'permanentpen'" | "'pageembed'" | "'casechange'"
           | "'removeformat'" | "'find'" | "'accessibility'" | "'fullscreen'"
           | "'wordcount'" | "'spellchecker'" | "'capitalization'" | "'help'"
           | "'language'" | "'ltrdir'" | "'rtldir'" | "'emoticons'"
           | "'codesample'" | "'checklist'" ;

command = command_id | escaped_tinymce_button_id | command_object ;

placeholder_id = "'conn-emoticons'" | "'conn-insert'" | "'conn-macros'" | "'conn-other'" ;

menu_item = placeholder_id | command ;

menu_items = menu_item , { "," , menu_item } ;

menu_group = "[" , menu_item , { "," , menu_item } , "]" ;

menu_groups = menu_group | "[" , menu_group , { "," , menu_group } , "]" ;

menu_id = "'insert'" | "'font-menu'" | "'usersettings'" ;

menu_object_defaulted = "{",
                          "'id':", menu_id, "," ,
                        [ "'label':" , string , "," ] ,
                        [ "'icon':" , icon , "," ] ,
                          "'items':" , menu_groups ,
                        "}" ;

menu_object_full = "{",
                      "'id':", string, "," ,
                      "'label':" , string , "," ,
                      "'icon':" , icon , "," ,
                      "'items':" , menu_groups ,
                    "}" ;

menu = menu_id | menu_object_defaulted | menu_object_full ;

group_item = menu | placeholder_id | command ;

group_anon = "[" , group_item , { "," , group_item } , "]" ;

group_object = "{" ,
                  "'label':" , string , "," ,
                  "'items':" , group_anon ,
                "}" ;

group_id = "'undo'" | "'insert'" | "'style'" | "'emphasis'" | "'align'"
         | "'listindent'" | "'format'" | "'language'" | "'tools'" ;

group = group_id | group_object | group_anon ;

toolbar = "[", [ group , { "," , group } ] , "]";