gonzales-pe
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -61,3 +61,3 @@ #!/usr/bin/env node | ||
syntax: options.syntax, | ||
rule: options.context | ||
context: options.context | ||
}); | ||
@@ -79,4 +79,3 @@ printTree(ast); | ||
ast.traverse(function(node, params) { | ||
lastLevel = params.nestingLevel; | ||
ast.traverse(function(node, i, parent, lastLevel) { | ||
var type = node.type; | ||
@@ -83,0 +82,0 @@ var spaces = new Array(lastLevel).join(' |'); |
@@ -10,2 +10,14 @@ # Changelog | ||
## 18.10.2015, Version 3.1.0 | ||
#### CLI | ||
:green_apple: Fixed passing a `--context` argument. | ||
:green_apple: Fixed printing of a simplified tree. | ||
#### Parsing rules | ||
:star: Added new node type: `keyframesSelector`. | ||
:green_apple: Fixed parsing of keyframes in all syntaxes. | ||
## 18.10.2015, Version 3.0.3 | ||
@@ -12,0 +24,0 @@ |
@@ -45,3 +45,3 @@ // jscs:disable maximumLineLength | ||
if(tokens[i].atrule_l !== undefined)return tokens[i].atrule_l; // If token is part of an @-rule, save the rule's type to token: | ||
if(l = checkAtruler(i))tokens[i].atrule_type = 1; // @-rule with ruleset | ||
if(l = checkKeyframesRule(i))tokens[i].atrule_type = 4;else if(l = checkAtruler(i))tokens[i].atrule_type = 1; // @-rule with ruleset | ||
else if(l = checkAtruleb(i))tokens[i].atrule_type = 2; // Block @-rule | ||
@@ -56,3 +56,3 @@ else if(l = checkAtrules(i))tokens[i].atrule_type = 3; // Single-line @-rule | ||
case 3:return getAtrules(); // Single-line @-rule | ||
}} /** | ||
case 4:return getKeyframesRule();}} /** | ||
* Check if token is part of a block @-rule | ||
@@ -212,3 +212,12 @@ * @param {Number} i Token's index number | ||
* @return {Node} | ||
*/function getImportant(){var type=NodeType.ImportantType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=joinValues(pos,token.importantEnd);pos = token.importantEnd + 1;return newNode(type,content,line,column);} /** | ||
*/function getImportant(){var type=NodeType.ImportantType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=joinValues(pos,token.importantEnd);pos = token.importantEnd + 1;return newNode(type,content,line,column);}function checkKeyframesBlock(i){var start=i;var l=undefined;if(i >= tokensLength)return 0;if(l = checkKeyframesSelector(i))i += l;else return 0;if(l = checkSC(i))i += l;if(l = checkBlock(i))i += l;else return 0;return i - start;}function getKeyframesBlock(){var type=NodeType.RulesetType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=[].concat([getKeyframesSelector()],getSC(),[getBlock()]);return newNode(type,content,line,column);}function checkKeyframesBlocks(i){var start=i;var l=undefined;if(i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket)i++;else return 0;if(l = checkSC(i))i += l;if(l = checkKeyframesBlock(i))i += l;else return 0;while(tokens[i].type !== TokenType.RightCurlyBracket) {if(l = checkSC(i))i += l;else if(l = checkKeyframesBlock(i))i += l;else break;}if(i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket)i++;else return 0;return i - start;}function getKeyframesBlocks(){var type=NodeType.BlockType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=[];var keyframesBlocksEnd=token.right; // Skip `{`. | ||
pos++;while(pos < keyframesBlocksEnd) {if(checkSC(pos))content = content.concat(getSC());else if(checkKeyframesBlock(pos))content.push(getKeyframesBlock());}var end=getLastPosition(content,line,column,1); // Skip `}`. | ||
pos++;return newNode(type,content,line,column,end);} /** | ||
* Check if token is part of a @keyframes rule. | ||
* @param {Number} i Token's index number | ||
* @return {Number} Length of the @keyframes rule | ||
*/function checkKeyframesRule(i){var start=i;var l=undefined;if(i >= tokensLength)return 0;if(l = checkAtkeyword(i))i += l;else return 0;var atruleName=joinValues2(i - l,l);if(atruleName.indexOf('keyframes') === -1)return 0;if(l = checkSC(i))i += l;else return 0;if(l = checkIdent(i))i += l;else return 0;if(l = checkSC(i))i += l;if(l = checkKeyframesBlocks(i))i += l;else return 0;return i - start;} /** | ||
* @return {Node} | ||
*/function getKeyframesRule(){var type=NodeType.AtruleType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=[].concat([getAtkeyword()],getSC(),[getIdent()],getSC(),[getKeyframesBlocks()]);return newNode(type,content,line,column);}function checkKeyframesSelector(i){var start=i;var l=undefined;if(i >= tokensLength)return 0;if(l = checkIdent(i)){ // Valid selectors are only `from` and `to`. | ||
var selector=joinValues2(i,l);if(selector !== 'from' && selector !== 'to')return 0;i += l;tokens[start].keyframesSelectorType = 1;}else if(l = checkPercentage(i)){i += l;tokens[start].keyframesSelectorType = 2;}else {return 0;}return i - start;}function getKeyframesSelector(){var keyframesSelectorType=NodeType.KeyframesSelectorType;var selectorType=NodeType.SelectorType;var token=tokens[pos];var line=token.ln;var column=token.col;var content=[];if(token.keyframesSelectorType === 1){content.push(getIdent());}else {content.push(getPercentage());}var keyframesSelector=newNode(keyframesSelectorType,content,line,column);return newNode(selectorType,[keyframesSelector],line,column);} /** | ||
* Check if token is a namespace sign (`|`) | ||
@@ -215,0 +224,0 @@ * @param {Number} i Token's index number |
@@ -1,1 +0,1 @@ | ||
'use strict';module.exports = {ArgumentsType:'arguments',AtkeywordType:'atkeyword',AtruleType:'atrule',AttributeSelectorType:'attributeSelector',AttributeNameType:'attributeName',AttributeFlagsType:'attributeFlags',AttributeMatchType:'attributeMatch',AttributeValueType:'attributeValue',BlockType:'block',BracketsType:'brackets',ClassType:'class',CombinatorType:'combinator',CommentMLType:'multilineComment',CommentSLType:'singlelineComment',ConditionType:'condition',ConditionalStatementType:'conditionalStatement',DeclarationType:'declaration',DeclDelimType:'declarationDelimiter',DefaultType:'default',DelimType:'delimiter',DimensionType:'dimension',EscapedStringType:'escapedString',ExtendType:'extend',ExpressionType:'expression',FunctionType:'function',GlobalType:'global',IdentType:'ident',ImportantType:'important',IncludeType:'include',InterpolationType:'interpolation',InterpolatedVariableType:'interpolatedVariable',LoopType:'loop',MixinType:'mixin',NamePrefixType:'namePrefix',NamespacePrefixType:'namespacePrefix',NamespaceSeparatorType:'namespaceSeparator',NumberType:'number',OperatorType:'operator',OptionalType:'optional',ParenthesesType:'parentheses',ParentSelectorType:'parentSelector',PercentageType:'percentage',PlaceholderType:'placeholder',ProgidType:'progid',PropertyType:'property',PropertyDelimType:'propertyDelimiter',PseudocType:'pseudoClass',PseudoeType:'pseudoElement',RawType:'raw',RulesetType:'ruleset',SType:'space',SelectorType:'selector',ShashType:'id',StringType:'string',StylesheetType:'stylesheet',TypeSelectorType:'typeSelector',UriType:'uri',ValueType:'value',VariableType:'variable',VariablesListType:'variablesList',VhashType:'color'}; | ||
'use strict';module.exports = {ArgumentsType:'arguments',AtkeywordType:'atkeyword',AtruleType:'atrule',AttributeSelectorType:'attributeSelector',AttributeNameType:'attributeName',AttributeFlagsType:'attributeFlags',AttributeMatchType:'attributeMatch',AttributeValueType:'attributeValue',BlockType:'block',BracketsType:'brackets',ClassType:'class',CombinatorType:'combinator',CommentMLType:'multilineComment',CommentSLType:'singlelineComment',ConditionType:'condition',ConditionalStatementType:'conditionalStatement',DeclarationType:'declaration',DeclDelimType:'declarationDelimiter',DefaultType:'default',DelimType:'delimiter',DimensionType:'dimension',EscapedStringType:'escapedString',ExtendType:'extend',ExpressionType:'expression',FunctionType:'function',GlobalType:'global',IdentType:'ident',ImportantType:'important',IncludeType:'include',InterpolationType:'interpolation',InterpolatedVariableType:'interpolatedVariable',KeyframesSelectorType:'keyframesSelector',LoopType:'loop',MixinType:'mixin',NamePrefixType:'namePrefix',NamespacePrefixType:'namespacePrefix',NamespaceSeparatorType:'namespaceSeparator',NumberType:'number',OperatorType:'operator',OptionalType:'optional',ParenthesesType:'parentheses',ParentSelectorType:'parentSelector',PercentageType:'percentage',PlaceholderType:'placeholder',ProgidType:'progid',PropertyType:'property',PropertyDelimType:'propertyDelimiter',PseudocType:'pseudoClass',PseudoeType:'pseudoElement',RawType:'raw',RulesetType:'ruleset',SType:'space',SelectorType:'selector',ShashType:'id',StringType:'string',StylesheetType:'stylesheet',TypeSelectorType:'typeSelector',UriType:'uri',ValueType:'value',VariableType:'variable',VariablesListType:'variablesList',VhashType:'color'}; |
{ | ||
"name": "gonzales-pe", | ||
"description": "Gonzales Preprocessor Edition (fast CSS parser)", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"homepage": "http://github.com/tonyganch/gonzales-pe", | ||
@@ -6,0 +6,0 @@ "bugs": "http://github.com/tonyganch/gonzales-pe/issues", |
@@ -1,4 +0,4 @@ | ||
# Gonzales PE @dev | ||
# Gonzales PE @3.1.0 | ||
[![Build Status](https://travis-ci.org/tonyganch/gonzales-pe.svg)] | ||
[![Build Status](https://travis-ci.org/tonyganch/gonzales-pe.svg?branch=3.0)] | ||
(https://travis-ci.org/tonyganch/gonzales-pe) | ||
@@ -14,3 +14,3 @@ | ||
```bash | ||
npm install -g git://github.com/tonyganch/gonzales-pe.git#dev | ||
npm install -g gonzales-pe@3.1.0 | ||
``` | ||
@@ -21,3 +21,3 @@ | ||
```bash | ||
npm install --save git://github.com/tonyganch/gonzales-pe.git#dev | ||
npm install --save gonzales-pe@3.1.0 | ||
``` | ||
@@ -30,4 +30,4 @@ | ||
git clone git@github.com:tonyganch/gonzales-pe.git | ||
# Go to dev branch. | ||
git checkout dev | ||
# Go to `3.0` branch. | ||
git checkout 3.0 | ||
# Install project dependencies. | ||
@@ -34,0 +34,0 @@ npm install |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
410302
3484