@@ -1267,7 +1267,7 @@ const RemoveDuplicatePatternAnyEntity = function(parsedContent, pEntityName, ent
12671267 return false ;
12681268 }
12691269 } ) ;
1270- if ( PAEntityFound !== undefined && PAIdx !== - 1 ) {
1270+ if ( PAEntityFound !== undefined && PAIdx !== - 1 && entityType != EntityTypeEnum . PATTERNANY ) {
12711271 if ( entityType . toLowerCase ( ) . trim ( ) . includes ( 'phraselist' ) ) {
12721272 let errorMsg = `Phrase lists cannot be used as an entity in a pattern "${ pEntityName } "` ;
12731273 let error = BuildDiagnostic ( {
@@ -1762,7 +1762,7 @@ const parseAndHandleModelInfoSection = function (parsedContent, luResource, log)
17621762 if ( modelInfos && modelInfos . length > 0 ) {
17631763 for ( const modelInfo of modelInfos ) {
17641764 let line = modelInfo . ModelInfo
1765- let kvPair = line . split ( / @ ( a p p | k b | i n t e n t | e n t i t y | e n a b l e M e r g e I n t e n t s ) .( .* ) = / g) . map ( item => item . trim ( ) ) ;
1765+ let kvPair = line . split ( / @ ( a p p | k b | i n t e n t | e n t i t y | e n a b l e M e r g e I n t e n t s | p a t t e r n A n y E n t i t y ) .( .* ) = / g) . map ( item => item . trim ( ) ) ;
17661766 if ( kvPair . length === 4 ) {
17671767 if ( kvPair [ 1 ] === 'enableMergeIntents' && kvPair [ 3 ] === 'false' ) {
17681768 enableMergeIntents = false ;
@@ -1842,6 +1842,31 @@ const parseAndHandleModelInfoSection = function (parsedContent, luResource, log)
18421842 process . stdout . write ( chalk . default . yellowBright ( '[WARN]: Invalid entity inherits information found. Skipping "' + line + '"\n' ) ) ;
18431843 }
18441844 }
1845+ } else if ( kvPair [ 1 ] . toLowerCase ( ) === 'patternanyentity' ) {
1846+ if ( kvPair [ 2 ] . toLowerCase ( ) === 'inherits' ) {
1847+ let inheritsProperties = kvPair [ 3 ] . split ( / [: ; ] / g) . map ( item => item . trim ( ) ) ;
1848+ if ( inheritsProperties . length !== 6 ) {
1849+ process . stdout . write ( chalk . default . yellowBright ( '[WARN]: Invalid Pattern.Any inherits information found. Skipping "' + line + '"\n' ) ) ;
1850+ } else {
1851+ // find the intent
1852+ let entity = parsedContent . LUISJsonStructure . patternAnyEntities . find ( item => item . name == inheritsProperties [ 1 ] ) ;
1853+ if ( entity === undefined ) {
1854+ let newEntity = new helperClass . patternAnyEntity ( inheritsProperties [ 1 ] ) ;
1855+ newEntity . inherits = { } ;
1856+ newEntity [ 'inherits' ] [ inheritsProperties [ 2 ] ] = inheritsProperties [ 3 ] ;
1857+ newEntity [ 'inherits' ] [ inheritsProperties [ 4 ] ] = inheritsProperties [ 5 ] ;
1858+ parsedContent . LUISJsonStructure . patternAnyEntities . push ( newEntity ) ;
1859+ } else {
1860+ if ( entity [ 'inherits' ] === undefined ) entity [ 'inherits' ] = { } ;
1861+ entity [ 'inherits' ] [ inheritsProperties [ 2 ] ] = inheritsProperties [ 3 ] ;
1862+ entity [ 'inherits' ] [ inheritsProperties [ 4 ] ] = inheritsProperties [ 5 ] ;
1863+ }
1864+ }
1865+ } else {
1866+ if ( log ) {
1867+ process . stdout . write ( chalk . default . yellowBright ( '[WARN]: Invalid entity inherits information found. Skipping "' + line + '"\n' ) ) ;
1868+ }
1869+ }
18451870 }
18461871 } else {
18471872 if ( log ) {
0 commit comments