1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
#! This line, however, will appear (not the first line in the file).
This is text. It should appear in the processed output.
This is a literal at sign: @.
This is a line continuation; this will appear on the same line.
Note that it will actually eat any whitespace (one word).
This will appear on one line.
This will appear on a separate line.
This is separated by a tab: See?
These are uppercase As (presuming an ASCII-compatible encoding): A, A, A, A, A, A, A.
Literals: ()[]{}<>\.
Literal markup: This will not be evaluated at all: 1 + 1 = @(1 + 1).
Multiple backquotes: To evaluate 1 + 1 you'd write @`(1 + 1)`.
Multiline backquotes: Lorem ipsum @
dolor sit amet, @
consectetur adipiscing elit.
The basics: The square of 4 is 16, or 16.
Internal whitespace is fine: 4 squared is 16.
Statements: 4**2 = 16.
Whitespace too: 4**2 = 16 (still).
But only on single-line statement expansions.
Internal whitespace on multi-line statements is significant.
Normal Python indentation rules must be followed here.
Normal Python indentation rules must be followed here.
Simple expressions: x is 4, l is [3, 2, 1], s is "alpha," and 4 squared is 16.
Literals too: x is 4, but would be written @x.
Trailing dots are ignored: The value of x is 4.
Quotes outside of expansions are also ignored: This is quoted: "x is 4."
Array subscription: The first element of l is 3.
But this is not: The first element of l is not [3, 2, 1] [0].
That was equivalent to: [3, 2, 1] and then [0], not 3.
But whitespace can go inside the brackets: 3 is 3.
Same with functions: 16 is 16.
The same applies to the other forms.
Involved: The contained value is 3.
More involved: The square of the contained value is 9.
Following expressions: Pluralize "book" as "books," or maybe "books."
By default str is used (alpha), but you can use repr if you want ('alpha').
Conditional expressions: x is true.
Pluralization: How many words? 4 words.
Protected expressions: foo is not defined.
Also here, whitespace isn't important: bar isn't defined either.
The math module has been imported.
The re module has not been imported.
Division by zero is illegal.
To swallow errors, use None: [two spaces].
This is self-expanding: @$2 + 2$4$
You can expand multiple times: @$2 + 2$4$
Is asdf defined? No
Just defined it. Is it defined now? Yes
This will appear in [brackets].
This will appear in [brackets also].
This will appear in [more] [brackets].
This will appear in [even] [more] [brackets].
Here are repeated braces: [braces].
Here are nested braces: [{braces}].
Here are stray braces; [starting {] and [ending }].
c's class is C.
c's name is empy.
Method call: Hello, empy.
Note that None is not expanded: [two spaces].
But the string 'None' is, of course, printed fine: None.
So a function can return None for side effects only: Hello, empy.
If: a is positive.
If/else: b is negative.
If/elif/else: cmp(a, b) is positive.
If/elif/elif/else: z equals z.
Testing parsing: checks out.
Some integers: 0 1 2 3 4 5 6 7 8 9.
The same integers (testing parsing): 0 1 2 3 4 5 6 7 8 9.
Those integers which are even: 0 2 4 6 8.
Those integers less than 5: 0 1 2 3 4.
For/else: 0 1 2 also works.
Countdown: 10 9 8 7 6 5 4 3 2 1 0.
Even countdown: 10 8 6 4 2 0.
Interrupted countdown: 10 9 8 7 6.
While/else: works.
Tuple unpacking: <1> <2> <3> <4>.
Tuple unpacking: <1> <2> <3> <4>.
Tuple unpacking: <1> <2> <3> <4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
Tuple unpacking: <1, 2> <3, 4>.
More tuple unpacking: <1, 2> <3, 4>.
Garbage is not defined.
Named with comma: Garbage is not defined: NameError.
Named with tuple and comma: Garbage is not defined: NameError.
Named with as: Garbage is not defined: NameError.
Named with tuple and as: Garbage is not defined: NameError.
Division by zero is illegal.
Catch all: something happened.
Else works: else.
Else with finally works with no exception: else, with finally.
Finally works with no exception: finally.
Finally works with exception: finally, and caught.
Break can escape out of a try: 0 1 2 3 4 5 and break!
So can a continue: 0 2 4 6 8 (evens).
Define: 5 is positive, -3 is negative, 0 is zero.
Defined: a is defined; q is undefined.
With: expression and variable: entered, employed, exited, and done.
With: existing variable: entered, employed, exited, and done.
With: expression only: entered, (not employed,) exited, and done.
A. This text is undiverted.
B. This text is also undiverted.
C. This text is diverted.
D. Again, this text is undiverted.
E. This text is diverted and then undiverted.
E. This text is diverted and then undiverted (this should appear twice).
F. This text is diverted and then cancelled.
G. This text is again undiverted.
H. There should be one remaining diversion: ['x'].
I. But not after dropping it: [].
J. This should be the final diversion, created manually.
Blanks: , , , .
Single quotes: ', ', '.
Double quotes: ", ", ".
Triple quotes: """, """, ''', '''.
Quotes surrounded by spaces: " , ' .
At signs: @, @, @, @.
Close parentheses: ), ), ), ).
Close parentheses in quotes: ')', ')'.
Close braces with an intervening space: } }.
Repr of a backquote: '`'.
Exes: x, x, x, x.
Dollar signs: $, $, $.
These are strings:
single quoted string
double quoted string
single quoted string with escaped 'single quotes'
double quoted string with escaped "double quotes"
triple single quoted string
triple double quoted string
single quoted string with "double quotes"
double quoted string with 'single quotes'
triple single quoted continued string
triple double quoted continued string
triple single quoted
...multi-line string
triple double quoted
... multi-line string
Encountered significators:
a and b should be None: None, None
c and d should be 'x': 'x', 'x'
e and f should be 'x y': 'x y', 'x y'
This line should be in mixed case.
this line should be all lowercase.
THIS LINE SHOULD BE ALL UPPERCASE (HOW GAUCHE).
[This line should be bracketed.]
[So should this line.]
*There* shou*ld be* star*s eve*ry fi*ve ch*aract*ers o*n thi*s lin*e.
This line should be back to mixed case.
THIS LINE SHOULD BE ALL UPPERCASE AGAIN.
this line should be all lowercase again.
[THIS LINE SHOULD BE ALL UPPERCASE WITH BRACKETS.]
THIS LINE SHOULD BE ALL UPPERCASE (LOWERCASE HAS BEEN FILTERED).
this line should be all lowercase (uppercase has been filtered).
This line should be back to mixed case (again).
The original context is sample.em:358:25.
File inclusion [sample.em:359:17]: 2 + 2 = 4 [<FakeFile>:1:19].
Expansion [sample.em:360:12]: This should be appear [<expand>:1:24] on the same line as this [sample.em:362:27].
More expansion [sample.em:363:17]:
Another expansion [<expand>:1:20].
This is the next line [sample.em:365:24].
Quoting: x when quoted would be '@x' or @@x.
More quoting: This will be @@doubled but '''@this is not'''.
And here's the original context again: sample.em:368:40.
Setting the context name:
Name should now be 'OtherName': OtherName:374:33
Setting the context line number:
Line number should now be 1001: OtherName:1001:33
Restoring context: sample.em:379:60.
Creating a new context ...
The new context is: <unnamed>:1:1.
The context name is now 'NewName': NewName:1:1.
The line number is now 1000 (new context does not advance): NewName:1000:1.
Back to the old context: sample.em:388:26.
Interpreter's q is 1.
Embedded interpreter's q is 10.
Interpreter's q is still 1; the embedded interpreter had no effect.
Standalone expansion: 1 + 1 is 2.
With locals: 2 + 3 is 5.
With globals g: g's x is 10.
Still with globals: g's x + 1 is 11.
g's x is still 10.
Invoking the sample hook: [SampleHook.test invoked].
Using a custom markup: <This appears in angle brackets>.
You can use multiple angle brackets: <This also appears in angle brackets>.
It can contain angle brackets: <This contains angle brackets inside <>!>.
It can also span multiple lines: <This spans
multiple
lines.>
This is the third to last line.
This is the penultimate line.
This is the last line.
|