Commit b946fcc
committed
Remove begin/end spec as part of the common prefix
When we define our own --markers='x-begin x-middle x-end', and our code contains as a first
character `x`, then that character will be considered part of the common prefix
and be removed from the code. Here's an example.
// cog-begin
// cog.outl('hello world')
// cog-middle
// cog-end
The common prefix for this code is `// cog`, which makes the code generator fail
because python will receive the code `.outl('hello world')`, which makes no
sense.
This issue is especially cumbersome to work with if you're invoking a module,
for instance:
// cog-begin
// codegen.generate_some_code()
// cog-middle
// cog-end
Here the python interpeter will receive `degen.generate_some_code()`.
This patch removes the begin and end specs from the marker line to avoid this
issue.1 parent 3e0634b commit b946fcc
2 files changed
+28
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
257 | 281 | | |
258 | 282 | | |
259 | 283 | | |
| |||
0 commit comments