Smarten regex to include overbar, superscript and subscript.

Fixes https://gitlab.com/kicad/code/kicad/issues/8730
This commit is contained in:
Jeff Young 2021-07-05 20:01:25 +01:00
parent 289a35ad81
commit f6aaaff81a
2 changed files with 12 additions and 4 deletions

View File

@ -121,4 +121,11 @@
<td></td>
<td> <samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<sub>&nbsp;</sub>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<sub>&nbsp;</sub>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></samp><br> <samp>MEM.D<sub>1</sub>, MEM.D<sub>2</sub>, MEM.LATCH</samp> </td>
</tr>
<tr>
<td><br></td>
</tr>
</table>
<p></p>
<p></p>
<i>Note that markup has precedence over bus definitions.</i>

View File

@ -202,7 +202,8 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow* aParent )
}
wxRegEx SCH_NETNAME_VALIDATOR::m_busGroupRegex( R"([^$]?{)", wxRE_ADVANCED );
// Match opening curly brace, preceeded by start-of-line or by a character not including $_^~
wxRegEx SCH_NETNAME_VALIDATOR::m_busGroupRegex( R"((^|[^$_\^~]){)", wxRE_ADVANCED );
wxString SCH_NETNAME_VALIDATOR::IsValid( const wxString& str ) const
@ -214,11 +215,11 @@ wxString SCH_NETNAME_VALIDATOR::IsValid( const wxString& str ) const
if( ( str.Contains( '[' ) || str.Contains( ']' ) ) &&
!NET_SETTINGS::ParseBusVector( str, nullptr, nullptr ) )
{
return _( "Signal name contains '[' or ']' but is not a valid vector bus name" );
return _( "Signal name contains '[' or ']' but is not a valid vector bus name." );
}
// Figuring out if the user "meant" to make a bus group is somewhat trickier because angle
// brackets are also used for variable expansion
// Figuring out if the user "meant" to make a bus group is somewhat trickier because curly
// braces are also used for formatting and variable expansion
if( m_busGroupRegex.Matches( str ) && str.Contains( '}' ) &&
!NET_SETTINGS::ParseBusGroup( str, nullptr, nullptr ) )