source: trunk/IPs/systemC/processor/Morpheo/Script/remove_comments.sed

Last change on this file was 132, checked in by rosiere, 15 years ago

1) add constant method - compatibility with SystemC
2) add Script to test sensitive list
3) fix bug in sensitive list

  • Property svn:keywords set to Id
File size: 906 bytes
Line 
1#!/usr/bin/sed -f
2#< Remove C/C++ comments from files
3# Another way to do it - adapted from a script found here
4# http://sed.sourceforge.net/grabbag/scripts/remccoms1.sed
5# to allow c++ // style comments to be removed
6#
7# c++ // comment removal code added KW 01/11/04
8# comments added KW 02/11/04
9
10# If pattern is not matched (i.e. line does not contain /*
11# then branch to label :c
12/\/\*/!bc
13
14# Okay - line must contain /*, or we've branched here
15# if line doesn't contain */ then append contents of next line to
16# pattern space and continue - we must have got here by a branch
17# to :a (or start of comment), so we can assume we're
18# processing a comment
19:a
20/\*\//!{
21N
22# branch back to :a to continue processing comment
23ba
24}
25:c
26# okay - not multiline comment - could be code, or single line
27# comment
28
29# replace single line comment with nothing
30s:/\*.*\*/::
31
32# replace // comment with nothing
33s://.*$::g
Note: See TracBrowser for help on using the repository browser.