private String getJavaMethod(AstNode node) { if (!(node instanceof StringLiteral)) { return null; } String str = ((StringLiteral) node).getValue(); if (!str.startsWith("$$JSO$$_")) { return null; } return str.substring("$$JSO$$_".length()); }
private void print(StringLiteral node) throws IOException { writer.append(node.getQuoteCharacter()); writer.append(ScriptRuntime.escapeString(node.getValue(), node.getQuoteCharacter())); writer.append(node.getQuoteCharacter()); }
private StringLiteral createStringLiteral() { int pos = ts.tokenBeg, end = ts.tokenEnd; StringLiteral s = new StringLiteral(pos, end - pos); s.setLineno(ts.lineno); s.setValue(ts.getString()); s.setQuoteCharacter(ts.getQuoteChar()); return s; }
validateSignature(method); StringLiteral newTarget = new StringLiteral(); newTarget.setValue("$$JSO$$_" + caller); propertyGet.setTarget(newTarget);
@Override public String toSource(int depth) { return new StringBuilder(makeIndent(depth)) .append(quoteChar) .append(ScriptRuntime.escapeString(value, quoteChar)) .append(quoteChar) .toString(); }
/** * Sets the node's value. Do not include the enclosing quotes. * @param value the node's value * @throws IllegalArgumentException} if value is {@code null} */ public void setValue(String value) { assertNotNull(value); this.value = value; }
private StringLiteral createStringLiteral() { int pos = ts.tokenBeg, end = ts.tokenEnd; StringLiteral s = new StringLiteral(pos, end - pos); s.setLineno(ts.lineno); s.setValue(ts.getString()); s.setQuoteCharacter(ts.getQuoteChar()); return s; }
private void print(StringLiteral node) throws IOException { writer.append(node.getQuoteCharacter()); writer.append(ScriptRuntime.escapeString(node.getValue(), node.getQuoteCharacter())); writer.append(node.getQuoteCharacter()); }
@Override public String toSource(int depth) { return new StringBuilder(makeIndent(depth)) .append(quoteChar) .append(ScriptRuntime.escapeString(value, quoteChar)) .append(quoteChar) .toString(); }
/** * Sets the node's value. Do not include the enclosing quotes. * @param value the node's value * @throws IllegalArgumentException} if value is {@code null} */ public void setValue(String value) { assertNotNull(value); this.value = value; }
public ASTStringLiteral(StringLiteral stringLiteral) { super(stringLiteral); super.setImage(stringLiteral.getValue()); }
private StringLiteral createStringLiteral() { int pos = ts.tokenBeg, end = ts.tokenEnd; StringLiteral s = new StringLiteral(pos, end - pos); s.setLineno(ts.lineno); s.setValue(ts.getString()); s.setQuoteCharacter(ts.getQuoteChar()); return s; }
@Override public String toSource(int depth) { return new StringBuilder(makeIndent(depth)) .append(quoteChar) .append(ScriptRuntime.escapeString(value, quoteChar)) .append(quoteChar) .toString(); }
/** * Sets the node's value. Do not include the enclosing quotes. * @param value the node's value * @throws IllegalArgumentException} if value is {@code null} */ public void setValue(String value) { assertNotNull(value); this.value = value; }
private String getJavaMethod(AstNode node) { if (!(node instanceof StringLiteral)) { return null; } String str = ((StringLiteral) node).getValue(); if (!str.startsWith("$$JSO$$_")) { return null; } return str.substring("$$JSO$$_".length()); }
private StringLiteral createStringLiteral() { int pos = ts.tokenBeg, end = ts.tokenEnd; StringLiteral s = new StringLiteral(pos, end - pos); s.setLineno(ts.lineno); s.setValue(ts.getString()); s.setQuoteCharacter(ts.getQuoteChar()); return s; }
@Override public String toSource(int depth) { return new StringBuilder(makeIndent(depth)) .append(quoteChar) .append(ScriptRuntime.escapeString(value, quoteChar)) .append(quoteChar) .toString(); }
/** * Sets the node's value. Do not include the enclosing quotes. * @param value the node's value * @throws IllegalArgumentException} if value is {@code null} */ public void setValue(String value) { assertNotNull(value); this.value = value; }
/** * Return string literal value. */ private String stringLiteral(final AstNode node) { checkState(node instanceof StringLiteral, node, "Expected string literal only"); //noinspection ConstantConditions StringLiteral string = (StringLiteral) node; return string.getValue(); }
private String getDirective(AstNode n) { if (n instanceof ExpressionStatement) { AstNode e = ((ExpressionStatement) n).getExpression(); if (e instanceof StringLiteral) { return ((StringLiteral) e).getValue(); } } return null; }