Skip to content

Commit

Permalink
Merge pull request #1612 from nasa/1611-enum-class
Browse files Browse the repository at this point in the history
Trick Fails to Compile Sims with enum classes #1611
  • Loading branch information
hchen99 authored Nov 16, 2023
2 parents 260b5fa + 52998e5 commit e40fe00
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion libexec/trick/convert_swig
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ my $typedef_struct = qr/typedef\s+(?:struct|union)\s* # the words typedef s
my $namespace_def = qr/namespace\s* # keyword namespace
(?:\s+[_A-Za-z]\w*) # class name
/sx ;
my $enum_class_def = qr/enum\s+class\s* # keywords enum_class
(?:\s+[_A-Za-z]\w*)\s* # class name
(?:\{|:(?!\:)) # { or punctuator :
/sx ;
my $class_def = qr/(?:class|struct)\s* # keyword class or struct
(?:\s+[_A-Za-z]\w*)\s* # class name
(?:\{|:(?!\:)) # { or punctuator :
Expand Down Expand Up @@ -394,13 +398,15 @@ sub process_contents($$$$) {
($typedef_const_struct)|
($template_def)|
($namespace_def)|
($enum_class_def)|
($class_def))//sx ) {
my ( $non_var ) = $1 ;
my ( $typedef_struct_string ) = $2 ;
my ( $typedef_const_struct_string ) = $3 ;
my ( $template_string ) = $4 ;
my ( $namespace_string ) = $5 ;
my ( $class_string ) = $6 ;
my ( $enum_class_string ) = $6 ;
my ( $class_string ) = $7 ;

## Handle the case of: non_var
if ( $non_var ne "" ) {
Expand Down Expand Up @@ -435,6 +441,13 @@ sub process_contents($$$$) {
$class_names_ref ) ;
}
##
## Handle the case of: class_def ==> enum class <enum-name> ( '{' | ':' )
##
if ( $enum_class_string ne "" ) {
$$new_contents_ref .= $enum_class_string ;
}

##
## Handle the case of: class_def ==> ( class | struct ) <class-name> ( '{' | ':' )
##
if ( $class_string ne "" ) {
Expand Down

0 comments on commit e40fe00

Please sign in to comment.