Package org.mozilla.javascript.json

Examples of org.mozilla.javascript.json.JsonParser$ParseException


      if (mode == EvaluationMode.DEMO) {
        this.enableOrDisableButtons(queryOrRif);
      }
      return true;
    } else if (e instanceof ParseException) {
      final ParseException pe = (ParseException) e;
      this.displayErrorMessage(pe.getMessage(), false, queryOrRif);

      int line;
      int column;

      // get precise line and column...
      if (pe.currentToken.next == null) {
        line = pe.currentToken.beginLine;
        column = pe.currentToken.beginColumn;
      } else {
        line = pe.currentToken.next.beginLine;
        column = pe.currentToken.next.beginColumn;
      }

      this.setErrorPosition(line, column, queryOrRif);
      if (mode == EvaluationMode.DEMO) {
        this.enableOrDisableButtons(queryOrRif);
      }
      return true;
    } else if(e instanceof lupos.rif.generated.parser.ParseException){
      final lupos.rif.generated.parser.ParseException pe = (lupos.rif.generated.parser.ParseException) e;
      this.displayErrorMessage(pe.getMessage(), false, queryOrRif);

      int line;
      int column;

      // get precise line and column...
View Full Code Here


  public void handleParseError(Throwable t) throws ModificationException {
    int line = 0;
    int column = 0;

    if(t instanceof ParseException) {
      ParseException pe = (ParseException) t;

      // get precise line and column...
      if(pe.currentToken.next == null) {
        line = pe.currentToken.beginLine;
        column = pe.currentToken.beginColumn;
View Full Code Here

    return (String) NativeJSON.stringify(cx, scope, object, null, null);
  }

  public Object parse(String string) {
    try {
      return new JsonParser(cx, scope).parseValue(string);
    } catch (ParseException e) {
      e.printStackTrace();
    }
    // return (ScriptableObject) NativeJSON.parse(cx, scope, string, null);
    return string;
View Full Code Here

    private Context cx;

    @Before
    public void setUp() {
        cx = Context.enter();
        parser = new JsonParser(cx, cx.initStandardObjects());
    }
View Full Code Here

        }
    }

    private static Object parse(Context cx, Scriptable scope, String jtext) {
      try {
        return new JsonParser(cx, scope).parseValue(jtext);
      } catch (JsonParser.ParseException ex) {
        throw ScriptRuntime.constructError("SyntaxError", ex.getMessage());
      }
    }
View Full Code Here

    @Override
    public Object stringToJson(String json) {
        Context context = Context.getCurrentContext();
        try {
            return new JsonParser(context, ScriptRuntime.getGlobal(context)).parseValue(json);
        } catch (JsonParser.ParseException e) {
            logger.error("Unable to create a json object from string {}", json, e);
            throw new IllegalArgumentException(e.getMessage(), e);
        }
    }
View Full Code Here

    private Context cx;

    @Before
    public void setUp() {
        cx = Context.enter();
        parser = new JsonParser(cx, cx.initStandardObjects());
    }
View Full Code Here

        if (json == null) {
            throw ScriptRuntime.constructError("Error",
                    "The read function expects a single string argument");
        }
        Scriptable scope = funObj.getParentScope();
        JsonParser parser = new JsonParser(cx, scope);
        Object parsed;
        try {
            parsed = parser.parseValue(json);
        } catch (ParseException e) {
            throw ScriptRuntime.constructError("Error", e.getMessage());
        }
        Object result;
        if (parsed instanceof NativeObject) {
View Full Code Here

    Object xmlHttpRequest = new NativeJavaClass(global,
        XMLHttpRequest.class);
    global.put("XMLHttpRequest", global, xmlHttpRequest);
    new Console(global, "console");
    new Navigator(global, "navigator");
    jsonParser = new JsonParser(cx, global);
    String[] names = { "alert", "prompt", "confirm" };
    global.defineFunctionProperties(names, WebWrapper.class,
        ScriptableObject.DONTENUM);
  }
View Full Code Here

    private Context cx;

    @Before
    public void setUp() {
        cx = Context.enter();
        parser = new JsonParser(cx, cx.initStandardObjects());
    }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.json.JsonParser$ParseException

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.