refyre.reader package#
Submodules#
refyre.reader.ExpressionGenerator module#
- class refyre.reader.ExpressionGenerator.ExpressionGenerator(string)[source]#
Bases:
objectThe ExpressionGenerator class takes in an input generator string, such as test$.txt, and returns a lambda function that can be used to evaluate the expressions at various points.
For example, test$.txt returns a lambda function, that when called at i = 1, returns test1.txt
This class is a static class; it’s sole purpose is to create an organized location to generate complex expressions.
For now, only numbers are supported. You can generate number expressions using the ‘$’ symbol as shown above.
refyre.reader.Lexer module#
- class refyre.reader.Lexer.Lexer(input_file)[source]#
Bases:
objectrefyre’s static lexer
- Fundamental assumptions:
There are 4 spaces / tab. On some systems, there are 8, hence I’ve made a SPACES_PER_TAB variable that can be adjusted
Only one cluster can be specified per line. The lexer is designed to error if someone tries some dumb shit
- SPACES_PER_TAB = 4#
refyre.reader.Parser module#
refyre.reader.PatternGenerator module#
- class refyre.reader.PatternGenerator.PatternGenerator(pattern_string, given_type=None)[source]#
Bases:
objectThe pattern generator is designed to parse all pattern based strings and return regex versions of them that can be used to pattern match.
We created the generator to help differentiate between glob patterns and regex. Most of the time, people use glob, but sometimes the power of regex matching does come in handy.
A glob string will come in the normal form. A regex string will start with an r before the actual pattern.
ex: “a?.txt” is a glob pattern. “ra?.txt” is regex.
- GLOB_STARTER = 'g!'#
- REGEX_STARTER = 'r!'#