Examples of JooSymbol


Examples of net.jangaroo.jooc.JooSymbol

      return type;
    }
  }

  public static String parseDescription(JooSymbol symbol, JooSymbol[] symModifiers) {
    JooSymbol firstSymbol = symbol;
    if (symModifiers.length > 0) {
      firstSymbol = symModifiers[0];
    }
    String whitespace = firstSymbol.getWhitespace();
    int pos = 0;
    String lastAsDocComment = null;
    while (true) {
      int commentStart = whitespace.indexOf(COMMENT_START, pos);
      int lineCommentStart = whitespace.indexOf(LINE_COMMENT_START, pos);
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

          if (optNameIde != null) {
            String parameterName = optNameIde.getName();
            LiteralExpr annotationParameterValue = annotationParameter.getValue();
            String parameterValue = null;
            if (annotationParameterValue != null) {
              JooSymbol symbol = annotationParameterValue.getSymbol();
              if (symbol.sym != sym.STRING_LITERAL) {
                throw new CompilerError(symbol, "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must be a string literal.");
              }
              parameterValue = (String) symbol.getJooValue();
            }
            if (TARGET_ANNOTATION_PARAMETER_NAME.equals(parameterName)) {
              if (parameterValue == null) {
                throw new CompilerError(optNameIde.getSymbol(), "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must have a value.");
              }
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

        writePrivateMemberAccess(optSymDot, memberIde, writeMemberWhitespace, memberDeclaration.isStatic());
        return;
      }
    }
    if (optSymDot == null && memberDeclaration != null && !memberDeclaration.isConstructor()) {
      optSymDot = new JooSymbol(".");
    }
    boolean quote = false;
    if (optSymDot != null) {
      if (memberIde.getIde().getText().startsWith("@")) {
        quote = true;
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

    IdeDeclaration classDeclaration = functionExpr.getClassDeclaration();
    String classNameAsIde = "";
    if (classDeclaration != null) {
      classNameAsIde = out.getQualifiedNameAsIde(classDeclaration);
    }
    JooSymbol sym = functionExpr.getSymbol();
    return classNameAsIde + "$" + sym.getLine() + "_" + sym.getColumn();
  }
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

  public void visitApplyExpr(ApplyExpr applyExpr) throws IOException {
    generateFunJsCode(applyExpr);
    if (applyExpr.getArgs() != null) {
      boolean isAssert = applyExpr.getFun() instanceof IdeExpr && SyntacticKeywords.ASSERT.equals(applyExpr.getFun().getSymbol().getText());
      if (isAssert) {
        JooSymbol symKeyword = applyExpr.getFun().getSymbol();
        out.writeSymbol(applyExpr.getArgs().getLParen());
        applyExpr.getArgs().getExpr().visit(this);
        out.writeToken(", ");
        out.writeString(new File(symKeyword.getFileName()).getName());
        out.writeToken(", ");
        out.writeInt(symKeyword.getLine());
        out.write(", ");
        out.writeInt(symKeyword.getColumn());
        out.writeSymbol(applyExpr.getArgs().getRParen());
      } else {
        applyExpr.getArgs().visit(this);
      }
    }
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

    TypeRelation typeRelation = aCatch.getParam().getOptTypeRelation();
    boolean hasCondition = aCatch.hasCondition();
    if (!hasCondition && !isLast) {
      throw Jooc.error(aCatch.getRParen(), "Only last catch clause may be untyped.");
    }
    final JooSymbol errorVar = firstCatch.getParam().getIde().getIde();
    final JooSymbol localErrorVar = aCatch.getParam().getIde().getIde();
    // in the following, always take care to write whitespace only once!
    out.writeSymbolWhitespace(aCatch.getSymKeyword());
    if (isFirst) {
      out.writeSymbolToken(aCatch.getSymKeyword()); // "catch"
      // "(localErrorVar)":
      out.writeSymbol(aCatch.getLParen(), !hasCondition);
      out.writeSymbol(errorVar, !hasCondition);
      if (!hasCondition && typeRelation != null) {
        // can only be ": *", add as comment:
        typeRelation.visit(this);
      }
      out.writeSymbol(aCatch.getRParen(), !hasCondition);
      if (hasCondition || !isLast) {
        // a catch block always needs a brace, so generate one for conditions:
        out.writeToken("{");
      }
    } else {
      // transform catch(ide:Type){...} into else if is(e,Type)){var ide=e;...}
      out.writeToken("else");
    }
    if (hasCondition) {
      out.writeToken("if(is");
      out.writeSymbol(aCatch.getLParen());
      out.writeSymbolWhitespace(localErrorVar);
      out.writeSymbolToken(errorVar);
      out.writeSymbolWhitespace(typeRelation.getSymRelation());
      out.writeToken(",");
      Ide typeIde = typeRelation.getType().getIde();
      out.writeSymbolWhitespace(typeIde.getIde());
      out.writeToken(typeIde.getDeclaration().getQualifiedNameStr());
      out.writeSymbol(aCatch.getRParen());
      out.writeToken(")");
    }
    if (!localErrorVar.getText().equals(errorVar.getText())) {
      aCatch.getBlock().addBlockStartCodeGenerator(new VarCodeGenerator(localErrorVar, errorVar));
    }
    aCatch.getBlock().visit(this);
    if (isLast) {
      if (hasCondition) {
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

    super.analyze(parentNode);
    if (getValue() != null) {
      getValue().analyze(this);
      String metaName = parentAnnotation.getMetaName();
      if ("Embed".equals(metaName) && getOptName() != null && "source".equals(getOptName().getName())) {
        JooSymbol valueSymbol = getValue().getSymbol();
        if (valueSymbol.sym != sym.STRING_LITERAL) {
          throw new CompilerError(valueSymbol, "The source parameter of an [Embed] annotation must be a string literal");
        }
        String text = valueSymbol.getText();
        String quote = text.substring(0, 1);
        String source = (String) valueSymbol.getJooValue();
        String absoluteSource = compilationUnit.addResourceDependency(source);
        getValue().setValue(new JooSymbol(valueSymbol.sym, valueSymbol.getFileName(),
                valueSymbol.getLine(), valueSymbol.getColumn(), valueSymbol.getWhitespace(),
                quote + absoluteSource + quote,
                absoluteSource));
      }
    }
  }
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

public class PredefinedTypeDeclaration extends IdeDeclaration {

  //todo define well-known types as final consts here

  public PredefinedTypeDeclaration(final String name) {
    super(new Ide(new JooSymbol(name)));
  }
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

  public void analyze(AstNode parentNode) {
    // check for special case "assert statement":
    if (getOptStatement() instanceof ApplyExpr && getOptSymSemicolon() != null) {
      ApplyExpr applyExpr = (ApplyExpr) getOptStatement();
      JooSymbol funSymbol = applyExpr.getFun().getSymbol();
      String functionName = funSymbol.getText();
      if ("trace".equals(functionName) || SyntacticKeywords.ASSERT.equals(functionName)) {
        compilationUnit.addBuiltInUsage(functionName);
      }
    }
    super.analyze(parentNode);
View Full Code Here

Examples of net.jangaroo.jooc.JooSymbol

  private JooSymbol symSemicolon;

  private final boolean explicit;

  public ImportDirective(Ide packageIde, String typeName) {
    this(IMPORT_SYMBOL, createIde(packageIde, new JooSymbol(typeName)), false);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.