Search in sources :

Example 1 with PerlLanguage

use of org.talend.designer.mapper.language.perl.PerlLanguage in project tdi-studio-se by Talend.

the class DataMapExpressionParser method addRefArrayPointer.

public String addRefArrayPointer(String expression, TableEntryLocation[] locations) {
    String returnedExpression = expression;
    PerlLanguage perlLanguage = (PerlLanguage) language;
    for (TableEntryLocation location : locations) {
        recompilePatternIfNecessary(StringHelper.replacePrms(perlLanguage.getSubstPatternToAddRefArrayPointer(), new Object[] { location.tableName }));
        if (returnedExpression != null) {
            matcher.setMultiline(true);
            Perl5Substitution substitution = new Perl5Substitution(//$NON-NLS-1$
            language.getPrefixTableRegexp() + "$1->" + perlLanguage.getPrefixFieldRegexp() + "$2" + perlLanguage.getSuffixFieldRegexp(), //$NON-NLS-1$
            Perl5Substitution.INTERPOLATE_ALL);
            returnedExpression = substitute(matcher, pattern, substitution, returnedExpression, Util.SUBSTITUTE_ALL);
        }
    }
    return returnedExpression;
}
Also used : Perl5Substitution(org.apache.oro.text.regex.Perl5Substitution) TableEntryLocation(org.talend.designer.mapper.model.tableentry.TableEntryLocation) PerlLanguage(org.talend.designer.mapper.language.perl.PerlLanguage)

Example 2 with PerlLanguage

use of org.talend.designer.mapper.language.perl.PerlLanguage in project tdi-studio-se by Talend.

the class LanguageProvider method getCurrentLanguage.

public static ILanguage getCurrentLanguage() {
    ECodeLanguage codeLanguage = null;
    if (!MapperMain.isStandAloneMode()) {
        RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
        codeLanguage = repositoryContext.getProject().getLanguage();
    } else {
        codeLanguage = ECodeLanguage.PERL;
    }
    switch(codeLanguage) {
        case JAVA:
            if (!(language instanceof JavaLanguage) || LanguageProvider.language == null) {
                LanguageProvider.language = getJavaLanguage();
            }
            break;
        default:
            if (!(language instanceof PerlLanguage) || LanguageProvider.language == null) {
                LanguageProvider.language = getPerlLanguage();
            }
    }
    return LanguageProvider.language;
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) PerlLanguage(org.talend.designer.mapper.language.perl.PerlLanguage) JavaLanguage(org.talend.designer.mapper.language.java.JavaLanguage) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Aggregations

PerlLanguage (org.talend.designer.mapper.language.perl.PerlLanguage)2 Perl5Substitution (org.apache.oro.text.regex.Perl5Substitution)1 RepositoryContext (org.talend.core.context.RepositoryContext)1 ECodeLanguage (org.talend.core.language.ECodeLanguage)1 JavaLanguage (org.talend.designer.mapper.language.java.JavaLanguage)1 TableEntryLocation (org.talend.designer.mapper.model.tableentry.TableEntryLocation)1