feisty meow concerns codebase  2.140
phrase_replacer.phrase_replacer Class Reference

Public Member Functions

def __init__ (self, argv)
 
def print_instructions (self)
 
def validate_and_consume_command_line (self)
 
def read_file_data (self, filename)
 
def write_file_data (self, filename)
 
def is_alphanumeric (self, check_char)
 
def replace_within_string (self, fix_string)
 
def emit_normal_accumulator (self)
 
def emit_comment_accumulator (self)
 
def process_file_data (self)
 
def replace_all_occurrences (self)
 

Public Attributes

 arguments
 
 EATING_NORMAL_TEXT
 
 EATING_ONELINE_COMMENT
 
 EATING_MULTILINE_COMMENT
 
 phrase_to_replace
 
 replacement_bit
 
 files
 
 file_lines
 
 normal_accumulator
 
 comment_accumulator
 
 state
 
 processed_buffer
 

Detailed Description

 A simple replacement tool that honors some C/C++ syntax when replacing.

    This will take a particular phrase given by the user and find it in a set of
    documents.  That phrase will be replaced when it appears completely, and is not
    in a C or C++ style comment (// or /* ... */).  It also must be clear of any
    other alphanumeric pollution, and only be surrounded by white space or operation
    characters.

Definition at line 3 of file phrase_replacer.py.

Constructor & Destructor Documentation

◆ __init__()

def phrase_replacer.phrase_replacer.__init__ (   self,
  argv 
)
 Initializes the class with a set of arguments to work with.

    The arguments need to be in the form described by print_instructions().

Definition at line 13 of file phrase_replacer.py.

Member Function Documentation

◆ emit_comment_accumulator()

def phrase_replacer.phrase_replacer.emit_comment_accumulator (   self)

◆ emit_normal_accumulator()

def phrase_replacer.phrase_replacer.emit_normal_accumulator (   self)
 handle emission of a chunk of normal code (without comments). 

Definition at line 133 of file phrase_replacer.py.

◆ is_alphanumeric()

def phrase_replacer.phrase_replacer.is_alphanumeric (   self,
  check_char 
)
 given a character, this returns true if it's between a-z, A-Z or 0-9. 

Definition at line 94 of file phrase_replacer.py.

Referenced by fix_project_references.fix_project_references.replace_within_string(), and phrase_replacer.phrase_replacer.replace_within_string().

◆ print_instructions()

def phrase_replacer.phrase_replacer.print_instructions (   self)

◆ process_file_data()

def phrase_replacer.phrase_replacer.process_file_data (   self)
 iterates through the stored version of the file and replaces the phrase. 

Definition at line 146 of file phrase_replacer.py.

Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().

◆ read_file_data()

◆ replace_all_occurrences()

◆ replace_within_string()

◆ validate_and_consume_command_line()

def phrase_replacer.phrase_replacer.validate_and_consume_command_line (   self)

◆ write_file_data()

def phrase_replacer.phrase_replacer.write_file_data (   self,
  filename 
)

Member Data Documentation

◆ arguments

◆ comment_accumulator

phrase_replacer.phrase_replacer.comment_accumulator

◆ EATING_MULTILINE_COMMENT

phrase_replacer.phrase_replacer.EATING_MULTILINE_COMMENT

Definition at line 23 of file phrase_replacer.py.

◆ EATING_NORMAL_TEXT

phrase_replacer.phrase_replacer.EATING_NORMAL_TEXT

Definition at line 21 of file phrase_replacer.py.

◆ EATING_ONELINE_COMMENT

phrase_replacer.phrase_replacer.EATING_ONELINE_COMMENT

Definition at line 22 of file phrase_replacer.py.

◆ file_lines

◆ files

◆ normal_accumulator

phrase_replacer.phrase_replacer.normal_accumulator

Definition at line 136 of file phrase_replacer.py.

◆ phrase_to_replace

phrase_replacer.phrase_replacer.phrase_to_replace

◆ processed_buffer

◆ replacement_bit

phrase_replacer.phrase_replacer.replacement_bit

◆ state

phrase_replacer.phrase_replacer.state

Definition at line 148 of file phrase_replacer.py.


The documentation for this class was generated from the following file: