我用Python编写了一种编码语言,我试图将语法添加到Adobe Brackets中,但我不知道如何。我希望能够不必编写新的CodeMirror模式就能做到这一点。
这是我的编码程序:
import turtle
import os
import keyboard as kb
import webbrowser
def run(filename):
try:
with open(filename,'r') as myFile:
for line in myFile:
sentence = line
L = sentence.split()
words = 1
wc = len(L)
output = ''
cw = ''
if L[0]=='echo':
for i in range(1, wc):
output=output+' '+L[i]
print(output)
else:
if L[0]=='draw':
if L[1]=='square':
t = turtle.Pen()
for i in range(0,4):
t.forward(50)
t.left(90)
else:
if L[1]=='triangle':
t = turtle.Pen()
for i in range(0,4):
t.forward(50)
t.left(45)
if L[0]=='go':
if L[1]=='fwd':
t = turtle.Pen()
t.forward(L[2])
我想为带括号(画,走,回声)的关键字/语法添加一种编码语言