diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-09-18 15:09:30 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-09-18 15:09:30 +0200 |
commit | d4ac9feb6829750693db69e7f45ee6a9142d84d0 (patch) | |
tree | 0ccf303551f8c5f8445d7ba7f04e5baf11c26779 /lib/Kratos/DFADriver/DFA.pm | |
parent | 56f9c1e6b2612a292b184faebac766660c5afa46 (diff) |
Support specification of transitions in AspectC++ annotations
Diffstat (limited to 'lib/Kratos/DFADriver/DFA.pm')
-rw-r--r-- | lib/Kratos/DFADriver/DFA.pm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Kratos/DFADriver/DFA.pm b/lib/Kratos/DFADriver/DFA.pm index 33d96c3..9b581d8 100644 --- a/lib/Kratos/DFADriver/DFA.pm +++ b/lib/Kratos/DFADriver/DFA.pm @@ -6,6 +6,7 @@ use 5.020; use parent 'Class::Accessor'; +use Data::Dumper; use FLAT::DFA; use Math::Cartesian::Product; @@ -65,7 +66,21 @@ sub dfa { $dfa->set_accepting( $dfa->get_states ); for my $transition ( $self->model->transitions ) { - my $destination = $transition->{destination}; + print Dumper( $transition->{parameters} ); + + for my $param ( @{ $transition->{parameters} } ) { + if ( not defined $param->{values} ) { + die( +"argument values for transition $transition->{name} are undefined\n" + ); + } + if ( @{ $param->{values} } == 0 ) { + die( +"argument-value list for transition $transition->{name} is empty \n" + ); + } + } + my @argtuples = cartesian { 1 } map { $_->{values} } @{ $transition->{parameters} }; @@ -73,7 +88,8 @@ sub dfa { # an empty array if @{$transition->{parameters}} is empty for my $argtuple (@argtuples) { - for my $origin ( @{ $transition->{origins} } ) { + for my $transition_pair ( @{ $transition->{transitions} } ) { + my ( $origin, $destination ) = @{$transition_pair}; $dfa->add_transition( $self->model->get_state_id($origin), $self->model->get_state_id($destination), |