From f6aaaff81afabdaf298aab2b955bb755902c2fc4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 5 Jul 2021 20:01:25 +0100 Subject: [PATCH] Smarten regex to include overbar, superscript and subscript. Fixes https://gitlab.com/kicad/code/kicad/issues/8730 --- eeschema/sch_text_help.md | 7 +++++++ eeschema/sch_validators.cpp | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_text_help.md b/eeschema/sch_text_help.md index 0255663390..c8d4be447e 100644 --- a/eeschema/sch_text_help.md +++ b/eeschema/sch_text_help.md @@ -121,4 +121,11 @@                          
MEM.D1, MEM.D2, MEM.LATCH + +
+ +

+

+Note that markup has precedence over bus definitions. + diff --git a/eeschema/sch_validators.cpp b/eeschema/sch_validators.cpp index aba7d013f4..6368cc2708 100644 --- a/eeschema/sch_validators.cpp +++ b/eeschema/sch_validators.cpp @@ -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 ) )