Package com.orange.wink.exception

Examples of com.orange.wink.exception.WinkParseException


    try {
      tree = getParsedAst(fileName);
      ast = astBuilder.build(tree);
      // System.out.println(ast);
    } catch (final IOException e) {
      throw new WinkParseException(e);
    }
    addJsFile(fileName, new GlobalObject(ast));
  }
View Full Code Here


        } else {
          fsource = getJsFile(sourceName).getLinesAsString(f.getLineStart(), f.getLineEnd());
        }
        ParserUtils.updateFunctionInfo(f, fsource);
      } catch (final IOException e) {
        throw new WinkParseException(e);
      }

      populateFunctionR(f);
    }
    final Collection<LiteralObject> lts = scope.getLiterals().values();
View Full Code Here

            ltSource = jf.getLinesAsString(lns, lne);
          }

          ParserUtils.updateLiteralLines(lt, ltSource, lns);
          if (lt.getLineStart() == -1 || lt.getLineEnd() == -1) {
            throw new WinkParseException("Bad literal lines [" + lt.getNamespace() + "] identified (L:" + lt.getLineStart() + ", " + lt.getLineEnd() + ")");
          }

          String las;
          if (Constants.optimDontKeepJsFile) {
            las = fo.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          } else {
            las = jf.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          }
          ParserUtils.updateLiteralChars(lt, las);
        } catch (final IOException e) {
          throw new WinkParseException(e);
        }
      }

      populateLiteralsR(lt);
    }
View Full Code Here

          source = lines.substring(o.getCharStart(), o.getCharEnd());
          System.out.println(source);
        }
        System.out.println();
      } catch (final IOException e) {
        throw new WinkParseException(e);
      }
    }

    final Collection<FunctionObject> fns = o.getFunctions().values();
    for (final FunctionObject c : fns) {
View Full Code Here

    if (po instanceof SetName) {
      interpretSetName((SetName) po);
    } else if (po instanceof SetProp) {
      interpretSetProp((SetProp) po);
    } else {
      throw new WinkParseException("ERROR - cannot interpret ParseObject : type not managed : " + po.getClass().getName());
    }
  }
View Full Code Here

      so.addComponent(name, soChild, this, ns);

      soChild.interpret();
    } catch (final WinkParseException e) {
      if (Constants.failOnUnresolvedNamespace) {
        throw new WinkParseException(spns + " not accessible in " + namespace + " - " + Ast.getPositionInfo(sp.getNode()), e);
      } else {
        System.err.println("WARN - " + spns + " not accessible in " + namespace + " - " + Ast.getPositionInfo(sp.getNode()) + " - " + e.getMessage());
      }
    }
  }
View Full Code Here

        idx = i;
        break;
      }
    }
    if (idx == -1) {
      throw new WinkParseException("extended function not found in extensions");
    }
    return ".extend." + (idx + 1);
  }
View Full Code Here

        if (!sos.containsKey(name)) {
          final GlobalObject go = getGlobalScope();
          if (go.resolveGlobalNamespace(ns.toString())) {
            return resolveByNamespace(ns); // retry
          } else {
            throw new WinkParseException("resolveByNamespace failed: " + ns.toString() + " is not accessible");
          }
        }
        cursor = sos.get(name);
        final List<ScriptObject> exts = cursor.getExtensions();
        if (exts.size() > 0) {
View Full Code Here

    while (!end) {
      int ttype;
      try {
        ttype = st.nextToken();
      } catch (final IOException e) {
        throw new WinkParseException(e);
      }

      switch (ttype) {
      case StreamTokenizer.TT_EOF:
        end = true;
View Full Code Here

    while (!end) {
      int ttype;
      try {
        ttype = st.nextToken();
      } catch (final IOException e) {
        throw new WinkParseException(e);
      }

      switch (ttype) {
      case StreamTokenizer.TT_EOF:
        end = true;
        break;
      case StreamTokenizer.TT_WORD:
        if (!identifyBegin) {
          final String identifier = st.sval;
          final String ltName = lt.getNamespace().getLastName();
          if (identifier.indexOf(ltName) != -1) {
            final int ln = relativeShiftLine + (st.lineno() - 1);
            lt.setLineStart(ln);
            identifyBegin = true;
          }
        }
        if (afterBlock) {
          end = true;
        }
        break;
      case StreamTokenizer.TT_NUMBER:
        if (afterBlock) {
          end = true;
        }
        break;
      default:
        if (afterBlock) {
          afterBlockBuffer.append((char) ttype);
          final String c = new String(new StringBuffer().append((char) ttype));

          if (c.equals(",") || c.equals(";")) {
            if (afterBlockBuffer.toString().trim().length() == 1) {
              final int ln = relativeShiftLine + (st.lineno() - 1);
              lt.setLineEnd(ln);
              end = true;
            }
          }
        } else if (identifyBegin) {
          final String c = new String(new StringBuffer().append((char) ttype));
          if (c.equals("{")) {
            if (lpCount == 0) {
              inBlock = true;
            }
            lpCount++;
          } else if (c.equals("}")) {
            if (inBlock) {
              rpCount++;
            }
          }
          if (inBlock) {
            if (lpCount == rpCount) {
              final int ln = relativeShiftLine + (st.lineno() - 1);
              lt.setLineEnd(ln);
              inBlock = false;
              afterBlock = true;
              // end = true;
            }
          }
        }
        break;
      }
    }

    if (lpCount != rpCount) {
      throw new WinkParseException("bad syntax : left braces count differ from right braces count in " + lt.getNamespace());
    }
  }
View Full Code Here

TOP

Related Classes of com.orange.wink.exception.WinkParseException

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.