add the theta variable name

This commit is contained in:
Lephe 2019-10-15 11:25:39 +02:00
parent 81a8c58b70
commit 907c800696
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
4 changed files with 21 additions and 1 deletions

View File

@ -38,7 +38,7 @@ Hexadecimal Description Feature BitcodeLexer TextLexer
48 x Yes Yes Yes
49 y Yes Yes Yes
4A Pré-Rép - - -
4C θ Yes - -
4C θ Yes Yes Yes
60 ( Yes Yes Yes
68 Abs( Yes Yes -
69 Rnd( Yes Yes -

View File

@ -232,6 +232,8 @@ class BitcodeLexer(LexerBase):
return Token(T.VAR, "x")
if code == 0x49:
return Token(T.VAR, "y")
if code == 0x4C:
return Token(T.VAR, "theta")
# Functions
fun = {
@ -423,6 +425,11 @@ class TextLexer(LexerBase):
self.code = c[1:]
self.pending_param = True
return Token(T.VAR, c[0])
m = re.match(r"theta\b", c)
if m is not None:
self.code = c[len(m[0]):]
self.pending_param = True
return Token(T.VAR, "theta")
# Comments
if c[0] == "#":

4
tests/autovars.out Normal file
View File

@ -0,0 +1,4 @@
10.0
0.0
90.0
160.0

9
tests/autovars.txt Normal file
View File

@ -0,0 +1,9 @@
forward 10
print x
print y
orient 90
print theta
rotate 70
print theta