aboutsummaryrefslogtreecommitdiff
path: root/.gitignore
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-28 10:07:00 +0100
committerMartin Fischer <martin@push-f.com>2021-11-29 15:11:01 +0100
commit2b84e92f4f0981b099f30759330d00a73c90dee8 (patch)
tree31d39077aa50944ff9bbdd784f316b5811d9c31c /.gitignore
parent8c3be2ac471edc6f24059d552e82fb5acc3d7cc2 (diff)
refactor: split up go! macro calls
#!/usr/bin/env python3 import re def split_go(match): inner = match.group(1) stmts = inner.split(';') text = '{' for stmt in stmts: if stmt.startswith(' reconsume '): text += 'self.reconsume = true;' stmt = ' to' + stmt[len(' reconsume'):] text += 'go!(self:{});'.format(stmt) return text + '}' text = '' with open('src/tokenizer/mod.rs') as f: for line in f: if '$me:ident' in line: # skip macro rules text += line else: text += re.sub('go!\(self:(.*)\)', split_go, line) with open('src/tokenizer/mod.rs', 'w') as f: f.write(text) import subprocess subprocess.call(['cargo', 'fmt'])
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions