| 56 | }; |
| 57 | |
| 58 | void getAllRequireReq ( FileInfo * fi, const FileAccessPtr & access, string& modName, vector<RequireRecord> & req, vector<FileInfo *> & chain, das_set<FileInfo *> & collected ) { |
| 59 | ChainGuard guard(chain,fi); |
| 60 | const char * src = nullptr; |
| 61 | uint32_t length = 0; |
| 62 | fi->getSourceAndLength(src, length); |
| 63 | if ( isUtf8Text(src,length) ) { // skip utf8 byte order mark |
| 64 | src += 3; |
| 65 | length -= 3; |
| 66 | } |
| 67 | string incModName; |
| 68 | const char * src_end = src + length; |
| 69 | bool wb = true; |
| 70 | int32_t line = 1; |
| 71 | while ( src < src_end ) { |
| 72 | if ( src[0]=='\n' ) { |
| 73 | line ++; |
| 74 | } |
| 75 | if ( src[0]=='"' ) { |
| 76 | src ++; |
| 77 | while ( src < src_end && src[0]!='"' ) { |
| 78 | if ( src[0]=='\n' ) |
| 79 | line ++; |
| 80 | if ( src[0]=='\\' && src+1<src_end ) { |
| 81 | // Skip the escaped character so that \" inside a string literal does not terminate the string (likewise \\, \n, etc.). |
| 82 | if ( src[1]=='\n' ) line ++; |
| 83 | src += 2; |
| 84 | } else { |
| 85 | src ++; |
| 86 | } |
| 87 | } |
| 88 | if ( src < src_end ) src ++; |
| 89 | wb = true; |
| 90 | continue; |
| 91 | } else if ( src[0]=='\'' ) { |
| 92 | src ++; |
| 93 | while ( src < src_end && src[0]!='\'' ) { |
| 94 | if ( src[0]=='\n' ) |
| 95 | line ++; |
| 96 | if ( src[0]=='\\' && src+1<src_end ) { |
| 97 | if ( src[1]=='\n' ) line ++; |
| 98 | src += 2; |
| 99 | } else { |
| 100 | src ++; |
| 101 | } |
| 102 | } |
| 103 | if ( src < src_end ) src ++; |
| 104 | wb = true; |
| 105 | continue; |
| 106 | } else if ( src[0]=='/' && src[1]=='/' ) { |
| 107 | while ( src < src_end && !(src[0]=='\n') ) { |
| 108 | src ++; |
| 109 | } |
| 110 | if ( src < src_end && src[0]=='\n' ) |
| 111 | line ++; |
| 112 | src ++; |
| 113 | wb = true; |
| 114 | continue; |
| 115 | } else if ( src[0]=='/' && src[1]=='*' ) { |
no test coverage detected