- Timestamp:
- Feb 1, 2023 1:00:13 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scmrw-kmk.cpp
r98380 r98383 600 600 size_t const cchLine = pParser->cchLine; 601 601 uint32_t const cchIndent = pParser->iActualDepth 602 - (fElse && pParser->i Depth > 0 && !pParser->aDepth[pParser->iDepth].fIgnoreNesting);602 - (fElse && pParser->iActualDepth > 0 && !pParser->aDepth[pParser->iDepth - 1].fIgnoreNesting); 603 603 604 604 /* … … 747 747 size_t cchLine = pParser->cchLine; 748 748 uint32_t const cchIndent = pParser->iActualDepth 749 - (fElse && pParser->i Depth > 0 && !pParser->aDepth[pParser->iDepth].fIgnoreNesting);749 - (fElse && pParser->iActualDepth > 0 && !pParser->aDepth[pParser->iDepth - 1].fIgnoreNesting); 750 750 751 751 /* … … 1095 1095 pParser->iActualDepth -= 1; 1096 1096 } 1097 uint32_t const cchIndent = pParser->iActualDepth;1098 1097 ScmVerbose(pParser->pState, 5, "%u: debug: unnesting %u/%u (endif)\n", 1099 1098 ScmStreamTellLine(pParser->pIn), iDepth, pParser->iActualDepth); 1099 uint32_t const cchIndent = pParser->iActualDepth; 1100 1100 1101 1101 /* … … 1180 1180 static bool scmKmkHandleDefine(KMKPARSER *pParser, size_t offToken) 1181 1181 { 1182 scmKmkHandleSimple(pParser, offToken); 1183 1182 1184 /* Hack Alert! Start out parsing the define in recipe mode. 1183 1185 … … 1185 1187 used. However, we ASSUME they are either makefile code snippets or 1186 1188 recipe templates. */ 1189 scmKmkPushNesting(pParser, kKmkToken_define); 1187 1190 scmKmkSetInRecipe(pParser, true); 1188 1189 return scmKmkHandleSimple(pParser, offToken); 1191 return false; 1190 1192 } 1191 1193 … … 1195 1197 /* Leaving a define resets the recipt mode. */ 1196 1198 scmKmkSetInRecipe(pParser, false); 1199 1200 /* 1201 * Pop a nesting. 1202 */ 1203 if (pParser->iDepth < 1) 1204 return scmKmkGiveUp(pParser, "Lone 'endef'"); 1205 uint32_t iDepth = pParser->iDepth - 1; 1206 if (pParser->aDepth[iDepth].enmToken != kKmkToken_define) 1207 return scmKmkGiveUp(pParser, "Unpexected 'endef', expected 'endif' for line %u", pParser->aDepth[iDepth].iLine); 1208 pParser->iDepth = iDepth; 1209 if (!pParser->aDepth[iDepth].fIgnoreNesting) 1210 { 1211 AssertStmt(pParser->iActualDepth > 0, pParser->iActualDepth++); 1212 pParser->iActualDepth -= 1; 1213 } 1214 ScmVerbose(pParser->pState, 5, "%u: debug: unnesting %u/%u (endef)\n", 1215 ScmStreamTellLine(pParser->pIn), iDepth, pParser->iActualDepth); 1197 1216 1198 1217 return scmKmkHandleSimple(pParser, offToken);
Note:
See TracChangeset
for help on using the changeset viewer.