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–1161 unchanged (1161 lines)
1162
1163 case ANNOTATION:
1164 case EOC:
1165 case EOF:
1166 // When we're capturing a license block, annotations
1167 // in the block are ok.
1168 String multilineText = builder.toString();
1169
1170 if (option != WhitespaceOption.PRESERVE) {
1171 multilineText = multilineText.trim();
1172 }
1173
1174 int endLineno = stream.getLineno();
1175 int endCharno = stream.getCharno();
1176
1177 if (multilineText.length() > 0) {
1178 jsdocBuilder.markText(multilineText, startLineno, startCharno,
1179 endLineno, endCharno);
1180 }
1181
1182 return new ExtractionInfo(multilineText, token);
1183
1184 // FALL THROUGH
1185
1186 default:
1187 ignoreStar = false;
1188 state = State.SEARCHING_ANNOTATION;
1189
…lines 1190–2032 unchanged (843 lines)

After

…lines 1–1161 unchanged (1161 lines)
1162
1163 case ANNOTATION:
1164 case EOC:
1165 case EOF:
1166 // When we're capturing a license block, annotations
1167 // in the block are ok.
1168 if (!(option == WhitespaceOption.PRESERVE &&
1169 token == JsDocToken.ANNOTATION)) {
1170 String multilineText = builder.toString();
1171
1172 if (option != WhitespaceOption.PRESERVE) {
1173 multilineText = multilineText.trim();
1174 }
1175
1176 int endLineno = stream.getLineno();
1177 int endCharno = stream.getCharno();
1178
1179 if (multilineText.length() > 0) {
1180 jsdocBuilder.markText(multilineText, startLineno, startCharno,
1181 endLineno, endCharno);
1182 }
1183
1184 return new ExtractionInfo(multilineText, token);
1185 }
1186
1187 // FALL THROUGH
1188
1189 default:
1190 ignoreStar = false;
1191 state = State.SEARCHING_ANNOTATION;
…lines 1192–2035 unchanged (844 lines)

Before

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "parsing"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfoBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSTypeExpression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "ScriptRuntime"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
. "."
identifier "Visibility"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeNative"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * A parser for JSDoc comments.\n *\n*\n */"
line_comment "// TODO(nicksantos): Unify all the JSDocInfo stuff into one "...
line_comment "// spreading it across mutliple packages."
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "JsDocInfoParser"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JsDocTokenStream"
variable_declarator
identifier "stream"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSDocInfoBuilder"
variable_declarator
identifier "jsdocBuilder"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "sourceName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ErrorReporter"
variable_declarator
identifier "errorReporter"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ErrorReporterParser"
variable_declarator
identifier "parser"
= "="
object_creation_expression
new "new"
type_identifier "ErrorReporterParser"
argument_list
( "("
) ")"
; ";"
class_declaration (+108 nodes collapsed)
line_comment "// The DocInfo with the fileoverview tag for the whole file."
field_declaration
modifiers
private "private"
type_identifier "JSDocInfo"
variable_declarator
identifier "fileOverviewJSDocInfo"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "State"
variable_declarator
identifier "state"
; ";"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Annotation"
> ">"
variable_declarator
identifier "annotationNames"
; ";"
field_declaration
modifiers
private "private"
scoped_type_identifier
type_identifier "Node"
. "."
type_identifier "FileLevelJsDocBuilder"
variable_declarator
identifier "fileLevelJsDocBuilder"
; ";"
block_comment "/**\n * Sets the JsDocBuilder for the file-level (root) nod"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Sets the file overview JSDocInfo, in order to warn "...
method_declaration (+21 nodes collapsed)
enum_declaration
modifiers
private "private"
enum "enum"
identifier "State"
enum_body
{ "{"
enum_constant
identifier "SEARCHING_ANNOTATION"
, ","
enum_constant
identifier "SEARCHING_NEWLINE"
, ","
enum_constant
identifier "NEXT_IS_ANNOTATION"
} "}"
constructor_declaration (+92 nodes collapsed)
block_comment "/**\n * Parses a string containing a JsDoc type declaration"...
method_declaration (+105 nodes collapsed)
block_comment "/**\n * Parses a {@link JSDocInfo} object. This parsing met"...
method_declaration (+4572 nodes collapsed)
block_comment "/**\n * Parse a {@code @suppress} tag of the form\n * {@co"...
method_declaration (+287 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Looks for a parameter type expression at the curren"...
method_declaration (+142 nodes collapsed)
block_comment "/**\n * Determines whether the given type is a valid {@code"...
line_comment "// TODO(nicksantos): Move this into a check pass."
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Converts a JSDoc token to its string representation"...
method_declaration (+271 nodes collapsed)
block_comment "/**\n * Constructs a new {@code JSTypeExpression}.\n * @pa"...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Tuple for returning both the string extracted and t"...
class_declaration (+90 nodes collapsed)
block_comment "/**\n * Extracts the text found on the current line startin"...
method_declaration (+133 nodes collapsed)
method_declaration (+28 nodes collapsed)
enum_declaration
modifiers
private "private"
enum "enum"
identifier "WhitespaceOption"
enum_body
{ "{"
block_comment "/**\n * Preserves all whitespace and formatting. Needed f"...
enum_constant
identifier "PRESERVE"
, ","
block_comment "/** Preserves newlines but trims the output. */"
enum_constant
identifier "TRIM"
, ","
block_comment "/** Removes newlines and turns the output into a single line"...
enum_constant
identifier "SINGLE_LINE"
} "}"
block_comment "/**\n * Extracts the text found on the current line and all"...
method_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "fallthrough"
" "\""
) ")"
private "private"
type_identifier "ExtractionInfo"
identifier "extractMultilineTextualBlock"
formal_parameters
( "("
formal_parameter
type_identifier "JsDocToken"
identifier "token"
, ","
formal_parameter
type_identifier "WhitespaceOption"
identifier "option"
) ")"
block
{ "{"
if_statement (+47 nodes collapsed)
expression_statement
method_invocation
identifier "stream"
. "."
identifier "update"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "startLineno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getLineno"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "startCharno"
= "="
binary_expression
method_invocation
identifier "stream"
. "."
identifier "getCharno"
argument_list
( "("
) ")"
+ "+"
decimal_integer_literal "1"
; ";"
line_comment "// Read the content from the first line."
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "line"
= "="
method_invocation
identifier "stream"
. "."
identifier "getRemainingJSDocLine"
argument_list
( "("
) ")"
; ";"
if_statement (+27 nodes collapsed)
local_variable_declaration
type_identifier "StringBuilder"
variable_declarator
identifier "builder"
= "="
object_creation_expression
new "new"
type_identifier "StringBuilder"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "builder"
. "."
identifier "append"
argument_list
( "("
identifier "line"
) ")"
; ";"
expression_statement
assignment_expression
identifier "state"
= "="
field_access
identifier "State"
. "."
identifier "SEARCHING_ANNOTATION"
; ";"
expression_statement
assignment_expression
identifier "token"
= "="
method_invocation
identifier "next"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "ignoreStar"
= "="
false "false"
; ";"
do_statement
do "do"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
identifier "token"
) ")"
switch_block
{ "{"
switch_block_statement_group (+67 nodes collapsed)
switch_block_statement_group (+52 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
identifier "ANNOTATION"
: ":"
switch_block_statement_group
switch_label
case "case"
identifier "EOC"
: ":"
switch_block_statement_group
switch_label
case "case"
identifier "EOF"
: ":"
line_comment "// When we're capturing a license block, annotations"
line_comment "// in the block are ok."
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "multilineText"
= "="
method_invocation
identifier "builder"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
if_statement (+27 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "endLineno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getLineno"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "endCharno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getCharno"
argument_list
( "("
) ")"
; ";"
if_statement (+36 nodes collapsed)
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "ExtractionInfo"
argument_list
( "("
identifier "multilineText"
, ","
identifier "token"
) ")"
; ";"
line_comment "// FALL THROUGH"
switch_block_statement_group (+120 nodes collapsed)
} "}"
} "}"
while "while"
parenthesized_expression
( "("
true "true"
) ")"
; ";"
} "}"
block_comment "/**\n * Extracts the top-level block comment from the JsDoc"...
method_declaration (+295 nodes collapsed)
block_comment "/**\n * Trim characters from only the end of a string.\n *"...
method_declaration (+134 nodes collapsed)
line_comment "// Based on ES4 grammar proposed on July 10, 2008."
line_comment "// http://wiki.ecmascript.org/doku.php?id=spec:spec"
line_comment "// Deliberately written to line up with the actual grammar r"...
line_comment "// for maximum flexibility."
line_comment "// TODO(nicksantos): The current implementation tries to mai"...
line_comment "// compatibility with previous versions of the spec whenever"...
line_comment "// We should try to gradually withdraw support for these."
block_comment "/**\n * TypeExpressionAnnotation := TypeExpression |\n * "...
method_declaration (+129 nodes collapsed)
block_comment "/**\n * ParamTypeExpressionAnnotation :=\n * '{' Optio"...
method_declaration (+273 nodes collapsed)
block_comment "/**\n * TypeNameAnnotation := TypeName | '{' TypeName '}'\n "...
method_declaration (+129 nodes collapsed)
block_comment "/**\n * TopLevelTypeExpression := TypeExpression\n * |"...
method_declaration (+120 nodes collapsed)
block_comment "/**\n * TypeExpressionList := TopLevelTypeExpression\n * "...
method_declaration (+144 nodes collapsed)
block_comment "/**\n * TypeExpression := BasicTypeExpression\n * | '?"...
method_declaration (+200 nodes collapsed)
block_comment "/**\n * BasicTypeExpression := '*' | 'null' | 'undefined' |"...
method_declaration (+280 nodes collapsed)
block_comment "/**\n * TypeName := NameExpression | NameExpression TypeApp"...
method_declaration (+173 nodes collapsed)
block_comment "/**\n * FunctionType := 'function' FunctionSignatureType\n "...
method_declaration (+445 nodes collapsed)
block_comment "/**\n * ParametersType := RestParameterType | NonRestParame"...
line_comment "// NOTE(nicksantos): The official ES4 grammar forces optiona"...
line_comment "// arguments to come after the required arguments. Our parse"...
line_comment "// enforce this. Instead we allow them anywhere in the funct"...
line_comment "// and then warn about them during type resolution."
line_comment "//"
line_comment "// In theory, it might be mathematically nicer to do the ord"...
line_comment "// But in practice, the order-checking for structural functi"...
line_comment "// the same as the order-checking for @param annotations. An"...
line_comment "// has to happen during type resolution. Rather than duplica"...
line_comment "// order-checking in two places, we just do all of it in typ"...
method_declaration (+446 nodes collapsed)
block_comment "/**\n * ResultType := <empty> | ':' void | ':' TypeExpressi"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * UnionType := '(' TypeUnionList ')'\n * TypeUnionLi"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Create a new union type, with an alternate that has"...
method_declaration (+297 nodes collapsed)
block_comment "/**\n * ArrayType := '[' ElementTypeList ']'\n * ElementTy"...
method_declaration (+246 nodes collapsed)
block_comment "/**\n * RecordType := '{' FieldTypeList '}'\n */"
method_declaration (+120 nodes collapsed)
block_comment "/**\n * FieldTypeList := FieldType | FieldType ',' FieldTyp"...
method_declaration (+137 nodes collapsed)
block_comment "/**\n * FieldType := FieldName | FieldName ':' TypeExpressi"...
method_declaration (+160 nodes collapsed)
block_comment "/**\n * FieldName := NameExpression | StringLiteral | Numbe"...
method_declaration (+58 nodes collapsed)
method_declaration (+55 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Eats tokens until {@link JsDocToken#EOL} included, "...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Eats tokens until {@link JsDocToken#EOL} included, "...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Specific value indicating that the {@link #unreadTo"...
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "JsDocToken"
variable_declarator
identifier "NO_UNREAD_TOKEN"
= "="
null_literal "null"
; ";"
block_comment "/**\n * One token buffer.\n */"
field_declaration
modifiers
private "private"
type_identifier "JsDocToken"
variable_declarator
identifier "unreadToken"
= "="
identifier "NO_UNREAD_TOKEN"
; ";"
block_comment "/**\n * Tests whether the next symbol of the token stream m"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Tests that the next symbol of the token stream matc"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Gets the next token of the token stream or the buff"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Gets the current token, invalidating it in the proc"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Skips all EOLs and all empty lines in the JSDoc. Ca"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Determines whether the parser has been populated wi"...
method_declaration (+21 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "hasParsedJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "jsdocBuilder"
. "."
identifier "isPopulated"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration
type_identifier "JSDocInfo"
identifier "retrieveAndResetParsedJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "jsdocBuilder"
. "."
identifier "build"
argument_list
( "("
identifier "sourceName"
) ")"
; ";"
} "}"
block_comment "/**\n * Gets the fileoverview JSDocInfo, if any.\n */"
method_declaration
type_identifier "JSDocInfo"
identifier "getFileOverviewJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fileOverviewJSDocInfo"
; ";"
} "}"
} "}"

After

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "parsing"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfoBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSTypeExpression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "ScriptRuntime"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
. "."
identifier "Visibility"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeNative"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * A parser for JSDoc comments.\n *\n*\n */"
line_comment "// TODO(nicksantos): Unify all the JSDocInfo stuff into one "...
line_comment "// spreading it across mutliple packages."
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "JsDocInfoParser"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JsDocTokenStream"
variable_declarator
identifier "stream"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSDocInfoBuilder"
variable_declarator
identifier "jsdocBuilder"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "sourceName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ErrorReporter"
variable_declarator
identifier "errorReporter"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ErrorReporterParser"
variable_declarator
identifier "parser"
= "="
object_creation_expression
new "new"
type_identifier "ErrorReporterParser"
argument_list
( "("
) ")"
; ";"
class_declaration (+108 nodes collapsed)
line_comment "// The DocInfo with the fileoverview tag for the whole file."
field_declaration
modifiers
private "private"
type_identifier "JSDocInfo"
variable_declarator
identifier "fileOverviewJSDocInfo"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "State"
variable_declarator
identifier "state"
; ";"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Annotation"
> ">"
variable_declarator
identifier "annotationNames"
; ";"
field_declaration
modifiers
private "private"
scoped_type_identifier
type_identifier "Node"
. "."
type_identifier "FileLevelJsDocBuilder"
variable_declarator
identifier "fileLevelJsDocBuilder"
; ";"
block_comment "/**\n * Sets the JsDocBuilder for the file-level (root) nod"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Sets the file overview JSDocInfo, in order to warn "...
method_declaration (+21 nodes collapsed)
enum_declaration
modifiers
private "private"
enum "enum"
identifier "State"
enum_body
{ "{"
enum_constant
identifier "SEARCHING_ANNOTATION"
, ","
enum_constant
identifier "SEARCHING_NEWLINE"
, ","
enum_constant
identifier "NEXT_IS_ANNOTATION"
} "}"
constructor_declaration (+92 nodes collapsed)
block_comment "/**\n * Parses a string containing a JsDoc type declaration"...
method_declaration (+105 nodes collapsed)
block_comment "/**\n * Parses a {@link JSDocInfo} object. This parsing met"...
method_declaration (+4572 nodes collapsed)
block_comment "/**\n * Parse a {@code @suppress} tag of the form\n * {@co"...
method_declaration (+287 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Looks for a type expression at the current token an"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Looks for a parameter type expression at the curren"...
method_declaration (+142 nodes collapsed)
block_comment "/**\n * Determines whether the given type is a valid {@code"...
line_comment "// TODO(nicksantos): Move this into a check pass."
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Converts a JSDoc token to its string representation"...
method_declaration (+271 nodes collapsed)
block_comment "/**\n * Constructs a new {@code JSTypeExpression}.\n * @pa"...
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Tuple for returning both the string extracted and t"...
class_declaration (+90 nodes collapsed)
block_comment "/**\n * Extracts the text found on the current line startin"...
method_declaration (+133 nodes collapsed)
method_declaration (+28 nodes collapsed)
enum_declaration
modifiers
private "private"
enum "enum"
identifier "WhitespaceOption"
enum_body
{ "{"
block_comment "/**\n * Preserves all whitespace and formatting. Needed f"...
enum_constant
identifier "PRESERVE"
, ","
block_comment "/** Preserves newlines but trims the output. */"
enum_constant
identifier "TRIM"
, ","
block_comment "/** Removes newlines and turns the output into a single line"...
enum_constant
identifier "SINGLE_LINE"
} "}"
block_comment "/**\n * Extracts the text found on the current line and all"...
method_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "fallthrough"
" "\""
) ")"
private "private"
type_identifier "ExtractionInfo"
identifier "extractMultilineTextualBlock"
formal_parameters
( "("
formal_parameter
type_identifier "JsDocToken"
identifier "token"
, ","
formal_parameter
type_identifier "WhitespaceOption"
identifier "option"
) ")"
block
{ "{"
if_statement (+47 nodes collapsed)
expression_statement
method_invocation
identifier "stream"
. "."
identifier "update"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "startLineno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getLineno"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "startCharno"
= "="
binary_expression
method_invocation
identifier "stream"
. "."
identifier "getCharno"
argument_list
( "("
) ")"
+ "+"
decimal_integer_literal "1"
; ";"
line_comment "// Read the content from the first line."
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "line"
= "="
method_invocation
identifier "stream"
. "."
identifier "getRemainingJSDocLine"
argument_list
( "("
) ")"
; ";"
if_statement (+27 nodes collapsed)
local_variable_declaration
type_identifier "StringBuilder"
variable_declarator
identifier "builder"
= "="
object_creation_expression
new "new"
type_identifier "StringBuilder"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "builder"
. "."
identifier "append"
argument_list
( "("
identifier "line"
) ")"
; ";"
expression_statement
assignment_expression
identifier "state"
= "="
field_access
identifier "State"
. "."
identifier "SEARCHING_ANNOTATION"
; ";"
expression_statement
assignment_expression
identifier "token"
= "="
method_invocation
identifier "next"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "ignoreStar"
= "="
false "false"
; ";"
do_statement
do "do"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
identifier "token"
) ")"
switch_block
{ "{"
switch_block_statement_group (+67 nodes collapsed)
switch_block_statement_group (+52 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
identifier "ANNOTATION"
: ":"
switch_block_statement_group
switch_label
case "case"
identifier "EOC"
: ":"
switch_block_statement_group
switch_label
case "case"
identifier "EOF"
: ":"
line_comment "// When we're capturing a license block, annotations"
line_comment "// in the block are ok."
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "option"
== "=="
field_access
identifier "WhitespaceOption"
. "."
identifier "PRESERVE"
&& "&&"
binary_expression
identifier "token"
== "=="
field_access
identifier "JsDocToken"
. "."
identifier "ANNOTATION"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "multilineText"
= "="
method_invocation
identifier "builder"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
if_statement (+27 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "endLineno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getLineno"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "endCharno"
= "="
method_invocation
identifier "stream"
. "."
identifier "getCharno"
argument_list
( "("
) ")"
; ";"
if_statement (+36 nodes collapsed)
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "ExtractionInfo"
argument_list
( "("
identifier "multilineText"
, ","
identifier "token"
) ")"
; ";"
} "}"
line_comment "// FALL THROUGH"
switch_block_statement_group (+120 nodes collapsed)
} "}"
} "}"
while "while"
parenthesized_expression
( "("
true "true"
) ")"
; ";"
} "}"
block_comment "/**\n * Extracts the top-level block comment from the JsDoc"...
method_declaration (+295 nodes collapsed)
block_comment "/**\n * Trim characters from only the end of a string.\n *"...
method_declaration (+134 nodes collapsed)
line_comment "// Based on ES4 grammar proposed on July 10, 2008."
line_comment "// http://wiki.ecmascript.org/doku.php?id=spec:spec"
line_comment "// Deliberately written to line up with the actual grammar r"...
line_comment "// for maximum flexibility."
line_comment "// TODO(nicksantos): The current implementation tries to mai"...
line_comment "// compatibility with previous versions of the spec whenever"...
line_comment "// We should try to gradually withdraw support for these."
block_comment "/**\n * TypeExpressionAnnotation := TypeExpression |\n * "...
method_declaration (+129 nodes collapsed)
block_comment "/**\n * ParamTypeExpressionAnnotation :=\n * '{' Optio"...
method_declaration (+273 nodes collapsed)
block_comment "/**\n * TypeNameAnnotation := TypeName | '{' TypeName '}'\n "...
method_declaration (+129 nodes collapsed)
block_comment "/**\n * TopLevelTypeExpression := TypeExpression\n * |"...
method_declaration (+120 nodes collapsed)
block_comment "/**\n * TypeExpressionList := TopLevelTypeExpression\n * "...
method_declaration (+144 nodes collapsed)
block_comment "/**\n * TypeExpression := BasicTypeExpression\n * | '?"...
method_declaration (+200 nodes collapsed)
block_comment "/**\n * BasicTypeExpression := '*' | 'null' | 'undefined' |"...
method_declaration (+280 nodes collapsed)
block_comment "/**\n * TypeName := NameExpression | NameExpression TypeApp"...
method_declaration (+173 nodes collapsed)
block_comment "/**\n * FunctionType := 'function' FunctionSignatureType\n "...
method_declaration (+445 nodes collapsed)
block_comment "/**\n * ParametersType := RestParameterType | NonRestParame"...
line_comment "// NOTE(nicksantos): The official ES4 grammar forces optiona"...
line_comment "// arguments to come after the required arguments. Our parse"...
line_comment "// enforce this. Instead we allow them anywhere in the funct"...
line_comment "// and then warn about them during type resolution."
line_comment "//"
line_comment "// In theory, it might be mathematically nicer to do the ord"...
line_comment "// But in practice, the order-checking for structural functi"...
line_comment "// the same as the order-checking for @param annotations. An"...
line_comment "// has to happen during type resolution. Rather than duplica"...
line_comment "// order-checking in two places, we just do all of it in typ"...
method_declaration (+446 nodes collapsed)
block_comment "/**\n * ResultType := <empty> | ':' void | ':' TypeExpressi"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * UnionType := '(' TypeUnionList ')'\n * TypeUnionLi"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Create a new union type, with an alternate that has"...
method_declaration (+297 nodes collapsed)
block_comment "/**\n * ArrayType := '[' ElementTypeList ']'\n * ElementTy"...
method_declaration (+246 nodes collapsed)
block_comment "/**\n * RecordType := '{' FieldTypeList '}'\n */"
method_declaration (+120 nodes collapsed)
block_comment "/**\n * FieldTypeList := FieldType | FieldType ',' FieldTyp"...
method_declaration (+137 nodes collapsed)
block_comment "/**\n * FieldType := FieldName | FieldName ':' TypeExpressi"...
method_declaration (+160 nodes collapsed)
block_comment "/**\n * FieldName := NameExpression | StringLiteral | Numbe"...
method_declaration (+58 nodes collapsed)
method_declaration (+55 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Eats tokens until {@link JsDocToken#EOL} included, "...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Eats tokens until {@link JsDocToken#EOL} included, "...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Specific value indicating that the {@link #unreadTo"...
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "JsDocToken"
variable_declarator
identifier "NO_UNREAD_TOKEN"
= "="
null_literal "null"
; ";"
block_comment "/**\n * One token buffer.\n */"
field_declaration
modifiers
private "private"
type_identifier "JsDocToken"
variable_declarator
identifier "unreadToken"
= "="
identifier "NO_UNREAD_TOKEN"
; ";"
block_comment "/**\n * Tests whether the next symbol of the token stream m"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Tests that the next symbol of the token stream matc"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Gets the next token of the token stream or the buff"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Gets the current token, invalidating it in the proc"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Skips all EOLs and all empty lines in the JSDoc. Ca"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Determines whether the parser has been populated wi"...
method_declaration (+21 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "hasParsedJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "jsdocBuilder"
. "."
identifier "isPopulated"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration
type_identifier "JSDocInfo"
identifier "retrieveAndResetParsedJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "jsdocBuilder"
. "."
identifier "build"
argument_list
( "("
identifier "sourceName"
) ")"
; ";"
} "}"
block_comment "/**\n * Gets the fileoverview JSDocInfo, if any.\n */"
method_declaration
type_identifier "JSDocInfo"
identifier "getFileOverviewJSDocInfo"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fileOverviewJSDocInfo"
; ";"
} "}"
} "}"