#NEWLINE# def add_option( self , block , name , * values ) : #NEWLINE# #INDENT# " Adds an option to the AST, either as a non-block option or for an\n            existing block.\n\n            `block`\n                Block name. Set to ``None`` for non-block option.\n            `name`\n                Option name.\n            `*values`\n                String values for the option.\n\n            * Raises a ``ValueError`` exception if `values` is empty, `name`\n              is invalid, or `block` doesn't exist.\n            " #NEWLINE# if ( not self . RE_NAME . match ( name ) ) : #NEWLINE# #INDENT# raise ValueError ( "Invalid option name '{0}'" . format ( common . from_utf8 ( name ) ) ) #NEWLINE# #UNINDENT# if ( not values ) : #NEWLINE# #INDENT# raise ValueError ( 'Must provide a value' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# values = list ( values ) #NEWLINE# #UNINDENT# if block : #NEWLINE# #INDENT# if ( not ( block in self . _block_map ) ) : #NEWLINE# #INDENT# raise ValueError ( "Block '{0}' does not exist" . format ( common . from_utf8 ( block ) ) ) #NEWLINE# #UNINDENT# block_idx = self . _block_map [ block ] #NEWLINE# self . _ast [ 2 ] [ block_idx ] [ 1 ] . append ( [ name , values ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _ast [ 1 ] . append ( [ name , values ] )