| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## | ||
| 3 | ## File: DTA::CAB::Analyzer::ExLex::CDB.pm | ||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 5 | ## Description: DTA exception lexicon | ||
| 6 | |||
| 7 | ##============================================================================== | ||
| 8 | ## Package | ||
| 9 | ##============================================================================== | ||
| 10 | package DTA::CAB::Analyzer::ExLex::CDB; | ||
| 11 | use DTA::CAB::Analyzer ':child'; | ||
| 12 | use DTA::CAB::Analyzer::Dict::JsonCDB; | ||
| 13 | use Carp; | ||
| 14 | use strict; | ||
| 15 | our @ISA = qw(DTA::CAB::Analyzer::Dict::JsonCDB); | ||
| 16 | |||
| 17 | ## $obj = CLASS_OR_OBJ->new(%args) | ||
| 18 | ## + object structure: see DTA::CAB::Analyzer::Automaton::Gfsm, DTA::CAB::Analyzer::Automaton | ||
| 19 | sub new { | ||
| 20 | my $that = shift; | ||
| 21 | return $that->SUPER::new( | ||
| 22 | ##-- overrides | ||
| 23 | label => 'exlex', | ||
| 24 | typeKeys => [qw(exlex pnd errid)], | ||
| 25 | |||
| 26 | analyzeCode =>join("\n", | ||
| 27 | ( | ||
| 28 | 'return if (!defined($val=$dhash->{' | ||
| 29 | #._am_xlit('$_') | ||
| 30 | .'$_->{text}' | ||
| 31 | .'}));' | ||
| 32 | ), | ||
| 33 | '$val=$jxs->decode($val);', | ||
| 34 | '@$_{keys %$val}=values %$val;', | ||
| 35 | ), | ||
| 36 | |||
| 37 | ##-- user args | ||
| 38 | @_ | ||
| 39 | ); | ||
| 40 | } | ||
| 41 | |||
| 42 | ## $prefix = $dict->analyzePre() | ||
| 43 | sub analyzePre { | ||
| 44 | my $dic = shift; | ||
| 45 | return $dic->DTA::CAB::Analyzer::Dict::JsonCDB::analyzePre(@_).' my $tied=tied($dhash);'; | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | 1; ##-- be happy | ||
| 50 | |||
| 51 | __END__ |