summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts
index d8607c764..a5c92e441 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ParserFactory.ts
@@ -6,6 +6,7 @@ import { FileExtension } from '../TemplateType';
import { JinjaXMLParser } from './JinjaXML';
import { VtlYMLParser } from './VtlYMLParser';
import { JinjaYMLParser } from './JinjaYML';
+import { ASCIIParser } from './ASCII-Parser';
export class ParserFactory {
@@ -19,6 +20,8 @@ export class ParserFactory {
parser = new XmlParser();
} else if (this.isJSON(fileContent)) {
parser = new VtlParser();
+ } else if (this.isASCII(fileContent)) {
+ parser = new ASCIIParser();
} else {
parser = new VtlYMLParser();
}
@@ -29,6 +32,8 @@ export class ParserFactory {
parser = new JinjaXMLParser();
} else if (this.isJSON(fileContent)) {
// TODO: implement JSON parser
+ } else if (this.isASCII(fileContent)) {
+ parser = new ASCIIParser();
} else {
parser = new JinjaYMLParser();
}
@@ -51,4 +56,16 @@ export class ParserFactory {
}
return true;
}
+
+ private isASCII(fileContent: string): boolean {
+ if (
+ fileContent.includes('end') &&
+ fileContent.includes('set') &&
+ fileContent.includes('$(')
+ ) {
+ return true;
+ }
+
+ return false;
+ }
}