apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]
Packages:
PHP_CodeSniffer


Classes:
PHP_CodeSniffer
AbstractPatternSniff
AbstractScopeSniff
AbstractVariableSniff
AjaxNullComparisonSniff
ArrayBracketSpacingSniff
ArrayDeclarationSniff
AssignThisSniff
Autoload
BlockCommentSniff
BrowserSpecificStylesSniff
ByteOrderMarkSniff
Cache
CallTimePassByReferenceSniff
CamelCapsFunctionNameSniff
CamelCapsMethodNameSniff
CastSpacingSniff
Cbf
CharacterBeforePHPOpeningTagSniff
Checkstyle
ClassCommentSniff
ClassDeclarationSniff
ClassDefinitionClosingBraceSpaceSniff
ClassDefinitionNameSpacingSniff
ClassDefinitionOpeningBraceSpaceSniff
ClassFileNameSniff
ClosingDeclarationCommentSniff
ClosingPHPTagSniff
ClosingTagSniff
ClosureLinterSniff
CodeAnalyzerSniff
ColonSpacingSniff
ColourDefinitionSniff
Comment
CommentedOutCodeSniff
Common
ComparisonOperatorUsageSniff
ConcatenationSpacingSniff
Config
ConstructorNameSniff
ControlSignatureSniff
ControlStructureSpacingSniff
CreateWidgetTypeCallbackSniff
CSS
CSSLintSniff
Csv
CyclomaticComplexitySniff
DebugCodeSniff
DeprecatedFunctionsSniff
Diff
DisallowBooleanStatementSniff
DisallowComparisonAssignmentSniff
DisallowInlineIfSniff
DisallowLongArraySyntaxSniff
DisallowMultipleAssignmentsSniff
DisallowMultipleStatementsSniff
DisallowMultipleStyleDefinitionsSniff
DisallowNewWidgetSniff
DisallowObEndFlushSniff
DisallowObjectStringIndexSniff
DisallowSelfActionsSniff
DisallowShortArraySyntaxSniff
DisallowShortOpenTagSniff
DisallowSizeFunctionsInLoopsSniff
DisallowSpaceIndentSniff
DisallowTabIndentSniff
DiscouragedFunctionsSniff
DocCommentAlignmentSniff
DocCommentSniff
DoubleQuoteUsageSniff
DummyFile
DuplicateClassDefinitionSniff
DuplicateClassNameSniff
DuplicatePropertySniff
DuplicateStyleDefinitionSniff
EchoedStringsSniff
ElseIfDeclarationSniff
Emacs
EmbeddedPhpSniff
EmptyCatchCommentSniff
EmptyClassDefinitionSniff
EmptyStatementSniff
EmptyStyleDefinitionSniff
EndFileNewlineSniff
EndFileNoNewlineSniff
EvalObjectFactorySniff
EvalSniff
ExactMatch
File
FileCommentSniff
FileExtensionSniff
FileList
Filter
FirebugConsoleSniff
Fixer
FixmeSniff
ForbiddenFunctionsSniff
ForbiddenStylesSniff
ForEachLoopDeclarationSniff
ForLoopDeclarationSniff
ForLoopShouldBeWhileLoopSniff
ForLoopWithTestFunctionCallSniff
Full
FunctionCallArgumentSpacingSniff
FunctionCallSignatureSniff
FunctionClosingBraceSniff
FunctionClosingBraceSpaceSniff
FunctionCommentSniff
FunctionCommentThrowTagSniff
FunctionDeclarationArgumentSpacingSniff
FunctionDeclarationSniff
FunctionDuplicateArgumentSniff
FunctionOpeningBraceSpaceSniff
FunctionSpacingSniff
Generator
GetRequestDataSniff
Gitblame
GitModified
GlobalFunctionSniff
GlobalKeywordSniff
HeredocSniff
Hgblame
HTML
IncludeOwnSystemSniff
IncludeSystemSniff
IncludingFileSniff
IncrementDecrementUsageSniff
IndentationSniff
Info
InlineCommentSniff
InlineControlStructureSniff
InlineHTMLSniff
InlineIfDeclarationSniff
InnerFunctionsSniff
JavaScriptLintSniff
JoinStringsSniff
JS
JSHintSniff
JSLintSniff
Json
JumbledIncrementerSniff
Junit
LanguageConstructSpacingSniff
LineEndingsSniff
LineLengthSniff
LocalFile
LogicalOperatorSpacingSniff
LongConditionClosingCommentSniff
LowercaseClassKeywordsSniff
LowerCaseConstantSniff
LowercaseDeclarationSniff
LowercasedFilenameSniff
LowercaseFunctionKeywordsSniff
LowerCaseKeywordSniff
LowercasePHPFunctionsSniff
LowercaseStyleDefinitionSniff
Markdown
MemberVarScopeSniff
MemberVarSpacingSniff
MethodDeclarationSniff
MethodScopeSniff
MissingColonSniff
MultiLineAssignmentSniff
MultiLineConditionSniff
MultiLineFunctionDeclarationSniff
MultipleStatementAlignmentSniff
NamedColoursSniff
NamespaceDeclarationSniff
NestingLevelSniff
NonExecutableCodeSniff
NoSilencedErrorsSniff
NoSpaceAfterCastSniff
Notifysend
ObjectInstantiationSniff
ObjectMemberCommaSniff
ObjectOperatorIndentSniff
ObjectOperatorSpacingSniff
OneClassPerFileSniff
OneInterfacePerFileSniff
OneTraitPerFileSniff
OpacitySniff
OpeningFunctionBraceBsdAllmanSniff
OpeningFunctionBraceKernighanRitchieSniff
OperatorBracketSniff
OperatorSpacingSniff
PHP
PostStatementCommentSniff
PropertyDeclarationSniff
PropertyLabelSpacingSniff
Reporter
ReturnFunctionValueSniff
Ruleset
Runner
RuntimeException
SAPIUsageSniff
ScopeClosingBraceSniff
ScopeIndentSniff
ScopeKeywordSpacingSniff
SelfMemberReferenceSniff
SemicolonSpacingSniff
ShorthandSizeSniff
SideEffectsSniff
Source
SpaceAfterCastSniff
SpaceAfterNotSniff
Standards
StaticThisUsageSniff
SubversionPropertiesSniff
Summary
SuperfluousWhitespaceSniff
Svnblame
SwitchDeclarationSniff
SyntaxSniff
Text
Timing
TodoSniff
Tokenizer
TokenizerException
Tokens
UnconditionalIfStatementSniff
UnnecessaryFinalModifierSniff
UnnecessaryStringConcatSniff
UnusedFunctionParameterSniff
UnusedSystemSniff
UpperCaseConstantNameSniff
UpperCaseConstantSniff
UseDeclarationSniff
UselessOverridingMethodSniff
ValidClassNameSniff
ValidDefaultValueSniff
ValidFunctionNameSniff
ValidLogicalOperatorsSniff
ValidVariableNameSniff
VariableCommentSniff
VersionControl
Xml

Class: JS

Source Location: /PHP_CodeSniffer-3.0.0a1/src/Tokenizers/JS.php

Class Overview

Tokenizer
 |
 --JS

Tokenizes JS code.


Author(s):

Copyright:

  • 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)

Variables

Methods


Inherited Variables

Class: Tokenizer

Tokenizer::$config
Tokenizer::$eolChar
Tokenizer::$ignoredLines
Tokenizer::$knownLengths
Tokenizer::$tokens

Inherited Methods

Class: Tokenizer

Tokenizer::__construct()
Initialise and run the tokenizer.
Tokenizer::getTokens()
Gets the array of tokens.
Tokenizer::isMinifiedContent()
Checks the content to see if it looks minified.
Tokenizer::processAdditional()
Performs additional processing after main tokenizing.
Tokenizer::replaceTabsInToken()
Replaces tabs in original token content with spaces.
Tokenizer::tokenize()
Creates an array of tokens when given some content.

Class Details

[line 16]
Tokenizes JS code.


[ Top ]


Class Variables

$commentTokens = array(
'//' => null,
'/*' => '*/',
'/**' => '*/',
)

[line 228]

A list tokens that start and end comments.
  • Access: protected

Type: array


[ Top ]

$endScopeTokens = array(
T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET,
T_BREAK => T_BREAK,
)

[line 136]

A list of tokens that end the scope.

This array is just a unique collection of the end tokens from the _scopeOpeners array. The data is duplicated here to save time during parsing of the file.

  • Access: public

Type: array


[ Top ]

$scopeOpeners = array(
T_IF => array(
'start' => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_TRY=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CATCH=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_ELSE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_FOR=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_FUNCTION=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_WHILE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_DO=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_SWITCH=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CASE=>array('start'=>array(T_COLON=>T_COLON),'end'=>array(T_BREAK=>T_BREAK,T_RETURN=>T_RETURN,T_CONTINUE=>T_CONTINUE,T_THROW=>T_THROW,),'strict'=>true,'shared'=>true,'with'=>array(T_DEFAULT=>T_DEFAULT,T_CASE=>T_CASE,T_SWITCH=>T_SWITCH,),),T_DEFAULT=>array('start'=>array(T_COLON=>T_COLON),'end'=>array(T_BREAK=>T_BREAK,T_RETURN=>T_RETURN,T_CONTINUE=>T_CONTINUE,T_THROW=>T_THROW,),'strict'=>true,'shared'=>true,'with'=>array(T_CASE=>T_CASE,T_SWITCH=>T_SWITCH,),),)

[line 30]

A list of tokens that are allowed to open a scope.

This array also contains information about what kind of token the scope opener uses to open and close the scope, if the token strictly requires an opener, if the token can share a scope closer, and who it can be shared with. An example of a token that shares a scope closer is a CASE scope.

  • Access: public

Type: array


[ Top ]

$stringTokens = array(
'\'' => '\'',
'"' => '"',
)

[line 218]

A list string delimiters.
  • Access: protected

Type: array


[ Top ]

$tokenValues = array(
'function' => 'T_FUNCTION',
'prototype' => 'T_PROTOTYPE',
'try' => 'T_TRY',
'catch' => 'T_CATCH',
'return' => 'T_RETURN',
'throw' => 'T_THROW',
'break' => 'T_BREAK',
'switch' => 'T_SWITCH',
'continue' => 'T_CONTINUE',
'if' => 'T_IF',
'else' => 'T_ELSE',
'do' => 'T_DO',
'while' => 'T_WHILE',
'for' => 'T_FOR',
'var' => 'T_VAR',
'case' => 'T_CASE',
'default' => 'T_DEFAULT',
'true' => 'T_TRUE',
'false' => 'T_FALSE',
'null' => 'T_NULL',
'this' => 'T_THIS',
'typeof' => 'T_TYPEOF',
'(' => 'T_OPEN_PARENTHESIS',
')' => 'T_CLOSE_PARENTHESIS',
'{' => 'T_OPEN_CURLY_BRACKET',
'}' => 'T_CLOSE_CURLY_BRACKET',
'[' => 'T_OPEN_SQUARE_BRACKET',
']' => 'T_CLOSE_SQUARE_BRACKET',
'?' => 'T_INLINE_THEN',
'.' => 'T_OBJECT_OPERATOR',
'+' => 'T_PLUS',
'-' => 'T_MINUS',
'*' => 'T_MULTIPLY',
'%' => 'T_MODULUS',
'/' => 'T_DIVIDE',
'^' => 'T_LOGICAL_XOR',
',' => 'T_COMMA',
';' => 'T_SEMICOLON',
':' => 'T_COLON',
'<' => 'T_LESS_THAN',
'>' => 'T_GREATER_THAN',
'<=' => 'T_IS_SMALLER_OR_EQUAL',
'>=' => 'T_IS_GREATER_OR_EQUAL',
'!' => 'T_BOOLEAN_NOT',
'||' => 'T_BOOLEAN_OR',
'&&' => 'T_BOOLEAN_AND',
'|' => 'T_BITWISE_OR',
'&' => 'T_BITWISE_AND',
'!=' => 'T_IS_NOT_EQUAL',
'!==' => 'T_IS_NOT_IDENTICAL',
'=' => 'T_EQUAL',
'==' => 'T_IS_EQUAL',
'===' => 'T_IS_IDENTICAL',
'-=' => 'T_MINUS_EQUAL',
'+=' => 'T_PLUS_EQUAL',
'*=' => 'T_MUL_EQUAL',
'/=' => 'T_DIV_EQUAL',
'%=' => 'T_MOD_EQUAL',
'++' => 'T_INC',
'--' => 'T_DEC',
'//' => 'T_COMMENT',
'/*' => 'T_COMMENT',
'/**' => 'T_DOC_COMMENT',
'*/' => 'T_COMMENT',
)

[line 146]

A list of special JS tokens and their types.
  • Access: protected

Type: array


[ Top ]



Method Detail

__construct (Constructor) [line 247]

void __construct( string $content, Config $config, [string $eolChar = '\n'])

Initialise the tokenizer.

Pre-checks the content to see if it looks minified.

  • Throws: TokenizerException If the file appears to be minified.
  • Access: public

Overrides Tokenizer::__construct() (Initialise and run the tokenizer.)

Parameters:

string $content — The content to tokenize,
\PHP_CodeSniffer\Config $config — The config data for the run.
string $eolChar — The EOL char used in the content.

[ Top ]

getRegexToken [line 884]

void getRegexToken( string $char, string $string, string $chars, string $tokens)

Tokenizes a regular expression if one is found.

If a regular expression is not found, NULL is returned.

  • Access: public

Parameters:

string $char — The index of the possible regex start character.
string $string — The complete content of the string being tokenized.
string $chars — An array of characters being tokenized.
string $tokens — The current array of tokens found in the string.

[ Top ]

processAdditional [line 1017]

void processAdditional( )

Performs additional processing after main tokenizing.

This additional processing looks for properties, closures, labels and objects.

  • Access: public

Overrides Tokenizer::processAdditional() (Performs additional processing after main tokenizing.)
[ Top ]

tokenize [line 268]

array tokenize( string $string)

Creates an array of tokens when given some PHP code.

Starts by using token_get_all() but does a lot of extra processing to insert information about the context of the token.

  • Access: public

Overrides Tokenizer::tokenize() (Creates an array of tokens when given some content.)

Parameters:

string $string — The string to tokenize.

[ Top ]


Documentation generated on 2019年3月11日 14:53:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.

AltStyle によって変換されたページ (->オリジナル) /