public Map<String, Object> getImports() { return this.parserConfiguration.getImports(); }
public Map<String, Object> getImports() { return this.parserConfiguration.getImports(); }
public Map<String, Object> getImports() { return this.parserConfiguration.getImports(); }
public boolean hasProtoImport(String name) { if (parserConfiguration.getImports() == null) return false; Object o = parserConfiguration.getImports().get(name); return o != null && o instanceof Proto; }
public boolean hasProtoImport(String name) { Object o = parserConfiguration.getImports().get(name); return o != null && o instanceof Proto; }
public boolean hasProtoImport(String name) { Object o = parserConfiguration.getImports().get(name); return o != null && o instanceof Proto; }
public Proto getProtoImport(String name) { return (Proto) parserConfiguration.getImports().get(name); }
public Proto getProtoImport(String name) { return (Proto) parserConfiguration.getImports().get(name); }
public Proto getProtoImport(String name) { return (Proto) parserConfiguration.getImports().get(name); }
public ClassImportResolverFactory(ParserConfiguration pCfg, VariableResolverFactory nextFactory, boolean compiled) { if ( pCfg != null ) { if (!compiled) { packageImports = pCfg.getPackageImports(); } classLoader = pCfg.getClassLoader(); imports = Collections.unmodifiableMap(pCfg.getImports()); } else { classLoader = Thread.currentThread().getContextClassLoader(); } this.nextFactory = nextFactory; }
public ClassImportResolverFactory(ParserConfiguration pCfg, VariableResolverFactory nextFactory, boolean compiled) { if ( pCfg != null ) { if (!compiled) { packageImports = pCfg.getPackageImports(); } classLoader = pCfg.getClassLoader(); imports = Collections.unmodifiableMap(pCfg.getImports()); } else { classLoader = Thread.currentThread().getContextClassLoader(); } this.nextFactory = nextFactory; }
public ClassImportResolverFactory(ParserConfiguration ctx, VariableResolverFactory nextFactory) { packageImports = ctx.getPackageImports(); Map<String, Object> classes = ctx.getImports(); classLoader = ctx.getClassLoader(); this.nextFactory = nextFactory; this.variableResolvers = new HashMap<String, VariableResolver>(); for (Map.Entry<String, Object> e : classes.entrySet()) { variableResolvers.put(e.getKey(), new SimpleValueResolver(e.getValue())); } }
scope.addAll(inputs.keySet()); scope.addAll( parserConfiguration.getImports().keySet() );
scope.addAll(inputs.keySet()); scope.addAll( parserConfiguration.getImports().keySet() );
public CompiledExpression(ASTLinkedList astMap, String sourceName, Class egressType, ParserConfiguration parserConfiguration, boolean literalOnly) { this.firstNode = astMap.firstNode(); this.sourceName = sourceName; this.knownEgressType = astMap.isSingleNode() ? astMap.firstNonSymbol().getEgressType() : egressType; this.literalOnly = literalOnly; this.parserConfiguration = parserConfiguration; this.importInjectionRequired = !parserConfiguration.getImports().isEmpty(); }
public CompiledExpression(ASTLinkedList astMap, String sourceName, Class egressType, ParserConfiguration parserConfiguration, boolean literalOnly) { this.firstNode = astMap.firstNode(); this.sourceName = sourceName; this.knownEgressType = astMap.isSingleNode() ? astMap.firstNonSymbol().getEgressType() : egressType; this.literalOnly = literalOnly; this.parserConfiguration = parserConfiguration; this.importInjectionRequired = !parserConfiguration.getImports().isEmpty(); }
/** * This is such a horrible hack, but it's more performant than any other horrible hack I can think of * right now. * * @param expr * @param cursor * @param pCtx */ public static void checkForPossibleUnresolvedViolations(char[] expr, int cursor, ParserContext pCtx) { if (isUnresolvedWaiting()) { LinkedHashMap<String, Object> imports = (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports(); Object o = imports.values().toArray()[imports.size() - 1]; if (o instanceof Proto) { Proto proto = (Proto) o; int last = proto.getCursorEnd(); cursor--; /** * We walk backwards to ensure that the last valid statement was a proto declaration. */ while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--; while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--; while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--; if (cursor != last) { throw new CompileException("unresolved reference (possible illegal forward-reference?): " + ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart()); } } } }
/** * This is such a horrible hack, but it's more performant than any other horrible hack I can think of * right now. * * @param expr * @param cursor * @param pCtx */ public static void checkForPossibleUnresolvedViolations(char[] expr, int cursor, ParserContext pCtx) { if (isUnresolvedWaiting()) { LinkedHashMap<String, Object> imports = (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports(); Object o = imports.values().toArray()[imports.size() - 1]; if (o instanceof Proto) { Proto proto = (Proto) o; int last = proto.getCursorEnd(); cursor--; /** * We walk backwards to ensure that the last valid statement was a proto declaration. */ while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--; while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--; while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--; if (cursor != last) { throw new CompileException("unresolved reference (possible illegal forward-reference?): " + ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart()); } } } }
/** * This is such a horrible hack, but it's more performant than any other horrible hack I can think of * right now. * * @param expr * @param cursor * @param pCtx */ public static void checkForPossibleUnresolvedViolations(char[] expr, int cursor, ParserContext pCtx) { if (isUnresolvedWaiting()) { LinkedHashMap<String, Object> imports = (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports(); Object o = imports.values().toArray()[imports.size() - 1]; if (o instanceof Proto) { Proto proto = (Proto) o; int last = proto.getCursorEnd(); cursor--; /** * We walk backwards to ensure that the last valid statement was a proto declaration. */ while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--; while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--; while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--; if (cursor != last) { throw new CompileException("unresolved reference (possible illegal forward-reference?): " + ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart()); } } } }
public void testUnwantedImport() { ParserConfiguration conf = new ParserConfiguration(); conf.addPackageImport("java.util"); conf.addPackageImport("org.mvel2.tests.core.res"); ParserContext pctx = new ParserContext( conf ); MVEL.analysisCompile( "ScenarioType.Set.ADD", pctx ); assertNull(conf.getImports().get("Set")); }