parameters: (environment)
return_statement: return [x[1:] for x in sorted(rules, reverse=True)]
docstring: Compiles all the rules from the environment into a list of rules.
docstring_summary: Compiles all the rules from the environment into a list of rules.
docstring_tokens: Compiles all the rules from the environment into a list of rules .
function: def compile_rules(environment):
      """Compiles all the rules from the environment into a list of rules."""
      e = re.escape
      rules = [
          (len(environment.comment_start_string), 'comment',
           e(environment.comment_start_string)),
          (len(environment.block_start_string), 'block',
           e(environment.block_start_string)),
          (len(environment.variable_start_string), 'variable',
           e(environment.variable_start_string))
      ]
  
      if environment.line_statement_prefix is not None:
          rules.append((len(environment.line_statement_prefix), 'linestatement',
                        r'^[ \t\v]*' + e(environment.line_statement_prefix)))
      if environment.line_comment_prefix is not None:
          rules.append((len(environment.line_comment_prefix), 'linecomment',
                        r'(?:^|(?<=\S))[^\S\r\n]*' +
                        e(environment.line_comment_prefix)))
  
      return [x[1:] for x in sorted(rules, reverse=True)]
function_tokens: def compile_rules ( environment ) : e = re . escape rules = [ ( len ( environment . comment_start_string ) , 'comment' , e ( environment . comment_start_string ) ) , ( len ( environment . block_start_string ) , 'block' , e ( environment . block_start_string ) ) , ( len ( environment . variable_start_string ) , 'variable' , e ( environment . variable_start_string ) ) ] if environment . line_statement_prefix is not None : rules . append ( ( len ( environment . line_statement_prefix ) , 'linestatement' , r'^[ \t\v]*' + e ( environment . line_statement_prefix ) ) ) if environment . line_comment_prefix is not None : rules . append ( ( len ( environment . line_comment_prefix ) , 'linecomment' , r'(?:^|(?<=\S))[^\S\r\n]*' + e ( environment . line_comment_prefix ) ) ) return [ x [ 1 : ] for x in sorted ( rules , reverse = True ) ]