parameters: (tokens, options)
docstring: atom ::= '(' expr ')' | '[' expr ']' | 'options'
               | long | shorts | argument | command ;
docstring_summary: atom ::= '(' expr ')' | '[' expr ']' | 'options'
               | long | shorts | argument | command ;
docstring_tokens: atom :: = ( expr ) | [ expr ] | options | long | shorts | argument | command ;
function: def parse_atom(tokens, options):
      """atom ::= '(' expr ')' | '[' expr ']' | 'options'
               | long | shorts | argument | command ;
      """
      token = tokens.current()
      result = []
      if token in '([':
          tokens.move()
          matching, pattern = {'(': [')', Required], '[': [']', Optional]}[token]
          result = pattern(*parse_expr(tokens, options))
          if tokens.move() != matching:
              raise tokens.error("unmatched '%s'" % token)
          return [result]
      elif token == 'options':
          tokens.move()
          return [OptionsShortcut()]
      elif token.startswith('--') and token != '--':
          return parse_long(tokens, options)
      elif token.startswith('-') and token not in ('-', '--'):
          return parse_shorts(tokens, options)
      elif token.startswith('<') and token.endswith('>') or token.isupper():
          return [Argument(tokens.move())]
      else:
          return [Command(tokens.move())]
function_tokens: def parse_atom ( tokens , options ) : token = tokens . current ( ) result = [ ] if token in '([' : tokens . move ( ) matching , pattern = { '(' : [ ')' , Required ] , '[' : [ ']' , Optional ] } [ token ] result = pattern ( * parse_expr ( tokens , options ) ) if tokens . move ( ) != matching : raise tokens . error ( "unmatched '%s'" % token ) return [ result ] elif token == 'options' : tokens . move ( ) return [ OptionsShortcut ( ) ] elif token . startswith ( '--' ) and token != '--' : return parse_long ( tokens , options ) elif token . startswith ( '-' ) and token not in ( '-' , '--' ) : return parse_shorts ( tokens , options ) elif token . startswith ( '<' ) and token . endswith ( '>' ) or token . isupper ( ) : return [ Argument ( tokens . move ( ) ) ] else : return [ Command ( tokens . move ( ) ) ]