Package ch.njol.skript.lang

Examples of ch.njol.skript.lang.SkriptParser


        if (StringUtils.startsWithIgnoreCase(name, "loop ")) {
          final String l = "" + name.substring("loop ".length());
          final RetainingLogHandler h = SkriptLogger.startRetainingLog();
          Expression<?> loopedExpr;
          try {
            loopedExpr = new SkriptParser(l).parseExpression(Object.class);
            if (loopedExpr != null)
              loopedExpr = loopedExpr.getConvertedExpression(Object.class);
            if (loopedExpr == null) {
              h.printErrors("Can't understand this loop: '" + name + "'");
              continue;
View Full Code Here


          if (def.startsWith("\"") && def.endsWith("\""))
            d = (Expression<? extends T>) VariableString.newInstance("" + def.substring(1, def.length() - 1));
          else
            d = (Expression<? extends T>) new SimpleLiteral<String>(def, false);
        } else {
          d = new SkriptParser(def, SkriptParser.PARSE_LITERALS, ParseContext.DEFAULT).parseExpression(type.getC());
        }
        if (d == null) {
          log.printErrors("'" + def + "' is not " + type.getName().withIndefiniteArticle());
          return null;
        }
View Full Code Here

    this.function = function;
  }
 
  @Nullable
  public final static EffFunctionCall parse(final String line) {
    final FunctionReference<?> function = new SkriptParser(line, SkriptParser.ALL_FLAGS, ParseContext.DEFAULT).parseFunction((Class<?>[]) null);
    if (function != null)
      return new EffFunctionCall(function);
    return null;
  }
View Full Code Here

    Expression<? extends T> d = null;
    if (def != null) {
      if (def.startsWith("%") && def.endsWith("%")) {
        final RetainingLogHandler log = SkriptLogger.startRetainingLog();
        try {
          d = new SkriptParser("" + def.substring(1, def.length() - 1), SkriptParser.PARSE_EXPRESSIONS, ParseContext.COMMAND).parseExpression(type.getC());
          if (d == null) {
            log.printErrors("Can't understand this expression: " + def + "");
            return null;
          }
          log.printLog();
        } finally {
          log.stop();
        }
      } else {
        final RetainingLogHandler log = SkriptLogger.startRetainingLog();
        try {
          if (type.getC() == String.class) {
            if (def.startsWith("\"") && def.endsWith("\""))
              d = (Expression<? extends T>) VariableString.newInstance("" + def.substring(1, def.length() - 1));
            else
              d = (Expression<? extends T>) new SimpleLiteral<String>(def, false);
          } else {
            d = new SkriptParser(def, SkriptParser.PARSE_LITERALS, ParseContext.DEFAULT).parseExpression(type.getC());
          }
          if (d == null) {
            log.printErrors("Can't understand this expression: '" + def + "'");
            return null;
          }
View Full Code Here

TOP

Related Classes of ch.njol.skript.lang.SkriptParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.