File indexing completed on 2024-05-12 04:02:11

0001 # comment with ALERT
0002 
0003 ''' multiline
0004     comment
0005     ###
0006     '''
0007 
0008 // alert check, no word delimiter check at start of word, bug 397719
0009 #TODO
0010 
0011 a = 100_000
0012 b = 856_264.65
0013 c = 0x420_F52
0014 
0015 def func(x):
0016     """ EXTENDED API docs """
0017     if x == 42:
0018         func()
0019         c1 = {}
0020         c2 = {
0021             2.4,
0022             0x42,
0023             }
0024         a1 = []
0025         a2 = [
0026             "a", 032, (
0027                 )]
0028     else:
0029         print("""multi
0030             line
0031             string""")
0032         print("single \
0033                 continued line ")
0034         print('single line')
0035     if y := x:
0036         anext(a)
0037     return float(len(a2))
0038 
0039 
0040 def test_f_literals():
0041     f'xy'
0042     f'x{bar}y'
0043     f'x{bar["baz"]}y'
0044     f'x{bar["baz"]}y\n'
0045 
0046     f'x{bar["baz"]!r}y\n'
0047     f'x{bar["baz"]:.2}y\n'
0048 
0049     f'{{x{bar["baz"]:.2}}}} }} {{ {x!a}'
0050 
0051 a = "Escapes in String \U12345678 \xAB \""
0052 a = u'''\'''
0053 '''
0054 a = u'''\''''
0055 a = b'\u1234a\xffé\12k\n\g\
0056 s\
0057 \"\ '
0058 a = rb'\u1234aé\n\g\
0059 '
0060 a = b""""""
0061 a = b"""\""""
0062 a = 'a' \
0063     u'\x12'
0064 a = b"t\e's\t"
0065 a = rb"t\e's\t"
0066 a = r"\\" \
0067 rb'\\' \
0068 rf"""\\""" \
0069 ur'''\\'''
0070 
0071 "Escapes in Doc/Comment String \u1234 \xAb \"\\"
0072 ''' Doc/Comment String \N{123} \''''
0073 """ Doc/Comment String \17 \x1f \n \" \\"""
0074 
0075 # Decimal, Hex, Binary, Octal
0076 a = 1_2_34L
0077 b = 0_0_00_0
0078 c = 0xA_3f_43D
0079 d = 0b0_0_1_01
0080 e = 0o71_2_34
0081 # Float
0082 d = 1.1E+3
0083 e = 1.E+3
0084 f = .1E+3
0085 g = 1E+3
0086 h = 1.1
0087 i = 1.
0088 j = .1
0089 k =  1
0090 l = 1_0.e+3_22 + .2_1e2 + 11_1.
0091 # Complex
0092 m = 1.1E+3j
0093 n = 1.E+3j
0094 o = .1E+3j
0095 p = 1E+3j
0096 q = 1.1j
0097 r = 1.j
0098 s = .1j
0099 t =  1j
0100 u = 1_0.e+3_22j + .2_1e2j + 11_1.j
0101 
0102 # Invalid numbers
0103 aaa.123
0104 aaa123
0105 .0x123
0106 
0107 # match and case keywords
0108 foo(
0109     # no keyword
0110     match if xx else yyy
0111 )
0112 match = 3
0113 match.foo()
0114 match command.split():
0115     case ["quit"]:
0116         print("Goodbye!")
0117 
0118 match(command.split())
0119 match(command.split()):
0120     case ["quit"]:
0121         print("Goodbye!")
0122 
0123 def func1():
0124     yield 1
0125     yield  from [func(), 1, 2, "3"]
0126     # invalid, "from" no longer part of "yield from"
0127     yield, from 1
0128 
0129 async def func2():
0130     await asyncio.sleep(1)
0131 
0132 assert cond, \
0133     "bla bla"
0134 
0135 print('dsdsa' \
0136       'dsdasw'
0137       'dsadsa')
0138 
0139 "\\\\\\\\\\ENSURE THAT THIS AND THE FOLLOWING LINES ARE AT THE END OF THE FILE\\\\\\\\\\ \
0140 "
0141 a = 'otherwise the next line will be
0142 stuck on the Error attribute'
0143 br"Strings delimited by single quotes (' or ")
0144 can NOT be defined across multiple lines
0145 unless escaped with \
0146 "