summaryrefslogtreecommitdiff
path: root/source3/aparser/token.awk
diff options
context:
space:
mode:
authorChristopher R. Hertel <crh@samba.org>2000-07-15 20:57:24 +0000
committerChristopher R. Hertel <crh@samba.org>2000-07-15 20:57:24 +0000
commit7599f51db9b175322580acf1c5952af60a83752a (patch)
treea1050261f3771ad5b87dd1e5eb8f1c1dca981d45 /source3/aparser/token.awk
parent333c23c74acf0495fca6d4f4bdfc944ce320398e (diff)
downloadsamba-7599f51db9b175322580acf1c5952af60a83752a.tar.gz
samba-7599f51db9b175322580acf1c5952af60a83752a.tar.bz2
samba-7599f51db9b175322580acf1c5952af60a83752a.zip
I committed this change to the cliffs archive a while back and have heard
no complaints. ;) Basically, instead of ignoring single-line C-style comments in IDL source files this change allows token.awk to ignore both single- and multi-line C-style comments. Chris -)----- (This used to be commit 34f69f09f840b8990b718e8585785e2a6ad7c314)
Diffstat (limited to 'source3/aparser/token.awk')
-rw-r--r--source3/aparser/token.awk25
1 files changed, 20 insertions, 5 deletions
diff --git a/source3/aparser/token.awk b/source3/aparser/token.awk
index 25ac06f6e3..fb2982f077 100644
--- a/source3/aparser/token.awk
+++ b/source3/aparser/token.awk
@@ -5,6 +5,26 @@ function parse_error(msg) {
exit 1;
}
+# ignore multi-line C comments.
+{
+ if (t = index($0, "/*")) {
+ if (t > 1)
+ tmp = substr($0, 1, t - 1)
+ else
+ tmp = ""
+ u = index(substr($0, t + 2), "*/")
+ while (u == 0) {
+ getline
+ t = -1
+ u = index($0, "*/")
+ }
+ if (u <= length($0) - 2)
+ $0 = tmp substr($0, t + u + 3)
+ else
+ $0 = tmp
+ }
+}
+
# ignore blank lines
/^[ \t]*$/ {
next;
@@ -21,11 +41,6 @@ function parse_error(msg) {
next;
}
-# ignore C comments
-/^[ \t]*\/\*.*\*\// {
- next;
-}
-
/^[ \t]*module/ {
{if (module!="") parse_error("you can only specify one module name");}
start_module($2);