import pgen
import sys
out = """# generated by pgen/main.py
import token
SkulptOpMap = {
"(": token.LPAR,
")": token.RPAR,
"[": token.LSQB,
"]": token.RSQB,
":": token.COLON,
",": token.COMMA,
";": token.SEMI,
"+": token.PLUS,
"-": token.MINUS,
"*": token.STAR,
"/": token.SLASH,
"|": token.VBAR,
"&": token.AMPER,
"<": token.LESS,
">": token.GREATER,
"=": token.EQUAL,
".": token.DOT,
"%": token.PERCENT,
"`": token.BACKQUOTE,
"{": token.LBRACE,
"}": token.RBRACE,
"@": token.AT,
"==": token.EQEQUAL,
"!=": token.NOTEQUAL,
"<>": token.NOTEQUAL,
"<=": token.LESSEQUAL,
">=": token.GREATEREQUAL,
"~": token.TILDE,
"^": token.CIRCUMFLEX,
"<<": token.LEFTSHIFT,
">>": token.RIGHTSHIFT,
"**": token.DOUBLESTAR,
"+=": token.PLUSEQUAL,
"-=": token.MINEQUAL,
"*=": token.STAREQUAL,
"/=": token.SLASHEQUAL,
"%=": token.PERCENTEQUAL,
"&=": token.AMPEREQUAL,
"|=": token.VBAREQUAL,
"^=": token.CIRCUMFLEXEQUAL,
"<<=": token.LEFTSHIFTEQUAL,
">>=": token.RIGHTSHIFTEQUAL,
"**=": token.DOUBLESTAREQUAL,
"//": token.DOUBLESLASH,
"//=": token.DOUBLESLASHEQUAL,
"->": token.RARROW
}
""" + \
pgen.generate_grammar().genjs()
open(sys.argv[1], "w").write(out)
|