# A more formal description of the valid syntax for sequence # diagrams written using the "brace style" syntax. # A sequence diagram consists of the description of a single # method. <sequence_diagram> ::= <method_description> # The description of a method is the signature of the method # followed by a semicolon or a method body. <method_description> ::= <method_signature> ( ";" | <method_body> ) # A method signature is the identifier of the object being called # followed by the method being called on the object and with an optional # return value. The identifier of the object being called is separated # from the method identifier by a period. The optional return value is # preceeded by a -> <method_signature> ::= <object_identifier> "." <method_identifier> [ "->" <return_value> ] # The identifier of an object is composed of up to three parts. At least # one must be present and they must appear in the order object name, # class name, and stereotype. The class name, if present is preceeded # by a colon. The stereotype, if present, is surrounded by < and > <object_identifier> ::= <object_name> [ ":" <class_name> ] [ "<" <stereotype> ">" ] | ":" <class_name> [ "<" <stereotype> ">" ] | "<" <stereotype> ">" # The name of an object is just a string <object_name> ::= <string_identifier> # The name of a class is just a string <class_name> ::= <string_identifier> # A stereotype is just a string <stereotype> ::= <string_identifier> # A string is either a string with no spaces in it, a string surrounded # with double quotes or a string surrounded with single quotes. The # double quoted string can include an escaped double quote, thus # \", and the single quoted string can include an escaped single # quote, thus \'. <string_identifier> ::= 'An unquoted string with no spaces or a string surrounded by double quotes with all enclosed double quotes escaped with \ or a string surrounded by single quotes with all enclosed single quotes escaped with \' # The identifier for a method starts with an optional marker to # indicate repeated calls. This is followed by an optional condition to # express when the method is called. There must be a method name and # this can be followed by optional method arguments. <method_identifier> ::= [ <iteration_marker> ] [ <condition> ] <method_name> [ <method_args> ] # The iteration marker is just a * <iteration_marker> ::= "*" # A condition is a string surrounded by [ and ]. It can include a ] if # it is escaped by \. <condition> ::= 'A string starting with an open square bracket [ and ending with a close square bracket ] and with any close square brackets inside it escaped with \' # The name of a method is either just a string or it can be a # stereotype surrounded by < and > <method_name> ::= <string_identifier> | "<" <stereotype> ">" # The arguments for a method are just a string surrounded by ( and # ). It can include a ) if it is escaped with \. <method_args> ::= 'A string starting with an open paren ( and ending with a close paren ) and with any close parens inside it escaped with \' # The return value from a method is just a string <return_value> ::= <string_identifier> # A method body is zero or more method descriptions surrounded by { and # } <method_body> ::= "{" { <method_description> } "}"