Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
1bc394f5
Commit
1bc394f5
authored
Aug 09, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code indentation for strings that contain '{}'
parent
580cfa76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+9
-2
No files found.
Cython/Compiler/Code.py
View file @
1bc394f5
...
...
@@ -255,11 +255,18 @@ class CCodeWriter(object):
self
.
last_marker_line
=
self
.
marker
[
0
]
self
.
marker
=
None
def
put_safe
(
self
,
code
):
# put code, but ignore {}
self
.
write
(
code
)
self
.
bol
=
0
def
put
(
self
,
code
):
fix_indent
=
False
dl
=
code
.
count
(
"{"
)
-
code
.
count
(
"}"
)
if
dl
<
0
:
self
.
level
+=
dl
elif
dl
==
0
and
code
.
startswith
(
'}'
):
fix_indent
=
True
self
.
level
-=
1
if
self
.
bol
:
self
.
indent
()
...
...
@@ -267,7 +274,7 @@ class CCodeWriter(object):
self
.
bol
=
0
if
dl
>
0
:
self
.
level
+=
dl
elif
dl
==
0
and
code
.
startswith
(
'}'
)
:
elif
fix_indent
:
self
.
level
+=
1
def
increase_indent
(
self
):
...
...
@@ -361,7 +368,7 @@ class CCodeWriter(object):
self
.
put
(
entry
.
type
.
declaration_code
(
entry
.
cname
,
dll_linkage
=
dll_linkage
))
if
entry
.
init
is
not
None
:
self
.
put
(
" = %s"
%
entry
.
type
.
literal_code
(
entry
.
init
))
self
.
put
_safe
(
" = %s"
%
entry
.
type
.
literal_code
(
entry
.
init
))
self
.
putln
(
";"
)
def
put_temp_declarations
(
self
,
func_context
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment