use of net.jangaroo.jooc.JooSymbol in project jangaroo-tools by CoreMedia.
the class SemicolonTerminatedStatement method analyze.
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);
if (getOptStatement() != null) {
getOptStatement().analyze(this);
}
}
use of net.jangaroo.jooc.JooSymbol in project jangaroo-tools by CoreMedia.
the class JsCodeGenerator method writeMemberAccess.
private void writeMemberAccess(IdeDeclaration memberDeclaration, JooSymbol optSymDot, Ide memberIde, boolean writeMemberWhitespace) throws IOException {
if (memberDeclaration != null) {
if (memberIde.usePrivateMemberName(memberDeclaration)) {
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;
out.writeSymbolWhitespace(optSymDot);
out.writeToken("['");
} else {
out.writeSymbol(optSymDot);
}
}
out.writeSymbol(memberIde.getIde(), writeMemberWhitespace);
if (quote) {
out.writeToken("']");
}
}
use of net.jangaroo.jooc.JooSymbol in project jangaroo-tools by CoreMedia.
the class ConfigClassBuilder method parseDescription.
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);
if (commentStart < 0) {
break;
}
if (lineCommentStart >= 0 && lineCommentStart < commentStart) {
pos = findLineCommentEnd(whitespace, lineCommentStart) + 1;
} else {
int endPos = findCommentEndPos(whitespace, commentStart);
if (whitespace.substring(commentStart).startsWith(ASDOC_COMMENT_START)) {
String comment = whitespace.substring(commentStart + ASDOC_COMMENT_START.length(), endPos);
lastAsDocComment = parseAsDocComment(comment);
}
pos = endPos + COMMENT_END.length();
}
}
return lastAsDocComment;
}
use of net.jangaroo.jooc.JooSymbol in project jangaroo-tools by CoreMedia.
the class JsCodeGenerator method getFunctionNameAsIde.
public String getFunctionNameAsIde(FunctionExpr functionExpr) {
IdeDeclaration classDeclaration = functionExpr.getClassDeclaration();
String classNameAsIde = "";
if (classDeclaration != null) {
classNameAsIde = out.getQualifiedNameAsIde(classDeclaration);
}
JooSymbol sym = functionExpr.getSymbol();
return classNameAsIde + "$" + sym.getLine() + "_" + sym.getColumn();
}
use of net.jangaroo.jooc.JooSymbol in project jangaroo-tools by CoreMedia.
the class JsCodeGenerator method visitApplyExpr.
@Override
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);
}
}
}
Aggregations