17 lines
392 B
Python
Executable File
17 lines
392 B
Python
Executable File
import lex
|
|
|
|
class BlameGrammar(lex.Grammar):
|
|
GRAMMAR_LIST = [
|
|
{'name': 'metadata',
|
|
'expr': "(?:^|(?<=\n))[0-9.]+ +[a-zA-Z0-9_]+ +[-0-9A-Za-z]+",
|
|
'action': lex.make_token},
|
|
|
|
{'name': 'data',
|
|
'expr': ".+(?:$|\n)",
|
|
'action': lex.make_token},
|
|
|
|
{'name': "default",
|
|
'expr': r'\\.|.|\n',
|
|
'action': lex.silent},
|
|
]
|