Package | Description |
---|---|
com.google.javascript.jscomp.parsing |
Provides utilities to help with parsing JSDoc annotations and performing AST
transformations.
|
Modifier and Type | Field and Description |
---|---|
private static JsDocToken |
JsDocInfoParser.NO_UNREAD_TOKEN
Specific value indicating that the
JsDocInfoParser.unreadToken contains no token. |
private JsDocToken |
JsDocInfoParser.ExtractionInfo.token |
private JsDocToken |
JsDocInfoParser.unreadToken
One token buffer.
|
Modifier and Type | Method and Description |
---|---|
private JsDocToken |
JsDocInfoParser.current()
Gets the current token, invalidating it in the process.
|
private JsDocToken |
JsDocInfoParser.eatTokensUntilEOL()
Eats tokens until
EOL included, and switches back the
state to JsDocInfoParser.State.SEARCHING_ANNOTATION . |
private JsDocToken |
JsDocInfoParser.eatTokensUntilEOL(JsDocToken token)
Eats tokens until
EOL included, and switches back the
state to JsDocInfoParser.State.SEARCHING_ANNOTATION . |
private JsDocToken |
JsDocInfoParser.eatUntilEOLIfNotAnnotation() |
private JsDocToken |
JsDocInfoParser.eatUntilEOLIfNotAnnotation(JsDocToken token) |
(package private) JsDocToken |
JsDocTokenStream.getJsDocToken()
Tokenizes JSDoc comments.
|
private JsDocToken |
JsDocInfoParser.next()
Gets the next token of the token stream or the buffered token if a matching
was previously made.
|
private JsDocToken |
JsDocInfoParser.parseAnnotation(JsDocToken token,
java.util.List<JsDocInfoParser.ExtendedTypeInfo> extendedTypes) |
private JsDocToken |
JsDocInfoParser.parseIdGeneratorTag(JsDocToken token)
Parse a
@idgenerator tag of the form
@idgenerator or
@idgenerator{consistent} . |
private JsDocToken |
JsDocInfoParser.parseModifiesTag(JsDocToken token)
Parse a
@modifies tag of the form
@modifies{this|arguments|param} . |
private JsDocToken |
JsDocInfoParser.parseSuppressTag(JsDocToken token)
Parse a
@suppress tag of the form
@suppress{warning1|warning2} . |
private JsDocToken |
JsDocInfoParser.recordDescription(JsDocToken token)
Records a marker's description if there is one available and record it in
the current marker.
|
static JsDocToken |
JsDocToken.valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static JsDocToken[] |
JsDocToken.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
Modifier and Type | Method and Description |
---|---|
private JsDocToken |
JsDocInfoParser.eatTokensUntilEOL(JsDocToken token)
Eats tokens until
EOL included, and switches back the
state to JsDocInfoParser.State.SEARCHING_ANNOTATION . |
private JsDocToken |
JsDocInfoParser.eatUntilEOLIfNotAnnotation(JsDocToken token) |
private JsDocInfoParser.ExtractionInfo |
JsDocInfoParser.extractBlockComment(JsDocToken token)
Extracts the top-level block comment from the JsDoc comment, if any.
|
private JsDocInfoParser.ExtractionInfo |
JsDocInfoParser.extractMultilineComment(JsDocToken token,
JsDocInfoParser.WhitespaceOption option,
boolean isMarker,
boolean includeAnnotations)
Extracts text from the stream until the end of the comment, end of the
file, or an annotation token is encountered.
|
private JsDocInfoParser.ExtractionInfo |
JsDocInfoParser.extractMultilineTextualBlock(JsDocToken token) |
private JsDocInfoParser.ExtractionInfo |
JsDocInfoParser.extractMultilineTextualBlock(JsDocToken token,
JsDocInfoParser.WhitespaceOption option,
boolean includeAnnotations)
Extracts the text found on the current line and all subsequent
until either an annotation, end of comment or end of file is reached.
|
private boolean |
JsDocInfoParser.match(JsDocToken token)
Tests whether the next symbol of the token stream matches the specific
token.
|
private boolean |
JsDocInfoParser.match(JsDocToken token1,
JsDocToken token2)
Tests that the next symbol of the token stream matches one of the specified
tokens.
|
private Node |
JsDocInfoParser.parseAndRecordParamTypeNode(JsDocToken token)
Looks for a type expression at the current token and if found,
returns it.
|
private Node |
JsDocInfoParser.parseAndRecordTypeNameNode(JsDocToken token,
int lineno,
int startCharno,
boolean matchingLC)
Looks for a type expression at the current token and if found,
returns it.
|
(package private) Node |
JsDocInfoParser.parseAndRecordTypeNode(JsDocToken token)
Looks for a type expression at the current token and if found,
returns it.
|
private Node |
JsDocInfoParser.parseAndRecordTypeNode(JsDocToken token,
int lineno,
int startCharno,
boolean matchingLC,
boolean onlyParseSimpleNames)
Looks for a parameter type expression at the current token and if found,
returns it.
|
private JsDocToken |
JsDocInfoParser.parseAnnotation(JsDocToken token,
java.util.List<JsDocInfoParser.ExtendedTypeInfo> extendedTypes) |
private Node |
JsDocInfoParser.parseBasicTypeExpression(JsDocToken token)
BasicTypeExpression := '*' | 'null' | 'undefined' | TypeName
| FunctionType | UnionType | RecordType
|
private Node |
JsDocInfoParser.parseContextTypeExpression(JsDocToken token)
ContextTypeExpression := BasicTypeExpression | '?'
For expressions on the right hand side of a this: or new:
|
private Node |
JsDocInfoParser.parseFieldName(JsDocToken token)
FieldName := NameExpression | StringLiteral | NumberLiteral |
ReservedIdentifier
|
private Node |
JsDocInfoParser.parseFieldType(JsDocToken token)
FieldType := FieldName | FieldName ':' TypeExpression
|
private Node |
JsDocInfoParser.parseFieldTypeList(JsDocToken token)
FieldTypeList := FieldType | FieldType ',' FieldTypeList
|
private Node |
JsDocInfoParser.parseFunctionType(JsDocToken token)
FunctionType := 'function' FunctionSignatureType
FunctionSignatureType :=
TypeParameters '(' 'this' ':' TypeName, ParametersType ')' ResultType
|
private boolean |
JsDocInfoParser.parseHelperLoop(JsDocToken token,
java.util.List<JsDocInfoParser.ExtendedTypeInfo> extendedTypes) |
private JsDocToken |
JsDocInfoParser.parseIdGeneratorTag(JsDocToken token)
Parse a
@idgenerator tag of the form
@idgenerator or
@idgenerator{consistent} . |
private JsDocToken |
JsDocInfoParser.parseModifiesTag(JsDocToken token)
Parse a
@modifies tag of the form
@modifies{this|arguments|param} . |
private Node |
JsDocInfoParser.parseParametersType(JsDocToken token)
ParametersType := RestParameterType | NonRestParametersType
| NonRestParametersType ',' RestParameterType
RestParameterType := '...' Identifier
NonRestParametersType := ParameterType ',' NonRestParametersType
| ParameterType
| OptionalParametersType
OptionalParametersType := OptionalParameterType
| OptionalParameterType, OptionalParametersType
OptionalParameterType := ParameterType=
ParameterType := TypeExpression | Identifier ':' TypeExpression
|
private Node |
JsDocInfoParser.parseParamTypeExpression(JsDocToken token)
ParamTypeExpression :=
OptionalParameterType |
TopLevelTypeExpression |
'...' TopLevelTypeExpression
OptionalParameterType :=
TopLevelTypeExpression '='
|
private Node |
JsDocInfoParser.parseParamTypeExpressionAnnotation(JsDocToken token)
ParamTypeExpressionAnnotation := '{' ParamTypeExpression '}'
|
private Node |
JsDocInfoParser.parseRecordType(JsDocToken token)
RecordType := '{' FieldTypeList '}'
|
private JsDocToken |
JsDocInfoParser.parseSuppressTag(JsDocToken token)
Parse a
@suppress tag of the form
@suppress{warning1|warning2} . |
private Node |
JsDocInfoParser.parseTopLevelTypeExpression(JsDocToken token)
TopLevelTypeExpression := TypeExpression
| TypeUnionList
We made this rule up, for the sake of backwards compatibility.
|
private Node |
JsDocInfoParser.parseTypeExpression(JsDocToken token)
TypeExpression := BasicTypeExpression
| '?' BasicTypeExpression
| '!' BasicTypeExpression
| BasicTypeExpression '?'
| BasicTypeExpression '!'
| '?'
|
private Node |
JsDocInfoParser.parseTypeExpressionAnnotation(JsDocToken token)
TypeExpressionAnnotation := TypeExpression |
'{' TopLevelTypeExpression '}'
|
private Node |
JsDocInfoParser.parseTypeExpressionList(JsDocToken token)
TypeExpressionList := TopLevelTypeExpression
| TopLevelTypeExpression ',' TypeExpressionList
|
private Node |
JsDocInfoParser.parseTypeName(JsDocToken token)
TypeName := NameExpression | NameExpression TypeApplication
TypeApplication := '.<' TypeExpressionList '>'
|
private Node |
JsDocInfoParser.parseTypeNameAnnotation(JsDocToken token)
TypeNameAnnotation := TypeName | '{' TypeName '}'
|
private Node |
JsDocInfoParser.parseUnionType(JsDocToken token)
UnionType := '(' TypeUnionList ')'
TypeUnionList := TypeExpression | TypeExpression '|' TypeUnionList
We've removed the empty union type.
|
private Node |
JsDocInfoParser.parseUnionTypeWithAlternate(JsDocToken token,
Node alternate)
Create a new union type, with an alternate that has already been
parsed.
|
private JsDocToken |
JsDocInfoParser.recordDescription(JsDocToken token)
Records a marker's description if there is one available and record it in
the current marker.
|
private void |
JsDocInfoParser.restoreLookAhead(JsDocToken token)
Restores the lookahead token to the token stream
|
private java.lang.String |
JsDocInfoParser.toString(JsDocToken token)
Converts a JSDoc token to its string representation.
|
Constructor and Description |
---|
ExtractionInfo(java.lang.String string,
JsDocToken token) |