Tabnine Logo
com.ochafik.lang.jnaerator.parser
Code IndexAdd Tabnine to your IDE (free)

How to use com.ochafik.lang.jnaerator.parser

Best Java code snippets using com.ochafik.lang.jnaerator.parser (Showing top 20 results out of 315)

origin: stackoverflow.com

 function Printer(word) {
  this._word = word;
}

Printer.prototype.print = function () {
  console.log(this._word);
}

var a = new Printer("Alex");
var b = new Printer("Bob");

a.print(); //Prints Alex
b.print(); //Prints Bob
origin: stackoverflow.com

 var YesNo = new Enum(['NO', 'YES']);
var Color = new Enum(['RED', 'GREEN', 'BLUE']);
origin: nativelibs4java/JNAerator

public MutableByDeclarator mutateType(MutableByDeclarator type) {
  if (type == null)
    return null;
  type = type.clone();
  if (type instanceof Function) {
    ((Function)type).setName(new Identifier.SimpleIdentifier(getName()));
  }
  ((Element)type).importDetails(this, false);
  return type;
}
@Override
origin: nativelibs4java/JNAerator

Statement throwIfArraySizeDifferent(String varAndFieldName) {
  return new Statement.If(
      expr(
      memberRef(varRef(varAndFieldName), MemberRefStyle.Dot, "length"),
      BinaryOperator.IsDifferent,
      memberRef(memberRef(thisRef(), MemberRefStyle.Dot, varAndFieldName), MemberRefStyle.Dot, "length")),
      new Statement.Throw(new Expression.New(typeRef(IllegalArgumentException.class), expr("Wrong array size !"))),
      null);
}
origin: nativelibs4java/JNAerator

public static Statement tryRethrow(Statement st) {
  String exName = "$ex$";
  return new Try(st, null, new Catch(new VariablesDeclaration(typeRef(Throwable.class), new Declarator.DirectDeclarator(exName)), new Throw(new New(typeRef(RuntimeException.class), varRef(exName)))));
}
origin: com.nativelibs4java/jnaerator

  private void addParentNamespaceAnnotation(ModifiableElement dest, Identifier parentNamespace) {
    if (parentNamespace != null) {
      dest.addAnnotation(new Annotation(typeRef(org.bridj.ann.Namespace.class), expr(parentNamespace.toString())));
    }
  }
}
origin: com.nativelibs4java/jnaerator

@Override
public void visitArrayAccess(ArrayAccess arrayAccess) {
  super.visitArrayAccess(arrayAccess);
  arrayAccess.replaceBy(methodCall(arrayAccess.getTarget(), "get", arrayAccess.getIndex()));
}
origin: nativelibs4java/JNAerator

@Override
public void visitTaggedTypeRefDeclaration(TaggedTypeRefDeclaration taggedTypeRefDeclaration) {
  TaggedTypeRef tr = taggedTypeRefDeclaration.getTaggedTypeRef();
  if (tr != null) {
    String before = tr.getCommentBefore();
    tr.setCommentBefore(taggedTypeRefDeclaration.getCommentBefore());
    tr.addToCommentBefore(before);
    taggedTypeRefDeclaration.setCommentBefore(null);
  }
  super.visitTaggedTypeRefDeclaration(taggedTypeRefDeclaration);
}
origin: nativelibs4java/JNAerator

@Override
public void visitIf(If ifStat) {
  super.visitIf(ifStat);
  Expression cond = ifStat.getCondition();
  if (!(cond instanceof BinaryOp)) // TODO use typing rather than this hack to detect implicit boolean conversion in if statements (and not only there)
  {
    cond.replaceBy(expr(cond, BinaryOperator.IsDifferent, expr(0)));
  }
}
origin: nativelibs4java/JNAerator

public static Identifier getName(Element element) {
  if (element instanceof Function)
    return ((Function) element).getName();
  if (element instanceof TaggedTypeRefDeclaration)
    return getName(((TaggedTypeRefDeclaration) element).getTaggedTypeRef());
  if (element instanceof TypeRef.TaggedTypeRef)
    return ((TypeRef.TaggedTypeRef) element).getTag();
  return null;
}

origin: nativelibs4java/JNAerator

@Override
public QualifiedIdentifier eraseTemplateArguments() {
  return resolveAllButLastIdentifier().derive(getSeparator(), resolveLastSimpleIdentifier().eraseTemplateArguments());
}
@Override
origin: nativelibs4java/JNAerator

public void setName(String name) {
  if (declarator == null)
    setDeclarator(new Declarator.DirectDeclarator(name));
  else
    declarator.propagateName(name);
}
@Override
origin: nativelibs4java/JNAerator

  @Override
  public void propagateName(String name) {
    if (getTarget() != null)
      getTarget().propagateName(name);
    else
      setTarget(new DirectDeclarator(name));
  }
}
origin: nativelibs4java/JNAerator

boolean isResolved(Identifier i) {
  if (i == null || i.isPlain()) {
    return false;
  }
  return (i instanceof Identifier.QualifiedIdentifier)
      && Identifier.QualificationSeparator.Dot.equals(((Identifier.QualifiedIdentifier) i).getSeparator());
}
origin: com.nativelibs4java/jnaerator

Statement throwIfArraySizeDifferent(String varAndFieldName) {
  return new Statement.If(
      expr(
      memberRef(varRef(varAndFieldName), MemberRefStyle.Dot, "length"),
      BinaryOperator.IsDifferent,
      memberRef(memberRef(thisRef(), MemberRefStyle.Dot, varAndFieldName), MemberRefStyle.Dot, "length")),
      new Statement.Throw(new Expression.New(typeRef(IllegalArgumentException.class), expr("Wrong array size !"))),
      null);
}
origin: nativelibs4java/JNAerator

  private void addParentNamespaceAnnotation(ModifiableElement dest, Identifier parentNamespace) {
    if (parentNamespace != null) {
      dest.addAnnotation(new Annotation(typeRef(org.bridj.ann.Namespace.class), expr(parentNamespace.toString())));
    }
  }
}
origin: nativelibs4java/JNAerator

@Override
public void visitArrayAccess(ArrayAccess arrayAccess) {
  super.visitArrayAccess(arrayAccess);
  arrayAccess.replaceBy(methodCall(arrayAccess.getTarget(), "get", arrayAccess.getIndex()));
}
origin: com.nativelibs4java/jnaerator

@Override
public void visitTaggedTypeRefDeclaration(TaggedTypeRefDeclaration taggedTypeRefDeclaration) {
  TaggedTypeRef tr = taggedTypeRefDeclaration.getTaggedTypeRef();
  if (tr != null) {
    String before = tr.getCommentBefore();
    tr.setCommentBefore(taggedTypeRefDeclaration.getCommentBefore());
    tr.addToCommentBefore(before);
    taggedTypeRefDeclaration.setCommentBefore(null);
  }
  super.visitTaggedTypeRefDeclaration(taggedTypeRefDeclaration);
}
origin: com.nativelibs4java/jnaerator

@Override
public void visitIf(If ifStat) {
  super.visitIf(ifStat);
  Expression cond = ifStat.getCondition();
  if (!(cond instanceof BinaryOp)) // TODO use typing rather than this hack to detect implicit boolean conversion in if statements (and not only there)
  {
    cond.replaceBy(expr(cond, BinaryOperator.IsDifferent, expr(0)));
  }
}
origin: stackoverflow.com

 function Printer(word) {
  var _word = word;

  this.print = function () {
    console.log(_word);
  }
}

var a = new Printer("Alex");
var b = new Printer("Bob");

a.print(); //Prints Alex
b.print(); //Prints Bob
com.ochafik.lang.jnaerator.parser

Most used classes

  • Function
  • Identifier
  • ModifierType
  • ObjCppParser
  • SourceFile
  • Declaration,
  • Declarator$DirectDeclarator,
  • Declarator,
  • Element,
  • ElementsHelper,
  • Enum,
  • Expression$Constant,
  • Expression$New,
  • ObjCppLexer,
  • Printer,
  • Scanner,
  • Struct,
  • TypeRef$Pointer,
  • TypeRef$SimpleTypeRef
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now