]> git.saurik.com Git - bison.git/blobdiff - examples/extexi
doc: help Doxygen find our files.
[bison.git] / examples / extexi
index 0ac5c8aee210641e681b82fff5be53900e6bcf82..7ede7c4b40072c5946d1bd6d91748685bdd01e8f 100644 (file)
@@ -29,7 +29,7 @@ BEGIN {
     if (ARGV[argc] == "--")
       break;
   for (i = argc + 1; i < ARGC; ++i)
-    file_wanted[ARGV[i]] = 1;
+    file_wanted[basename(ARGV[i])] = ARGV[i];
   ARGC = argc;
 }
 
@@ -43,20 +43,17 @@ BEGIN {
 }
 
 /^@comment file: / {
-  if (!file_wanted[$3])
-    message("ignoring " $3);
+  if (file = file_wanted[$3])
+    message(" GEN " file);
   else
-    {
-      message("extracting " $3);
-      file = $3;
-    }
+    message("SKIP " $3);
 }
 
-/^@example$/, /^@end example$/ {
+/^@(small)?example$/, /^@end (small)?example$/ {
   if (!file)
     next;
 
-  if ($0 ~ /^@example$/)
+  if ($0 ~ /^@(small)?example$/)
     {
       input = files_output[file] ? "\n" : "";
 
@@ -69,7 +66,7 @@ BEGIN {
       next;
     }
 
-  if ($0 ~ /^@end example$/)
+  if ($0 ~ /^@end (small)?example$/)
     {
       if (input == "")
         fatal("no contents: " file);
@@ -125,6 +122,11 @@ function normalize(contents,    i, lines, n, line, res) {
 }
 
 
+function basename(name,     a, n) {
+  n = split (name, a, "/");
+  return a[n];
+}
+
 function message(msg) {
   if (! message_printed[msg])
     {