Make sure sexpr gets stacked when followed by non-token.

For instance, with "(min 1.27mm)", we need to stack the
"min" token after hitting the space.
This commit is contained in:
Jeff Young 2023-12-31 13:19:35 +00:00
parent 53e16558a5
commit 911a54ac82
1 changed files with 18 additions and 8 deletions

View File

@ -312,16 +312,28 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
} }
else if( c == ' ' ) else if( c == ' ' )
{ {
if( context == SEXPR_OPEN && ( partial == wxT( "constraint" ) if( context == SEXPR_OPEN && !partial.IsEmpty() )
|| partial == wxT( "disallow" )
|| partial == wxT( "layer" )
|| partial == wxT( "severity" ) ) )
{ {
m_textEditor->AutoCompCancel(); m_textEditor->AutoCompCancel();
sexprs.push( partial ); sexprs.push( partial );
partial = wxEmptyString; if( partial == wxT( "constraint" )
|| partial == wxT( "layer" )
|| partial == wxT( "severity" ) )
{
context = SEXPR_TOKEN; context = SEXPR_TOKEN;
}
else if( partial == wxT( "rule" )
|| partial == wxT( "condition" ) )
{
context = SEXPR_STRING;
}
else
{
context = NONE;
}
partial = wxEmptyString;
continue; continue;
} }
else if( partial == wxT( "disallow" ) else if( partial == wxT( "disallow" )
@ -336,9 +348,7 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
context = SEXPR_TOKEN; context = SEXPR_TOKEN;
continue; continue;
} }
else if( partial == wxT( "rule" ) else if( partial == wxT( "assertion" ) )
|| partial == wxT( "assertion" )
|| partial == wxT( "condition" ) )
{ {
m_textEditor->AutoCompCancel(); m_textEditor->AutoCompCancel();
sexprs.push( partial ); sexprs.push( partial );