summaryrefslogtreecommitdiffstats
path: root/tools/sed-enums
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-11-26 02:23:18 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-11-26 02:23:18 +0100
commitd57ec34ac25107950537c3af60145e9e386f464a (patch)
tree11250b5ca2744983a7862c1696220082f083cfce /tools/sed-enums
parent192a01fa0d998fc25b3b78c8885c125fa686f8d3 (diff)
downloadffi-efl-d57ec34ac25107950537c3af60145e9e386f464a.zip
ffi-efl-d57ec34ac25107950537c3af60145e9e386f464a.tar.gz
tools/sed-enums: allow first step to allow reading anonymous enums, do not loop till enum define name is found
Diffstat (limited to 'tools/sed-enums')
-rw-r--r--tools/sed-enums16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/sed-enums b/tools/sed-enums
index 46d236d..3a07671 100644
--- a/tools/sed-enums
+++ b/tools/sed-enums
@@ -21,14 +21,24 @@ T next;H;b attrs
:next
# try again if } not found
/^\s*\}/ ! b attrs
-# read enumeration name
+# read enumeration name if any
s/^\s*}\s*(\w+).*$/ } \1;/
t finish
:close
+n
+# eat all comments
+/^\s*\/\*/ {
+ :comment2
+ /\*\/\s*$/ { n; b nocomment2 }
+ n; b comment2
+}
+:nocomment2
+# eat empty lines
+/^\s*$/ b close
# read the enum typedef
s/^\s*typedef\s+enum\s+\w+\s+(\w+)\s*;/ } \1/
-# leave if substitution works, or read next line and retry
-t finish;n;b close
+# finish if substitution fail
+T
:finish
# append pattern, exchange hold space and pattern space
H;x