2015-04-04 23:16:22 +01:00
|
|
|
# test the lexer
|
|
|
|
|
|
|
|
# __debug__ is a special symbol
|
|
|
|
print(type(__debug__))
|
|
|
|
|
|
|
|
# short input
|
|
|
|
exec("")
|
|
|
|
exec("\n")
|
|
|
|
exec("\n\n")
|
|
|
|
exec("\r")
|
|
|
|
exec("\r\r")
|
|
|
|
print(eval("1"))
|
|
|
|
print(eval("12"))
|
|
|
|
print(eval("123"))
|
|
|
|
print(eval("1\n"))
|
|
|
|
print(eval("12\n"))
|
|
|
|
print(eval("123\n"))
|
|
|
|
print(eval("1\r"))
|
|
|
|
print(eval("12\r"))
|
|
|
|
print(eval("123\r"))
|
|
|
|
|
2016-12-21 23:32:06 +00:00
|
|
|
# backslash used to escape a line-break in a string
|
|
|
|
print('a\
|
|
|
|
b')
|
|
|
|
|
2015-04-04 23:16:22 +01:00
|
|
|
# lots of indentation
|
|
|
|
def a(x):
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
print(x)
|
|
|
|
a(1)
|
2015-07-23 23:20:37 +01:00
|
|
|
|
|
|
|
# badly formed hex escape sequences
|
|
|
|
try:
|
|
|
|
exec(r"'\x0'")
|
|
|
|
except SyntaxError:
|
|
|
|
print("SyntaxError")
|
|
|
|
try:
|
|
|
|
exec(r"b'\x0'")
|
|
|
|
except SyntaxError:
|
|
|
|
print("SyntaxError")
|
|
|
|
try:
|
|
|
|
exec(r"'\u000'")
|
|
|
|
except SyntaxError:
|
|
|
|
print("SyntaxError")
|
|
|
|
try:
|
|
|
|
exec(r"'\U0000000'")
|
|
|
|
except SyntaxError:
|
|
|
|
print("SyntaxError")
|