17 lines
392 B
Python
17 lines
392 B
Python
|
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},
|
||
|
]
|