Skip to content

Commit 8b86dc4

Browse files
committed
Add sed script to move declarators to types.
1 parent 7a787e1 commit 8b86dc4

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

bin/move-declarators.sed

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Moves
2+
#
3+
# use: sed [-E | -r] -i -f move-declarators.sed [files]
4+
5+
# Arrays
6+
# cdef int a[5] -> cdef int[5] a
7+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+) +([_0-9a-zA-Z]+)((\[[0-9]*\])+)$/\1cdef \2\4 \3/
8+
9+
# Pointers
10+
# cdef int a, *b -> cdef int a \n cdef int *b
11+
12+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+)( +[_0-9a-zA-Z]+ +(=[^()]+)?),( *[*]+ *)([^()]+)/\1cdef \2\3\
13+
\1cdef \2\5\6/
14+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+)( +[_0-9a-zA-Z]+ +(=[^()]+)?),( *[*]+ *)([^()]+)/\1cdef \2\3\
15+
\1cdef \2\5\6/
16+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+)( +[_0-9a-zA-Z]+ +(=[^()]+)?),( *[*]+ *)([^()]+)/\1cdef \2\3\
17+
\1cdef \2\5\6/
18+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+)( +[_0-9a-zA-Z]+ +(=[^()]+)?),( *[*]+ *)([^()]+)/\1cdef \2\3\
19+
\1cdef \2\5\6/
20+
s/^([ \t]*)cdef +([_0-9a-zA-Z. ]+)( +[_0-9a-zA-Z]+ +(=[^()]+)?),( *[*]+ *)([^()]+)/\1cdef \2\3\
21+
\1cdef \2\5\6/

0 commit comments

Comments
 (0)