| 204 | } |
| 205 | |
| 206 | static inline void pushStack( SyntaxStateRestored& curState, SyntaxState& retState, |
| 207 | const SyntaxPattern& enteringSubsyntax, |
| 208 | const SyntaxStateType& patternIndex, |
| 209 | std::string_view patternTextStr ) { |
| 210 | if ( curState.currentLevel == MAX_SUB_SYNTAXS - 1 ) |
| 211 | return; |
| 212 | |
| 213 | if ( !enteringSubsyntax.hasSyntax() ) { |
| 214 | if ( retState.langStack[curState.currentLevel] != 0 || |
| 215 | retState.state[curState.currentLevel].state != 0 ) |
| 216 | curState.currentLevel++; |
| 217 | curState.subsyntaxInfo = &enteringSubsyntax; |
| 218 | retState.langStack[curState.currentLevel] = curState.currentSyntax->getLanguageIndex(); |
| 219 | setSubsyntaxPatternIdx( curState, retState, patternIndex ); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | setSubsyntaxPatternIdx( curState, retState, patternIndex ); |
| 224 | |
| 225 | curState.subsyntaxInfo = &enteringSubsyntax; |
| 226 | curState.currentSyntax = &SyntaxDefinitionManager::instance()->getByLanguageName( |
| 227 | curState.subsyntaxInfo->dynSyntax |
| 228 | ? curState.subsyntaxInfo->dynSyntax( enteringSubsyntax, patternTextStr ) |
| 229 | : curState.subsyntaxInfo->syntax ); |
| 230 | |
| 231 | retState.langStack[curState.currentLevel] = curState.currentSyntax->getLanguageIndex(); |
| 232 | curState.currentLevel++; |
| 233 | |
| 234 | setSubsyntaxPatternIdx( curState, retState, SyntaxStateType{} ); |
| 235 | } |
| 236 | |
| 237 | static inline void popStack( SyntaxStateRestored& curState, SyntaxState& retState, |
| 238 | const SyntaxDefinition& syntax, const SyntaxPattern& fromPattern ) { |
no test coverage detected