blob: 63cecafe5ab224b2a0b6dca13f01c1caa0f8b5a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
__version__ = "0.0.1"
import smp.macro_processor
import smp.builtins
def repl():
print("=Skaldpress Macro Processor (REPL)")
# print(" type \"quit\" to exit");
print("NOT IMPLEMENTED")
# Intend to use code.InteractiveConsole or code.InteractiveInterpreter
# as well as the readline library
def read_stdin():
import sys
data = sys.stdin.read()
smp = macro_processor.MacroProcessor()
res = smp.process_input(data)
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", file=sys.stderr)
print(res)
def main():
import sys
if not sys.stdin.isatty():
read_stdin()
sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == "-":
read_stdin()
sys.exit(0)
if len(sys.argv) == 1:
repl()
sys.exit(0)
with open(sys.argv[1], "r") as f:
file_content = f.read()
smp = macro_processor.MacroProcessor()
res = smp.process_input(file_content)
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", file=sys.stderr)
print(res)
|