Code coverage report for lib/docparser.js

Statements: 83.54% (406 / 486)      Branches: 74.6% (235 / 315)      Functions: 92.31% (60 / 65)      Lines: 83.54% (406 / 486)      Ignored: none     

All files » lib/ » docparser.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444          1   1                         20   20       20 148 20   148 20       20                   2622                   1274                                                                                                                                                                                                                                                                                                                                                                           920   920                 920           920 908 908       920 920 920 920     920                                     920   920 12 12       920 16 16 16 16   16 16 6 6   6     6               920 14 14 14 18 6 6 6 6 6                                         920         920 908     920 16 16 6       920 12     920                   354       354 66 66     354       354 66     354               116                         136 136 136 902 12 12     136 124 44               124   12         8 8 8 8 8 8         3             18 18     18 18   18       10     18           148   148 982   20 20 20 20         148 20   148   148 148 148   148 20   148 148         148 148 148 148   12   148                         1348   1348 1348 1348 1348 1348     1348 6 6 6 6       1348 2 20 10 10 10                       814 814               83 56     83 4   79     83 87 87         4 4       14 12     14 14 112 18 14         14                       9               2   2 2           22 22       22         22 22   22 22 22     22 22       22 22 22 22                     22 22 22 2   20                                                   4   4 4   4 4   4 4 4     4 4 4     4 4 4                               3 3 3     1   1 1 1   1                                                                                                                                                 131   131 131               131                   94 42     52   52   50   50   28 2     50   48                                   136     136   136   136 136   136 136 42     136 136   8 2 2 2   2       2 2       2           136 22                 136                     285 267   18 18 12                 12 12     18         182 182                               283 131   152 152 152   152 136 136     136                 136 136 12   136   152         1                 4 4 220 4           4       3   3 3           131 131     3 44   44 2026           3 37       37 18 18 644   592                 3 279 279 127150 4                                     1531   1531 1495     1531                             1531                                 1531 1499 9565         1531 1531 1531 1531 7221 7221 7221 1048   6173     6173 1407 1407 1407         4766   4766 4766 3842 3842       6173 6173             1531                                 3 3 3   3   137         137 27081 27081 1531   1531   1531 11210 11210 11210             1531 1531 1531 1531           3 3                 1531           1531 9235         9235 154     9235 9235 10 10       10 10                   9235 9235 4003 4003 2096   4003 4003   5232         1531 183   1348 1348 1348   1348 1348 136     1348 1348 22                           3             3               3     3   131 131 1531         3 34 30   34 12     34 34     3 136 136           136 18 18 4       136 136 136 136 136   136 18 18     136                   3 1348                   1348 4 4   10   4       3 34         3                       3 3 3       1          
/*
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://yuilibrary.com/license/
*/
YUI.add('docparser', function (Y) {
 
    var Lang = Y.Lang,
        trim = Lang.trim,
        fixType = Y.Lang.fixType,
        /**
         * Parses the JSON data and formats it into a nice log string for
         * filename and line number: `/file/name.js:123`
         * @method stringlog
         * @private
         * @param {Object} data The data block from the parser
         * @return {String} The formatted string.
         * @for DocParser
         */
        stringlog = function (data) {
            var line, file;
 
            Iif (data.file && data.line) {
                file = data.file;
                line = data.line;
            } else {
                data.forEach(function (d) {
                    if (d.tag === 'file') {
                        file = d.value;
                    }
                    if (d.tag === 'line') {
                        line = d.value;
                    }
                });
            }
            return ' ' + file + ':' + line;
        },
        /**
         * Flatten a string, remove all line breaks and replace them with a token
         * @method implodeString
         * @private
         * @param {String} str The string to operate on
         * @return {String} The modified string
         */
        implodeString = function (str) {
            return str.replace(REGEX_GLOBAL_LINES, '!~YUIDOC_LINE~!');
        },
        /**
         * Un-flatten a string, replace tokens injected with `implodeString`
         * @method implodeString
         * @private
         * @param {String} str The string to operate on
         * @return {String} The modified string
         */
        explodeString = function (str) {
            return str.replace(/!~YUIDOC_LINE~!/g, '\n');
        },
        CURRENT_NAMESPACE = 'currentnamespace',
        CURRENT_MODULE = 'currentmodule',
        MAIN_MODULE = 'mainmodule',
        CURRENT_SUBMODULE = 'currentsubmodule',
        CURRENT_FILE = 'currentfile',
        CURRENT_CLASS = 'currentclass',
 
        REGEX_TYPE = /(.*?)\{(.*?)\}(.*)/,
        REGEX_FIRSTWORD = /^\s*?([^\s]+)(.*)/,
        REGEX_OPTIONAL = /\[(.*?)\]/,
        REGEX_START_COMMENT = {
            js: /^\s*\/\*\*/,
            coffee: /^\s*###\*/
        },
        REGEX_END_COMMENT = {
            js: /\*\/\s*$/,
            coffee: /###\s*$/
        },
        REGEX_LINE_HEAD_CHAR = {
            js: /^\s*\*/,
            coffee: /^\s*#/
        },
        REGEX_LINES = /\r\n|\n/,
        REGEX_GLOBAL_LINES = /\r\n|\n/g,
 
        SHORT_TAGS = {
            'async': 1,
            'beta': 1,
            'chainable': 1,
            'extends': 1,
            'final': 1,
            'static': 1,
            'optional': 1,
            'required': 1
        },
 
        /**
         * A list of known tags.  This populates a member variable
         * during initialization, and will be updated if additional
         * digesters are added.
         * @property TAGLIST
         * @type Array
         * @final
         * @for DocParser
         */
        TAGLIST = [
            "async",        // bool, custom events can fire the listeners in a setTimeout
            "author",       // author best for projects and modules, but can be used anywhere // multi
            "attribute",    // YUI attributes -- get/set with change notification, etc
            "beta",         // module maturity identifier
            "broadcast",    // bool, events
            "bubbles",      // custom events that bubble
            "category",     // modules can be in multiple categories
            "chainable",    // methods that return the host object
            "class",        // pseudo class
            "conditional",  // conditional module
            "config",       // a config param (not an attribute, so no change events)
            "const",        // not standardized yet, converts to final property
            "constructs",   // factory methods (not yet used)
            "constructor",  // this is a constructor
            "contributor",  // like author
            "default",      // property/attribute default value
            "deprecated",   // please specify what to use instead
            "description",  // can also be free text at the beginning of a comment is
            "emitfacade",   // bool, YUI custom event can have a dom-like event facade
            "event",        // YUI custom event
            "evil",         // uses eval
            "extension",    // this is an extension for [entity]
            "extensionfor", // this is an extension for [entity]
            "extension_for",// this is an extension for [entity]
            "example",      // 0..n code snippets.  snippets can also be embedded in the desc
            "experimental", // module maturity identifier
            "extends",      // pseudo inheritance
            "file",         // file name (used by the parser)
            "final",        // not meant to be changed
            "fireonce",     // bool, YUI custom event config allows
            "for",          // used to change class context
            "global",       // declare your globals
            "icon",         // project icon(s)
            "in",           // indicates module this lives in (obsolete now)
            "initonly",     // attribute writeonce value
            "injects",      // injects {HTML|script|CSS}
            "knownissue",   // 0..n known issues for your consumption
            "line",         // line number for the comment block (used by the parser)
            "method",       // a method
            "module",       // YUI module name
            "main",         // Description for the module
            "namespace",    // Y.namespace, used to fully qualify class names
            "optional",     // For optional attributes
            "required",     // For required attributes
            "param",        // member param
            "plugin",       // this is a plugin for [entityl]
            "preventable",  // YUI custom events can be preventable ala DOM events
            "private",      // > access
            "project",      // project definition, one per source tree allowed
            "property",     // a regular-ole property
            "protected",    // > access
            "public",       // > access
            "queuable",     // bool, events
            "readonly",     // YUI attribute config
            "requires",     // YUI module requirements
            "return",       // {type} return desc -- returns is converted to this
            "see",          // 0..n things to look at
            "since",        // when it was introduced
            "static",       // static
            "submodule",    // YUI submodule
            "throws",       // {execption type} description
            "title",        // this should be something for the project description
            "todo",         // 0..n things to revisit eventually (hopefully)
            "type",         // the var type
            "url",          // project url(s)
            "uses",         // 0..n compents mixed (usually, via augment) into the prototype
            "value",        // the value of a constant
            "writeonce"     // YUI attribute config
        ],
 
        /**
         * Common errors will get scrubbed instead of being ignored.
         * @property CORRECTIONS
         * @type Object
         * @final
         * @for DocParser
         */
        CORRECTIONS = {
            'augments': 'uses', // YUI convention for prototype mixins
            'depreciated': 'deprecated', // subtle difference
            'desciption': 'description', // shouldn't need the @description tag at all
            'extend': 'extends', // typo
            'function': 'method', // we may want standalone inner functions at some point
            'member': 'method', // probably meant method
            'parm': 'param', // typo
            'params': 'param', // typo
            'pamra': 'param', // typo
            'parma': 'param', // typo
            'propery': 'property', // typo
            'prop': 'property', // probably meant property
            'returns': 'return' // need to standardize on one or the other
        },
 
        /**
         * A map of the default tag processors, keyed by the
         * tag name.  Multiple tags can use the same digester
         * by supplying the string name that points to the
         * implementation rather than a function.
         * @property DIGESTERS
         * @type Object
         * @final
         * @for DocParser
         */
        DIGESTERS = {
            // "params": [
            // {
            //   "name": "optionalandmultiple",
            //   "description": "my desc",
            //   "type": "string",
            //   "optional": true, // [surroundedbybrackets]
            //   "optdefault": "if specified, this is always string to avoid syntax errors @TODO",
            //   "multiple": true // endswith*
            // }
            // ],
            // @param {type} name description    -or-
            // @param name {type} description
            // #2173362 optional w/ or w/o default
            // @param {type} [optvar=default] description
            // #12 document config objects
            // @param {object|config} config description
            // @param {type} config.prop1 description
            // @param {type} config.prop2 description
            // #11 document callback argument signature
            // @param {callback|function} callback description
            // @param {type} callback.arg1 description
            // @param {type} callback.arg2 description
            // #2173362 document event facade decorations for custom events
            // @param {event} event description
            // @param {type}  event.child description
            // @param {type}  event.index description
            // @param name* {type} 1..n description
            // @param [name]* {type} 0..n description
            'param': function (tagname, value, target, block) {
                // Y.log('param digester' + value);
                target.params = target.params || [];
 
                Iif (!value) {
                    this.warnings.push({
                        message: 'param name/type/descript missing',
                        line: stringlog(block)
                    });
                    Y.log('param name/type/descript missing: ' + stringlog(block), 'warn', 'docparser');
                    return;
                }
 
                var type, name, parts, optional, optdefault, parent, multiple, len, result,
                    desc = implodeString(trim(value)),
                    match = REGEX_TYPE.exec(desc),
                    host = target.params;
 
                // Extract {type}
                if (match) {
                    type = fixType(trim(match[2]));
                    desc = trim(match[1] + match[3]);
                }
 
                // extract the first word, this is the param name
                match = REGEX_FIRSTWORD.exec(desc);
                Eif (match) {
                    name = trim(match[1]);
                    desc = trim(match[2]);
                }
 
                Iif (!name) {
                    if (value && value.match(/callback/i)) {
                        this.warnings.push({
                            message: 'Fixing missing name for callback',
                            line: stringlog(block)
                        });
                        Y.log('Fixing missing name for callback:' + stringlog(block), 'warn', 'docparser');
                        name = 'callback';
                        type = 'Callback';
                    } else {
                        this.warnings.push({
                            message: 'param name missing: ' + value,
                            line: stringlog(block)
                        });
                        Y.log('param name missing: ' + value + ':' + stringlog(block), 'warn', 'docparser');
                        name = 'UNKNOWN';
                    }
                }
 
                len = name.length - 1;
 
                if (name.charAt(len) === '*') {
                    multiple = true;
                    name = name.substr(0, len);
                }
 
                // extract [name], optional param
                if (name.indexOf('[') > -1) {
                    match = REGEX_OPTIONAL.exec(name);
                    Eif (match) {
                        optional = true;
                        name = trim(match[1]);
                        // extract optional=defaultvalue
                        parts = name.split('=');
                        if (parts.length > 1) {
                            name = parts[0];
                            optdefault = parts[1];
                            //Add some shortcuts for object/array defaults
                            Iif (optdefault.toLowerCase() === 'object') {
                                optdefault = '{}';
                            }
                            Iif (optdefault.toLowerCase() === 'array') {
                                optdefault = '[]';
                            }
                        }
                    }
                }
 
                // parse object.prop, indicating a child property for object
                if (name.indexOf('.') > -1) {
                    match = name.split('.');
                    parent = trim(match[0]);
                    Y.each(target.params, function (param) {
                        if (param.name === parent) {
                            param.props = param.props || [];
                            host = param.props;
                            match.shift();
                            name = trim(match.join('.'));
                            Iif (match.length > 1) {
                                var pname = name.split('.')[0],
                                    par;
                                Y.each(param.props, function (o) {
                                    if (o.name === pname) {
                                        par = o;
                                    }
                                });
                                if (par) {
                                    match = name.split('.');
                                    match.shift();
                                    name = match.join('.');
                                    par.props = par.props || [];
                                    host = par.props;
                                }
                            }
                        }
                    });
 
                }
 
                result = {
                    name: name,
                    description: explodeString(desc)
                };
 
                if (type) {
                    result.type = type;
                }
 
                if (optional) {
                    result.optional = true;
                    if (optdefault) {
                        result.optdefault = optdefault;
                    }
                }
 
                if (multiple) {
                    result.multiple = true;
                }
 
                host.push(result);
            },
 
            // @return {type} description // methods
            // @returns {type} description // methods
            // @throws {type} an error #2173342
            // @injects {HTML|CSS|script} description
            // can be used by anthing that has an optional {type} and a description
            'return': function (tagname, value, target, block) {
 
                var desc = implodeString(trim(value)),
                    type,
                    match = REGEX_TYPE.exec(desc),
                    result = {};
                if (match) {
                    type = fixType(trim(match[2]));
                    desc = trim(match[1] + match[3]);
                }
 
                result = {
                    description: explodeString(desc)
                };
 
                if (type) {
                    result.type = type;
                }
 
                target[tagname] = result;
 
            },
            'throws': 'return',
            'injects': 'return',
 
            // trying to overwrite the constructor value is a bad idea
            'constructor': function (tagname, value, target, block) {
                target.is_constructor = 1;
            },
 
            // @author {twitter: @arthurdent | github: ArthurDent}
            //    Arthur Dent adent@h2g2.earth #23, multiple // modules/class/method
            // 'author': function(tagname, value, target, block) {
            //     // Y.log('author digester');
            // },
 
            // A key bock type for declaring modules and submodules
            // subsequent class and member blocks will be assigned
            // to this module.
            'module': function (tagname, value, target, block) {
                this.set(CURRENT_MODULE, value);
                var go = true;
                Y.some(block, function (o) {
                    if (trim(o.tag) === 'submodule') {
                        go = false;
                        return true;
                    }
                });
                if (go) {
                    if (!this.get(MAIN_MODULE)) {
                        this.set(MAIN_MODULE, {
                            tag: tagname,
                            name: value,
                            file: target.file,
                            line: target.line,
                            description: target.description
                        });
                    }
                    return this.modules[value];
                }
                return null;
            },
 
            //Setting the description for the module..
            'main': function (tagname, value, target, block) {
                var o = target;
                o.mainName = value;
                o.tag = tagname;
                o.itemtype = 'main';
                o._main = true;
                this.set(MAIN_MODULE, o);
            },
 
            // accepts a single project definition for the source tree
            'project': function (tagname, value, target, block) {
                return this.project;
            },
 
            // A key bock type for declaring submodules.  subsequent class and
            // member blocks will be assigned to this submodule.
            'submodule': function (tagname, value, target, block) {
                //console.log('Setting current submodule: ', value, 'on class');
                this.set(CURRENT_SUBMODULE, value);
                var host = this.modules[value],
                    clazz = this.get(CURRENT_CLASS),
                    parent = this.get(CURRENT_MODULE);
                Eif (parent) {
                    host.module = parent;
                }
                if (clazz && this.classes[clazz]) {
                    //console.log('Adding submodule', value , 'to class', clazz, ' it has submodule', this.classes[clazz].submodule);
                    //if (!this.classes[clazz].submodule) {
                    //console.log('REALLY Adding submodule', value , 'to class', clazz);
                    this.classes[clazz].submodule = value;
                    //}
                }
                return host;
            },
 
            // A key bock type for declaring classes, subsequent
            // member blocks will be assigned to this class
            'class': function (tagname, value, target, block) {
                var namespace, fullname, host, parent;
 
                block.forEach(function (def) {
                    if (def.tag === 'namespace') {
                        //We have a namespace, augment the name
                        var name = trim(def.value) + '.' + value;
                        Eif (value.indexOf(trim(def.value) + '.') === -1) {
                            value = name;
                            namespace = trim(def.value);
                        }
                    }
                });
 
                if (namespace) {
                    this.set(CURRENT_NAMESPACE, namespace);
                }
                this.set(CURRENT_CLASS, value);
 
                fullname = this.get(CURRENT_CLASS);
                host = this.classes[fullname];
                parent = this.get(CURRENT_MODULE);
 
                if (namespace) {
                    host.namespace = namespace;
                }
                Eif (parent) {
                    host.module = parent;
                }
 
                //Merge host and target in case the class was defined in a "for" tag
                //before it was defined in a "class" tag
                host = Y.merge(host, target);
                this.classes[fullname] = host;
                parent = this.get(CURRENT_SUBMODULE);
                if (parent) {
                    //this.set(CURRENT_SUBMODULE, parent);
                    host.submodule = parent;
                }
                return host;
            },
 
            // change 'const' to final property
            'const': function (tagname, value, target, block) {
                target.itemtype = 'property';
                target.name = value;
                /*jshint sub:true */
                target['final'] = '';
            },
 
            // supported classitems
            'property': function (tagname, value, target, block) {
                var match, name, desc, type;
 
                target.itemtype = tagname;
                target.name = value;
                Eif (!target.type) {
                    desc = implodeString(trim(value));
                    match = REGEX_TYPE.exec(desc);
 
                    // Extract {type}
                    if (match) {
                        type = fixType(trim(match[2]));
                        name = trim(match[1] + match[3]);
                        target.type = type;
                        target.name = name;
                    }
 
                }
                if (target.type && target.type.toLowerCase() === 'object') {
                    block.forEach(function (i, k) {
                        if (i.tag === 'property') {
                            i.value = trim(i.value);
                            i.tag = 'param';
                            block[k] = i;
                        }
                    });
                }
            },
            'method': 'property',
            'attribute': 'property',
            'config': 'property',
            'event': 'property',
 
            // access fields
            'public': function (tagname, value, target, block) {
                target.access = tagname;
                target.tagname = value;
            },
            'private': 'public',
            'protected': 'public',
            'inner': 'public',
 
            // tags that can have multiple occurances in a single block
            'todo': function (tagname, value, target, block) {
                if (!Lang.isArray(target[tagname])) {
                    target[tagname] = [];
                }
                //If the item is @tag one,two
                if (value.indexOf(',') > -1) {
                    value = value.split(',');
                } else {
                    value = [value];
                }
 
                value.forEach(function (v) {
                    v = trim(v);
                    target[tagname].push(v);
                });
            },
            'extension_for': 'extensionfor',
            'extensionfor': function (tagname, value, target, block) {
                Eif (this.classes[this.get(CURRENT_CLASS)]) {
                    this.classes[this.get(CURRENT_CLASS)].extension_for.push(value);
                }
            },
            'example': function (tagname, value, target, block) {
                if (!Lang.isArray(target[tagname])) {
                    target[tagname] = [];
                }
 
                var e = value;
                block.forEach(function (v) {
                    if (v.tag === 'example') {
                        if (v.value.indexOf(value) > -1) {
                            e = v.value;
                        }
                    }
                });
 
                target[tagname].push(e);
            },
            'url': 'todo',
            'icon': 'todo',
            'see': 'todo',
            'requires': 'todo',
            'knownissue': 'todo',
            'uses': 'todo',
            'category': 'todo',
            'unimplemented': 'todo',
 
            genericValueTag: function (tagname, value, target, block) {
                target[tagname] = value;
            },
 
            'author': 'genericValueTag',
            'contributor': 'genericValueTag',
            'since': 'genericValueTag',
 
            'deprecated': function (tagname, value, target, block) {
                target.deprecated = true;
 
                Eif (typeof value === 'string' && value.length) {
                    target.deprecationMessage = value;
                }
            },
 
            // updates the current namespace
            'namespace': function (tagname, value, target, block) {
                this.set(CURRENT_NAMESPACE, value);
                Iif (value === '') {
                    //Shortcut this if namespace is an empty string.
                    return;
                }
                var m,
                    mod,
                    name,
                    lastNS,
                    file = this.get(CURRENT_FILE);
                Eif (file) {
                    this.files[file].namespaces[value] = 1;
                }
                mod = this.get(CURRENT_MODULE);
                Eif (mod) {
                    this.modules[mod].namespaces[value] = 1;
                }
 
                mod = this.get(CURRENT_SUBMODULE);
                Iif (mod) {
                    this.modules[mod].namespaces[value] = 1;
                }
 
                mod = this.get(CURRENT_CLASS);
                Eif (mod) {
                    lastNS = this.get('lastnamespace');
                    Iif (lastNS && lastNS !== value && (value.indexOf(lastNS + '.') !== 0)) {
                        if (this.classes[mod]) {
                            m = this.classes[mod];
                            delete this.classes[mod];
                            mod = value + '.' + mod.replace(lastNS + '.', '');
                            m.name = mod;
                            m.namespace = value;
                            this.classes[mod] = m;
                            this.set(CURRENT_CLASS, m.name);
                        }
                    }
                    Eif (this.classes[mod]) {
                        this.classes[mod].namespace = value;
                        if (mod === value) {
                            return;
                        }
                        Iif (mod.indexOf(value + '.') === -1) {
                            if (mod.indexOf('.') === -1) {
                                m = this.classes[mod];
                                delete this.classes[mod];
                                name = m.namespace + '.' + m.name;
                                m.name = name;
                                this.classes[name] = m;
                                this.set(CURRENT_CLASS, name);
                            } else {
                                if (mod.indexOf(this.classes[mod].namespace + '.') === -1) {
                                    m = this.classes[mod];
                                    delete this.classes[mod];
                                    name = m.namespace + '.' + m.shortname;
                                    m.name = name;
                                    this.classes[name] = m;
                                    this.set(CURRENT_CLASS, name);
                                }
                            }
                        }
                    }
                }
            },
 
            // updates the current class only (doesn't create
            // a new class definition)
            'for': function (tagname, value, target, block) {
                var ns, file, mod;
 
                value = this._resolveFor(value);
                this.set(CURRENT_CLASS, value);
 
                ns = ((this.classes[value]) ? this.classes[value].namespace : '');
                this.set(CURRENT_NAMESPACE, ns);
 
                file = this.get(CURRENT_FILE);
                Eif (file) {
                    this.files[file].fors[value] = 1;
                }
 
                mod = this.get(CURRENT_MODULE);
                Eif (mod) {
                    this.modules[mod].fors[value] = 1;
                }
 
                mod = this.get(CURRENT_SUBMODULE);
                Eif (mod) {
                    this.modules[mod].fors[value] = 1;
                }
            }
        },
 
        /**
         * The doc parser accepts a **map** of files to file content.
         * Once `parse()` is called, various properties will be populated
         * with the parsers data (aggregated in the `'data'` property).
         * @class DocParser
         * @extends Base
         * @constructor
         * @param {Object} o the config object
         * @module yuidoc
         */
        DocParser = function (o) {
            this.digesters = Y.merge(DocParser.DIGESTERS);
            this.knowntags = Y.Array.hash(DocParser.TAGLIST);
            DocParser.superclass.constructor.apply(this, arguments);
        };
 
    DocParser.NAME = 'DocParser';
 
    DocParser.DIGESTERS = DIGESTERS;
    DocParser.TAGLIST = TAGLIST;
    DocParser.CORRECTIONS = CORRECTIONS;
 
    DocParser.ATTRS = {
 
        lint: {
            value: false
        },
 
        /**
         * Digesters process the tag/text pairs found in a
         * comment block.  They are looked up by tag name.
         * The digester gets the tagname, the value, the
         * target object to apply values to, and the full
         * block that is being processed.  Digesters can
         * be declared as strings instead of a function --
         * in that case, the program will try to look up
         * the key listed and use the function there instead
         * (it is an alias).  Digesters can return a host
         * object in the case the tag defines a new key
         * block type (modules/classes/methods/events/properties)
         * @attribute digesters
         */
        digesters: {
            setter: function (val) {
                Y.mix(this.digesters, val, true);
                Y.mix(this.knowntags, val, true);
                return val;
            }
        },
 
        /**
         * Emitters will be schemas for the types of payloads
         * the parser will emit.  Not implemented.
         * @attribute emitters
         */
        emitters: {
            setter: function (val) {
                Y.mix(this.emitters, val, true);
            }
        },
 
        /**
         * Comment syntax type.
         * @attribute syntaxtype
         * @type String
         */
        syntaxtype: {
            writeOnce: true,
        },
 
        /**
         * The map of file names to file content.
         * @attribute filemap
         */
        filemap: {
            writeOnce: true
        },
 
        /**
         * A map of file names to directory name.  Provided in
         * case this needs to be used to reset the module name
         * appropriately -- currently not used
         * @attribute dirmap
         */
        dirmap: {
            writeOnce: true
        },
 
        /**
         * The file currently being parsed
         * @attribute currentfile
         * @type String
         */
        currentfile: {
            setter: function (val) {
                val = trim(val);
                // this.set(CURRENT_NAMESPACE, '');
                Eif (!(val in this.files)) {
                    this.files[val] = {
                        name: val,
                        modules: {},
                        classes: {},
                        fors: {},
                        namespaces: {}
                    };
                }
                return val;
            }
        },
        /**
         * The main documentation block for the module itself.
         * @attribute mainmodule
         * @type String
         */
        mainmodule: {
            setter: function (o) {
                if (!o) {
                    return;
                }
                //console.log('Main Module Setter: ', o);
                var write = true,
                    name = o.mainName || o.name;
                if (this.get(CURRENT_MODULE) === name) {
 
                    Eif (name in this.modules) {
                        //console.log('In Global Modules', this.modules[name]);
                        if (this.modules[name].tag) {
                            //The main module has already been added, don't over write it.
                            if (this.modules[name].tag === 'main') {
                                write = false;
                            }
                        }
                        if (write) {
                            //console.log('Writing');
                            this.modules[name] = Y.merge(this.modules[name], o);
                        }
                    } else {
                        if (o._main) {
                            //console.log('Writing');
                            this.modules[name] = o;
                        }
                    }
                }
            }
        },
        /**
         * The module currently being parsed
         * @attribute currentmodule
         * @type String
         */
        currentmodule: {
            setter: function (val) {
                Iif (!val) {
                    return val;
                }
                val = trim(val);
 
                var modMain, clazz;
 
                this.set(CURRENT_SUBMODULE, '');
                this.set(CURRENT_NAMESPACE, '');
 
                modMain = this.get(MAIN_MODULE);
                if (modMain && modMain.name !== val) {
                    this.set(MAIN_MODULE, '');
                }
 
                clazz = this.classes[this.get(CURRENT_CLASS)];
                if (clazz) {
                    //Handles case where @module comes after @class in a new directory of files 
                    if (clazz.module !== val) {
                        Eif (this.modules[clazz.module]) {
                            delete this.modules[clazz.module].submodules[clazz.submodule];
                            delete this.modules[clazz.module].classes[clazz.name];
                        }
                        Iif (clazz.submodule && this.modules[clazz.submodule]) {
                            delete this.modules[clazz.submodule].submodules[clazz.submodule];
                            delete this.modules[clazz.submodule].classes[clazz.name];
                        }
                        clazz.module = val;
                        Iif (this.modules[val]) {
                            this.modules[val].submodules[clazz.submodule] = 1;
                            this.modules[val].classes[clazz.name] = 1;
                        }
                        Iif (clazz.submodule && this.modules[clazz.submodule]) {
                            this.modules[clazz.submodule].module = val;
                        }
                    }
                }
 
                if (!(val in this.modules)) {
                    this.modules[val] = {
                        name: val,
                        submodules: {},
                        classes: {},
                        fors: {},
                        namespaces: {}
                    };
                }
 
                return val;
            }
        },
 
        /**
         * The submodule currently being parsed
         * @attribute currentsubmodule
         * @type String
         */
        currentsubmodule: {
            setter: function (val) {
                if (!val) {
                    return val;
                }
                val = trim(val);
                if (!(val in this.modules)) {
                    var mod = this.modules[val] = {
                        name: val,
                        submodules: {},
                        classes: {},
                        fors: {},
                        is_submodule: 1,
                        namespaces: {}
                    };
 
                    mod.module = this.get(CURRENT_MODULE);
                    mod.namespace = this.get(CURRENT_NAMESPACE);
                }
                //console.log('SETTING CURRENT SUBMODULE: ', val, 'ON CLASS', this.get(CURRENT_CLASS));
                return val;
            }
        },
        currentnamespace: {
            setter: function (val) {
                this.set('lastnamespace', this.get(CURRENT_NAMESPACE));
                return val;
            }
        },
        lastnamespace: {
 
        },
        lastclass: {
 
        },
        /**
         * The class currently being parsed
         * @attribute currentclass
         * @type String
         */
        currentclass: {
            setter: function (val) {
                if (!val) {
                    return val;
                }
                this.set('lastclass', this.get(CURRENT_CLASS));
                val = trim(val);
                var name = val,
                    ns, clazz;
                if (!(val in this.classes)) {
                    ns = this.get(CURRENT_NAMESPACE);
                    Iif (ns && ns !== '' && (val.indexOf(ns + '.') !== 0)) {
                        name = ns + '.' + val;
                    }
                    clazz = this.classes[name] = {
                        name: name,
                        shortname: val,
                        classitems: [],
                        plugins: [],
                        extensions: [],
                        plugin_for: [],
                        extension_for: []
                    };
                    clazz.module = this.get(CURRENT_MODULE);
                    if (this.get(CURRENT_SUBMODULE)) {
                        clazz.submodule = this.get(CURRENT_SUBMODULE);
                    }
                    clazz.namespace = ns;
                }
                return name;
            }
        }
    };
 
    Y.extend(DocParser, Y.Base, {
        /**
         * Takes a non-namespaced classname and resolves it to a namespace (to support `@for`)
         * @private
         * @method _resolveFor
         * @param {String} value The classname to resolve
         * @return {String} The resolved namespace + classname
         */
        _resolveFor: function (value) {
            Eif (value.indexOf('.') === -1) {
                Y.each(this.classes, function (i) {
                    if (i.shortname === value) {
                        Iif (i.namespace) {
                            value = i.namespace + '.' + i.shortname;
                        }
                    }
                });
            }
            return value;
        },
 
        initializer: function () {
            this.warnings = [];
 
            var self = this;
            self.after('currentfileChange', function (e) {
                /*
                 * File changed, so we reset class and submodule.
                 * You should use @for if you want to reference another class
                 * in different file.
                 */
                self.set(CURRENT_SUBMODULE, '');
                self.set(CURRENT_CLASS, '');
            });
 
            self.after('currentmoduleChange', function (e) {
                var mod = e.newVal,
                    classes = self.classes;
                Y.each(classes, function (clazz) {
                    Iif (!(clazz.module)) {
                        clazz.module = mod;
                    }
                });
            });
 
            self.after('currentsubmoduleChange', function (e) {
                var mod = e.newVal,
                    classes = self.classes,
                    parent;
 
                if (mod) {
                    parent = self.modules[mod].module;
                    Y.each(classes, function (clazz) {
                        if (!(clazz.submodule)) {
                            //if ((!clazz.module) || clazz.module == parent) {
                            Iif (!clazz.module) {
                                //console.log('Adding Submodule: ', mod, ' to', clazz.module, 'with parent', parent);
                                clazz.submodule = mod;
                            }
                        }
                    });
                }
            });
 
            self.after('currentclassChange', function (e) {
                var clazz = e.newVal;
                Y.each(self.classitems, function (item) {
                    if (!(item["class"])) {
                        item["class"] = clazz;
                    }
                });
                // Y.log(self.classitems);
            });
        },
 
        /**
        Normalizes the initial indentation of the given _content_ so that the first line
        is unindented, and all other lines are unindented to the same degree as the
        first line. So if the first line has four spaces at the beginning, then all
        lines will be unindented four spaces. Ported from [Selleck](https://github.com/rgrove/selleck)
 
        @method unindent
        @param {String} content Text to unindent.
        @return {String} Unindented text.
        @private
        **/
        unindent: function (content) {
            var indent = content.match(/^(\s+)/);
 
            if (indent) {
                content = content.replace(new RegExp('^' + indent[1], 'gm'), '');
            }
 
            return content;
        },
 
        /**
        Transforms a JavaDoc style comment block (less the start and end of it)
        into a list of tag/text pairs. The leading space and '*' are removed,
        but the remaining whitespace is preserved so that the output should be
        friendly for both markdown and html parsers.
 
        @method handlecomment
        @param {String} comment The comment to parse
        @param {String} file The file it was parsed from
        @param {String} line The line number it was found on
        **/
        handlecomment: function (comment, file, line) {
            var lines = comment.split(REGEX_LINES),
                len = lines.length,
                i,
                parts, part, peek, skip,
                tag, value,
                results = [{
                    tag: 'file',
                    value: file
                }, {
                    tag: 'line',
                    value: line
                }],
                syntaxtype = this.get('syntaxtype'),
                lineHeadCharRegex = REGEX_LINE_HEAD_CHAR[syntaxtype],
                hasLineHeadChar = lines[0] && lineHeadCharRegex.test(lines[0]);
 
            // trim leading line head char(star or harp) if there are any
            if (hasLineHeadChar) {
                for (i = 0; i < len; i++) {
                    lines[i] = lines[i].replace(lineHeadCharRegex, '');
                }
            }
 
            // reconsitute and tokenize the comment block
            comment = this.unindent(lines.join('\n'));
            parts = comment.split(/(?:^|\n)\s*(@\w*)/);
            len = parts.length;
            for (i = 0; i < len; i++) {
                value = '';
                part = parts[i];
                if (part === '') {
                    continue;
                }
                skip = false;
 
                // the first token may be the description, otherwise it should be a tag
                if (i === 0 && part.substr(0, 1) !== '@') {
                    Eif (part) {
                        tag = '@description';
                        value = part;
                    } else {
                        skip = true;
                    }
                } else {
                    tag = part;
                    // lookahead for the tag value
                    peek = parts[i + 1];
                    if (peek) {
                        value = peek;
                        i++;
                    }
                }
 
                Eif (!skip && tag) {
                    results.push({
                        tag: tag.substr(1).toLowerCase(),
                        value: value
                    });
                }
            }
 
            return results;
        },
 
        /**
         * Accepts a map of filenames to file content.  Returns
         * a map of filenames to an array of API comment block
         * text.  This expects the comment to start with / **
         * on its own line, and end with * / on its own
         * line.  Override this function to provide an
         * alternative comment parser.
         * @method extract
         * @param {Object} filemap A map of filenames to file content
         * @param {Array} dirmap A map of file names to directory name
         * @return {Object} A map of filenames to an array of extracted
         * comment text.
         */
        extract: function (filemap, dirmap) {
            filemap = filemap || this.get('filemap');
            dirmap = dirmap || this.get('dirmap');
            var syntaxtype = this.get('syntaxtype'),
                commentmap = {};
            Y.each(filemap, function (code, filename) {
 
                var commentlines, comment, line,
                    lines = code.split(REGEX_LINES),
                    len = lines.length,
                    i, linenum;
 
                for (i = 0; i < len; i++) {
                    line = lines[i];
                    if (REGEX_START_COMMENT[syntaxtype].test(line)) {
                        commentlines = [];
 
                        linenum = i + 1;
 
                        while (i < len && (!REGEX_END_COMMENT[syntaxtype].test(line))) {
                            commentlines.push(line);
                            i++;
                            line = lines[i];
                        }
 
                        // we can look ahead here if we need to guess the
                        // name/type like we do in the python version.
 
                        // remove /**
                        commentlines.shift();
                        comment = commentlines.join('\n');
                        commentmap[filename] = commentmap[filename] || [];
                        commentmap[filename]
                            .push(this.handlecomment(comment, filename, linenum));
                    }
                }
            }, this);
 
            this.commentmap = commentmap;
            return commentmap;
        },
 
        /**
         * Processes all the tags in a single comment block
         * @method processblock
         * @param {Array} an array of the tag/text pairs
         */
        processblock: function (block) {
            var target = {},
                digestname,
                digester,
                host;
 
            // Y.log(block);
            Y.each(block, function (tag) {
                var name = trim(tag.tag),
                    value = trim(tag.value),
                    ret;
 
                //Convert empty values to a 1 for JSON data parsing later
                if (SHORT_TAGS[name] && value === '') {
                    value = 1;
                }
 
                Eif (tag && tag.tag) {
                    if (!(name in this.knowntags)) {
                        Eif (name in CORRECTIONS) {
                            this.warnings.push({
                                message: 'replacing incorrect tag: ' + name + ' with ' + CORRECTIONS[name],
                                line: stringlog(block)
                            });
                            Y.log('replacing incorrect tag: ' + name + ' with ' + CORRECTIONS[name] + ': ' + stringlog(block), 'warn', 'docparser');
                            name = CORRECTIONS[name];
                        } else {
                            this.warnings.push({
                                message: 'unknown tag: ' + name,
                                line: stringlog(block)
                            });
                            Y.log('unknown tag: ' + name + ',' + stringlog(block), 'warn', 'docparser');
                        }
                    }
 
                    digestname = name;
                    if (digestname in this.digesters) {
                        digester = this.digesters[digestname];
                        if (Lang.isString(digester)) {
                            digester = this.digesters[digester];
                        }
                        ret = digester.call(this, name, value, target, block);
                        host = host || ret;
                    } else {
                        target[name] = value;
                    }
                }
            }, this);
 
            if (host) {
                Y.mix(host, target);
            } else {
                this.classitems.push(target);
                target['class'] = this.get(CURRENT_CLASS);
                target.module = this.get(CURRENT_MODULE);
 
                host = this.get(CURRENT_SUBMODULE);
                if (host) {
                    target.submodule = host;
                }
 
                host = this.get(CURRENT_NAMESPACE);
                if (host) {
                    target.namespace = host;
                }
            }
        },
 
        /**
         * Transforms a map of filenames to arrays of comment blocks into a
         * JSON structure that represents the entire processed API doc info
         * and relationships between elements for the entire project.
         * @method transform
         * @param {object} commentmap The hash of files and parsed comment blocks
         * @return {object} The transformed data for the project
         */
        transform: function (commentmap) {
            var self = this,
                project = self.project = {},
                files = self.files = {},
                modules = self.modules = {},
                classes = self.classes = {},
                classitems = self.classitems = [];
 
            self.data = {
                project: project,
                files: files,
                modules: modules,
                classes: classes,
                classitems: classitems
            };
 
            commentmap = commentmap || self.commentmap;
 
            // process
            Y.each(commentmap, function (blocks, file) {
                //Y.log('transform: ' + file, 'info', 'docparser');
                self.set(CURRENT_FILE, file);
                Y.each(blocks, function (block) {
                    self.processblock(block);
                });
            });
 
            // cross reference
            Y.each(modules, function (module, name) {
                if (module.file) {
                    files[module.file].modules[name] = 1;
                }
                if (module.is_submodule) {
                    modules[module.module].submodules[name] = 1;
                }
                //Clean up processors
                delete module.mainName;
                delete module._main;
            });
 
            Y.each(classes, function (clazz, name) {
                Eif (clazz.module) {
                    modules[clazz.module].classes[name] = 1;
                }
                //console.error('------------------------------');
                //console.error(clazz);
                //console.error(modules[clazz.submodule]);
                //console.error('------------------------------');
                if (clazz.submodule) {
                    modules[clazz.submodule].classes[name] = 1;
                    if (!modules[clazz.submodule].description) {
                        modules[clazz.submodule].description = clazz.description;
                    }
                }
 
                Eif (clazz.file) {
                    files[clazz.file].classes[name] = 1;
                    Eif (modules[clazz.module]) {
                        modules[clazz.module].file = clazz.file;
                        modules[clazz.module].line = clazz.line;
                    }
                    if (modules[clazz.submodule]) {
                        modules[clazz.submodule].file = clazz.file;
                        modules[clazz.submodule].line = clazz.line;
                    }
                }
                Iif (clazz.uses && clazz.uses.length) {
                    clazz.uses.forEach(function (u) {
                        var c = classes[u];
                        if (c) {
                            c.extension_for.push(clazz.name);
                        }
                    });
                }
            });
 
            Y.each(classitems, function (v) {
                Iif (!v.itemtype) {
                    self.warnings.push({
                        message: 'Missing item type' + (v.description ? '\n' + v.description : ''),
                        line: stringlog(v)
                    });
                    Y.log('Missing item type: ' + stringlog(v), 'warn', 'DocParser');
                    if (v.description) {
                        Y.log('\t\t' + v.description, 'warn', 'DocParser');
                    }
                }
                if (v.itemtype === 'property' && v.params) {
                    v.subprops = v.params;
                    v.subprops.forEach(function (i) {
                        //Remove top level prop name from sub props (should have been done in the @param parser
                        i.name = i.name.replace(v.name + '.', '');
                    });
                    delete v.params;
                }
            });
 
            Y.each(modules, function (mod) {
                Iif (!mod.file || !mod.line || !mod.name) {
                    console.log('Failed to find lines for', mod);
                }
            });
 
            return self;
        },
 
        /**
         * Extracts and transforms the filemap provided to constructor
         * @method parse
         * @param {Array} filemap A map of filenames to file content
         * @param {Array} dirmap A map of file names to directory name
         * @return {DocParser} this parser instance.  The total results
         * are available in parser.data.
         */
        parse: function (filemap, dirmap) {
            filemap = filemap || this.get('filemap');
            dirmap = dirmap || this.get('dirmap');
            return this.transform(this.extract(filemap, dirmap));
        }
    });
 
    Y.DocParser = DocParser;
 
}, '0.1.0', {
    requires: ['base-base']
});