Correctly handle a non-block rule on the same line as the closing brace of a block.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6293 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2018-01-12 17:07:40 +00:00
parent accb50a103
commit 03482ea3a5
1 changed files with 4 additions and 2 deletions

View File

@ -645,7 +645,7 @@ static bool oneContext(Message &msg, String &str, const String &context, String
blockLast = blockThis; blockLast = blockThis;
blockThis = (blockDepth > 0) ? blockStack[blockDepth-1] : BlockRun; blockThis = (blockDepth > 0) ? blockStack[blockDepth-1] : BlockRun;
} }
static Regexp s_blockStart("\\(=[[:space:]]*\\)\\?{$"); static Regexp s_blockStart("^\\(.*=[[:space:]]*\\)\\?{$");
if (s_blockStart.matches(*n)) { if (s_blockStart.matches(*n)) {
// start of a new block // start of a new block
if (blockDepth >= BLOCK_STACK) { if (blockDepth >= BLOCK_STACK) {
@ -656,7 +656,7 @@ static bool oneContext(Message &msg, String &str, const String &context, String
// assume block is done // assume block is done
BlockState blockEnter = BlockDone; BlockState blockEnter = BlockDone;
if (BlockRun == blockThis) { if (BlockRun == blockThis) {
// if we returned from a false inner block to a true outer block // if we just returned from a false inner block to a true outer block
if (BlockSkip == blockLast) if (BlockSkip == blockLast)
blockEnter = BlockSkip; blockEnter = BlockSkip;
else else
@ -664,6 +664,8 @@ static bool oneContext(Message &msg, String &str, const String &context, String
} }
blockStack[blockDepth++] = blockEnter; blockStack[blockDepth++] = blockEnter;
} }
else if (BlockSkip != blockLast)
blockThis = BlockDone;
XDebug("RegexRoute",DebugAll,"%s:%d(%u:%s) %s=%s",context.c_str(),i+1, XDebug("RegexRoute",DebugAll,"%s:%d(%u:%s) %s=%s",context.c_str(),i+1,
blockDepth,String::boolText(BlockRun == blockThis), blockDepth,String::boolText(BlockRun == blockThis),
n->name().c_str(),n->c_str()); n->name().c_str(),n->c_str());