From bb0216db8e023ad51b7a1942a5a9b21ba89f28c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 7 Mar 2012 15:08:59 +0100 Subject: tools/sed-*: first eat all comments --- tools/sed-callbacks | 7 +++++++ tools/sed-enums | 7 +++++++ tools/sed-functions | 7 +++++++ tools/sed-types | 7 +++++++ tools/sed-variables | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/tools/sed-callbacks b/tools/sed-callbacks index 42051ba..f94309c 100644 --- a/tools/sed-callbacks +++ b/tools/sed-callbacks @@ -1,3 +1,10 @@ +# eat all comments +/^\s*\/\*/ { + :comment + /\*\/\s*$/ { n; b nocomment } + n; b comment +} +:nocomment # drop if don't start with typedef /^\s*typedef/ ! b # one line typedef xxx (...); we are done diff --git a/tools/sed-enums b/tools/sed-enums index aa44675..a4e2e25 100644 --- a/tools/sed-enums +++ b/tools/sed-enums @@ -1,3 +1,10 @@ +# eat all comments +/^\s*\/\*/ { + :comment + /\*\/\s*$/ { n; b nocomment } + n; b comment +} +:nocomment # drop if don't start with (typedef)? enum /^\s*(typedef\s)?\s*enum/ ! b # diff --git a/tools/sed-functions b/tools/sed-functions index ac784a5..71ecc8e 100644 --- a/tools/sed-functions +++ b/tools/sed-functions @@ -1,3 +1,10 @@ +# eat all comments +/^\s*\/\*/ { + :comment + /\*\/\s*$/ { n; b nocomment } + n; b comment +} +:nocomment # drop if don't start with EAPI /^\s*EAPI/ ! b # drop extern definitions diff --git a/tools/sed-types b/tools/sed-types index 52a7252..730d597 100644 --- a/tools/sed-types +++ b/tools/sed-types @@ -1,3 +1,10 @@ +# eat all comments +/^\s*\/\*/ { + :comment + /\*\/\s*$/ { n; b nocomment } + n; b comment +} +:nocomment # drop if don't start with typedef /^\s*typedef/ ! b # read one line typedef (struct)? (word*)? (*)? word; diff --git a/tools/sed-variables b/tools/sed-variables index 36c612f..e5fbd12 100644 --- a/tools/sed-variables +++ b/tools/sed-variables @@ -1,2 +1,9 @@ +# eat all comments +/^\s*\/\*/ { + :comment + /\*\/\s*$/ { n; b nocomment } + n; b comment +} +:nocomment # variable should be EAPI extern word word;; s/^\s*(EAPI\s+extern\s+\w+\s+\*?\w+\s*;).*$/\1/p -- cgit v1.1-2-g2b99