Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–192 unchanged (192 lines)
193 append(" ");
194 // Do not allow a forward slash to appear after a DIV.
195 // For example,
196 // REGEXP DIV REGEXP
197 // is valid and should print like
198 // / // / /
199 }
200
201 append(newcode);
202 }
203
204 void appendOp(String op, boolean binOp) {
205 append(op);
206 }
…lines 207–298 unchanged (92 lines)

After

…lines 1–187 unchanged (187 lines)
188 char c = newcode.charAt(0);
189 if ((isWordChar(c) || c == '\\') &&
190 isWordChar(getLastChar())) {
191 // need space to separate. This is not pretty printing.
192 // For example: "return foo;"
193 append(" ");
194 } else if (c == '/' && getLastChar() == '/') {
195 // Do not allow a forward slash to appear after a DIV.
196 // For example,
197 // REGEXP DIV REGEXP
198 // is valid and should print like
199 // / // / /
200 append(" ");
201 }
202
203 append(newcode);
204 }
205
206 void appendOp(String op, boolean binOp) {
207 append(op);
…lines 208–300 unchanged (93 lines)

Before

program
block_comment "/*\n * Copyright 2004 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
block_comment "/**\n * Abstracted consumer of the CodeGenerator output.\n *\n "...
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "CodeConsumer"
class_body
{ "{"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "statementNeedsEnded"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "statementStarted"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "sawFunction"
= "="
false "false"
; ";"
block_comment "/**\n * Starts the source mapping for the given\n * node a"...
method_declaration
void_type "void"
identifier "startSourceMapping"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
} "}"
block_comment "/**\n * Finishes the source mapping for the given\n * node"...
method_declaration
void_type "void"
identifier "endSourceMapping"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
} "}"
block_comment "/**\n * Provides a means of interrupting the CodeGenerator."...
method_declaration
boolean_type "boolean"
identifier "continueProcessing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
true "true"
; ";"
} "}"
block_comment "/**\n * Retrieve the last character of the last string sent"...
method_declaration
modifiers
abstract "abstract"
integral_type
char "char"
identifier "getLastChar"
formal_parameters
( "("
) ")"
; ";"
method_declaration
void_type "void"
identifier "addIdentifier"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "identifier"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "add"
argument_list
( "("
identifier "identifier"
) ")"
; ";"
} "}"
block_comment "/**\n * Appends a string to the code, keeping track of the "...
method_declaration
modifiers
abstract "abstract"
void_type "void"
identifier "append"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "str"
) ")"
; ";"
method_declaration
void_type "void"
identifier "appendBlockStart"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment "{"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "appendBlockEnd"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment "}"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "startNewLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "maybeLineBreak"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "maybeCutLine"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "maybeCutLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "endLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "notePreferredLineBreak"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration (+56 nodes collapsed)
method_declaration
void_type "void"
identifier "endBlock"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endBlock"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+41 nodes collapsed)
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Indicates the end of a statement and a ';' may need"...
method_declaration
void_type "void"
identifier "endStatement"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endStatement"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
block_comment "/**\n * This is to be called when we're in a statement. If "...
method_declaration (+56 nodes collapsed)
method_declaration
void_type "void"
identifier "endFunction"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endFunction"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+34 nodes collapsed)
method_declaration
void_type "void"
identifier "beginCaseBody"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment ":"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "endCaseBody"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "add"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "newcode"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "maybeEndStatement"
argument_list
( "("
) ")"
; ";"
if_statement (+21 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "newcode"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+30 nodes collapsed)
block
{ "{"
line_comment "// need space to separate. This is not pretty printing."
line_comment "// For example: \"return foo;\""
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " "
" "\""
) ")"
; ";"
line_comment "// Do not allow a forward slash to appear after a DIV."
line_comment "// For example,"
line_comment "// REGEXP DIV REGEXP"
line_comment "// is valid and should print like"
line_comment "// / // / /"
} "}"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
identifier "newcode"
) ")"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
method_declaration (+188 nodes collapsed)
method_declaration (+253 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration (+41 nodes collapsed)
block_comment "/**\n * If the body of a for loop or the then clause of an "...
method_declaration
boolean_type "boolean"
identifier "shouldPreserveExtraBlocks"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
false "false"
; ";"
} "}"
block_comment "/**\n * @return Whether the a line break can be added after"...
method_declaration
boolean_type "boolean"
identifier "breakAfterBlockFor"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
boolean_type "boolean"
identifier "statementContext"
) ")"
block
{ "{"
return_statement
return "return"
identifier "statementContext"
; ";"
} "}"
block_comment "/** Called when we're at the end of a file. */"
method_declaration
void_type "void"
identifier "endFile"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
} "}"

After

program
block_comment "/*\n * Copyright 2004 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
block_comment "/**\n * Abstracted consumer of the CodeGenerator output.\n *\n "...
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "CodeConsumer"
class_body
{ "{"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "statementNeedsEnded"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "statementStarted"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "sawFunction"
= "="
false "false"
; ";"
block_comment "/**\n * Starts the source mapping for the given\n * node a"...
method_declaration
void_type "void"
identifier "startSourceMapping"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
} "}"
block_comment "/**\n * Finishes the source mapping for the given\n * node"...
method_declaration
void_type "void"
identifier "endSourceMapping"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
} "}"
block_comment "/**\n * Provides a means of interrupting the CodeGenerator."...
method_declaration
boolean_type "boolean"
identifier "continueProcessing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
true "true"
; ";"
} "}"
block_comment "/**\n * Retrieve the last character of the last string sent"...
method_declaration
modifiers
abstract "abstract"
integral_type
char "char"
identifier "getLastChar"
formal_parameters
( "("
) ")"
; ";"
method_declaration
void_type "void"
identifier "addIdentifier"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "identifier"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "add"
argument_list
( "("
identifier "identifier"
) ")"
; ";"
} "}"
block_comment "/**\n * Appends a string to the code, keeping track of the "...
method_declaration
modifiers
abstract "abstract"
void_type "void"
identifier "append"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "str"
) ")"
; ";"
method_declaration
void_type "void"
identifier "appendBlockStart"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment "{"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "appendBlockEnd"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment "}"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "startNewLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "maybeLineBreak"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "maybeCutLine"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "maybeCutLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "endLine"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "notePreferredLineBreak"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration (+56 nodes collapsed)
method_declaration
void_type "void"
identifier "endBlock"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endBlock"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+41 nodes collapsed)
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Indicates the end of a statement and a ';' may need"...
method_declaration
void_type "void"
identifier "endStatement"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endStatement"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
block_comment "/**\n * This is to be called when we're in a statement. If "...
method_declaration (+56 nodes collapsed)
method_declaration
void_type "void"
identifier "endFunction"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "endFunction"
argument_list
( "("
false "false"
) ")"
; ";"
} "}"
method_declaration (+34 nodes collapsed)
method_declaration
void_type "void"
identifier "beginCaseBody"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment ":"
" "\""
) ")"
; ";"
} "}"
method_declaration
void_type "void"
identifier "endCaseBody"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
method_declaration
void_type "void"
identifier "add"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "newcode"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "maybeEndStatement"
argument_list
( "("
) ")"
; ";"
if_statement (+21 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "newcode"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+30 nodes collapsed)
block
{ "{"
line_comment "// need space to separate. This is not pretty printing."
line_comment "// For example: \"return foo;\""
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " "
" "\""
) ")"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "c"
== "=="
character_literal "'/'"
&& "&&"
binary_expression
method_invocation
identifier "getLastChar"
argument_list
( "("
) ")"
== "=="
character_literal "'/'"
) ")"
block
{ "{"
line_comment "// Do not allow a forward slash to appear after a DIV."
line_comment "// For example,"
line_comment "// REGEXP DIV REGEXP"
line_comment "// is valid and should print like"
line_comment "// / // / /"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " "
" "\""
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "append"
argument_list
( "("
identifier "newcode"
) ")"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
method_declaration (+188 nodes collapsed)
method_declaration (+253 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration (+41 nodes collapsed)
block_comment "/**\n * If the body of a for loop or the then clause of an "...
method_declaration
boolean_type "boolean"
identifier "shouldPreserveExtraBlocks"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
false "false"
; ";"
} "}"
block_comment "/**\n * @return Whether the a line break can be added after"...
method_declaration
boolean_type "boolean"
identifier "breakAfterBlockFor"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
boolean_type "boolean"
identifier "statementContext"
) ")"
block
{ "{"
return_statement
return "return"
identifier "statementContext"
; ";"
} "}"
block_comment "/** Called when we're at the end of a file. */"
method_declaration
void_type "void"
identifier "endFile"
formal_parameters
( "("
) ")"
block
{ "{"
} "}"
} "}"