Leafo\ScssPhp\Parser
Parser
- Author: Leaf Corcoran <leafot@gmail.com>
Synopsis
class Parser
{
- // constants
- const SOURCE_INDEX = 1;
- const SOURCE_LINE = 2;
- const SOURCE_COLUMN = 3;
- // members
- protected static array $precedence = ;
- protected static $commentPattern;
- protected static $operatorPattern;
- protected static $whitePattern;
- private $sourceName;
- private $sourceIndex;
- private $sourcePositions;
- private $charset;
- private $count;
- private $env;
- private $inParens;
- private $eatWhiteDefault;
- private $buffer;
- private $utf8;
- private $encoding;
- private $patternModifiers;
- // methods
- public void __construct()
- public string getSourceName()
- public void throwParseError()
- public Block parse()
- public boolean parseValue()
- public boolean parseSelector()
- protected boolean parseChunk()
- protected Block pushBlock()
- protected Block pushSpecialBlock()
- protected Block popBlock()
- protected integer peek()
- protected integer seek()
- protected boolean matchString()
- protected boolean match()
- protected boolean literal()
- protected boolean whitespace()
- protected void appendComment()
- protected void append()
- protected array|null last()
- protected boolean mediaQueryList()
- protected boolean mediaQuery()
- protected boolean mediaExpression()
- protected boolean argValues()
- protected boolean argValue()
- protected boolean valueList()
- protected boolean spaceList()
- protected boolean genericList()
- protected boolean expression()
- protected array expHelper()
- protected boolean value()
- protected boolean parenValue()
- protected boolean progid()
- protected boolean func()
- protected boolean argumentList()
- protected boolean argumentDef()
- protected boolean map()
- protected boolean color()
- protected boolean unit()
- protected boolean string()
- protected boolean mixedKeyword()
- protected boolean openString()
- protected boolean interpolation()
- protected boolean propertyName()
- protected boolean selectors()
- protected boolean selector()
- protected boolean selectorSingle()
- protected boolean variable()
- protected boolean keyword()
- protected boolean placeholder()
- protected boolean url()
- protected boolean end()
- protected array stripAssignmentFlags()
- protected string stripOptionalFlag()
- protected array flattenList()
- protected void to()
- protected void show()
- private string pregQuote()
- private void extractLineNumbers()
- private integer getSourcePosition()
- private void saveEncoding()
- private void restoreEncoding()
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
280 - 696 | CyclomaticComplexity | The method parseChunk() has a Cyclomatic Complexity of 130. The configured cyclomatic complexity threshold is 10. |
280 - 696 | NPathComplexity | The method parseChunk() has an NPath complexity of 858945195343872075600. The configured NPath complexity threshold is 200. |
280 - 696 | ExcessiveMethodLength | The method parseChunk() has 417 lines of code. Current threshold is set to 100. Avoid really long methods. |
282 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
482 | ShortVariable | Avoid variables with short names like $if. Configured minimum length is 3. |
710 | ShortVariable | Avoid variables with short names like $b. Configured minimum length is 3. |
792 | ShortVariable | Avoid variables with short names like $r. Configured minimum length is 3. |
826 | ShortVariable | Avoid variables with short names like $m. Configured minimum length is 3. |
872 | ShortVariable | Avoid variables with short names like $r. Configured minimum length is 3. |
925 | ShortVariable | Avoid variables with short names like $m. Configured minimum length is 3. |
984 | ShortVariable | Avoid variables with short names like $i. Configured minimum length is 3. |
1010 - 1053 | CyclomaticComplexity | The method mediaQuery() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. |
1064 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1113 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1174 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1211 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1250 - 1291 | CyclomaticComplexity | The method expHelper() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. |
1254 | ShortVariable | Avoid variables with short names like $ss. Configured minimum length is 3. |
1266 | ShortVariable | Avoid variables with short names like $op. Configured minimum length is 3. |
1300 - 1364 | CyclomaticComplexity | The method value() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10. |
1300 - 1364 | NPathComplexity | The method value() has an NPath complexity of 4860. The configured NPath complexity threshold is 200. |
1302 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1375 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1411 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1440 - 1483 | CyclomaticComplexity | The method func() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. |
1442 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1454 | ShortVariable | Avoid variables with short names like $ss. Configured minimum length is 3. |
1494 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1536 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1544 | ShortVariable | Avoid variables with short names like $ss. Configured minimum length is 3. |
1594 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1687 - 1756 | CyclomaticComplexity | The method string() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. |
1687 - 1756 | NPathComplexity | The method string() has an NPath complexity of 234. The configured NPath complexity threshold is 200. |
1689 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1810 - 1866 | CyclomaticComplexity | The method openString() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. |
1810 - 1866 | NPathComplexity | The method openString() has an NPath complexity of 580. The configured NPath complexity threshold is 200. |
1881 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
1977 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
2053 - 2181 | CyclomaticComplexity | The method selectorSingle() has a Cyclomatic Complexity of 28. The configured cyclomatic complexity threshold is 10. |
2053 - 2181 | NPathComplexity | The method selectorSingle() has an NPath complexity of 516100. The configured NPath complexity threshold is 200. |
2053 - 2181 | ExcessiveMethodLength | The method selectorSingle() has 129 lines of code. Current threshold is set to 100. Avoid really long methods. |
2071 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
2129 | ShortVariable | Avoid variables with short names like $ss. Configured minimum length is 3. |
2192 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
2301 | ShortVariable | Avoid variables with short names like $s. Configured minimum length is 3. |
2368 - 2387 | ShortMethodName | Avoid using short method names like Parser::to(). The configured minimum method name length is 3. |
Constants
Name | Value |
---|---|
SOURCE_INDEX | 1 |
SOURCE_LINE | 2 |
SOURCE_COLUMN | 3 |
Members
private
- $buffer
- $charset
- $count
- $eatWhiteDefault
- $encoding
- $env
- $inParens
- $patternModifiers
- $sourceIndex
- $sourceName
- $sourcePositions
- $utf8
protected
- $commentPattern
- $operatorPattern
- $precedence — array
- $whitePattern
Methods
private
- extractLineNumbers() — Extract line numbers from buffer
- getSourcePosition() — Get source line number and column (given character position in the buffer)
- pregQuote() — Quote regular expression
- restoreEncoding() — Restore internal encoding
- saveEncoding() — Save internal encoding
protected
- append() — Append statement to current block
- appendComment() — Append comment to current block
- argValue() — Parse argument value
- argValues() — Parse argument values
- argumentDef() — Parse mixin/function definition argument list
- argumentList() — Parse function call argument list
- color() — Parse color
- end() — Consume an end of statement delimiter
- expHelper() — Parse left-hand side of subexpression
- expression() — Parse expression
- flattenList() — Turn list of length 1 into value type
- func() — Parse function call
- genericList() — Parse generic list
- interpolation() — Parser interpolation
- keyword() — Parse a keyword
- last() — Returns last child was appended
- literal() — Match literal string
- map() — Parse map
- match() — Try to match something on head of buffer
- matchString() — Match string looking for either ending delim, escape, or string interpolation
- mediaExpression() — Parse media expression
- mediaQuery() — Parse media query
- mediaQueryList() — Parse media query list
- mixedKeyword() — Parse keyword or interpolation
- openString() — Parse an unbounded string stopped by $end
- parenValue() — Parse parenthesized value
- parseChunk() — Parse a single chunk off the head of the buffer and append it to the current parse environment.
- peek() — Peek input stream
- placeholder() — Parse a placeholder
- popBlock() — Pop scope and return last block
- progid() — Parse "progid:"
- propertyName() — Parse property name (as an array of parts or a string)
- pushBlock() — Push block onto parse tree
- pushSpecialBlock() — Push special (named) block onto parse tree
- seek() — Seek to position in input stream (or return current position in input stream)
- selector() — Parse whitespace separated selector list
- selectorSingle() — Parse the parts that make up a selector
- selectors() — Parse comma separated selector list
- show()
- spaceList() — Parse space separated value list
- string() — Parse string
- stripAssignmentFlags() — Strip assignment flag from the list
- stripOptionalFlag() — Strip optional flag from selector list
- to()
- unit() — Parse number with unit
- url() — Parse a url
- value() — Parse value
- valueList() — Parse comma separated value list
- variable() — Parse a variable
- whitespace() — Match some whitespace
public
- __construct() — Constructor
- getSourceName() — Get source file name
- parse() — Parser buffer
- parseSelector() — Parse a selector or selector list
- parseValue() — Parse a value or value list
- throwParseError() — Throw parser error
History
-
2017-05-18T21:45:34+00:00 (commit #62babba)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Pre 3.0.0
-
2017-05-17T09:50:09+00:00 (commit #bcd6e9c)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
PSR-2
-
2017-05-16T19:52:59+00:00 (commit #fd0a296)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
PSR-2 applied
-
2016-01-25T17:45:50+00:00 (commit #97e2af2)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Pre v.3.0
-
2015-04-02T12:09:45+00:00 (commit #80007ff)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Added advertizing. Added SCSS processor.