pyBabyMaker.engine.identifiers

This module defines various identifiers to extract template macros from C++ files.

class pyBabyMaker.engine.identifiers.Identifier(pattern, name, groups, strip_policy)

Abstraction of an identifiers. This class provide wrappers to re objects.

These wrappers will provide saner return value, and strip heading/trailing white spaces if configured.

__init__(pattern, name, groups, strip_policy)

Initialize identifier.

Parameters:
  • pattern (str) – pattern to be compiled into a re object.
  • name (str) – name of the identifier.
  • group (int) – Specify number of groups in the matching regexp.
  • strip_policy (list) – A list of boolean, indicating if group(idx+1) should be stripped. idx is the index of the boolean in this list.
match(string)

Wrapper to re.match.

search(string)

Wrapper to re.search.

strip_whitespaces(match)

Strip white spaces if regular expression has a match, and the strip policy for a particular group is set to True.