Skip to content

Commit

Permalink
updated node docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rofrischmann committed Feb 12, 2017
1 parent 14b03ca commit 6389c8a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ ast === {
* [Keyword](docs/ASTNodes.md#keyword)
* [Operator](docs/ASTNodes.md#operator)
* [HexColor](docs/ASTNodes.md#hexcolor)
* [Parenthesis](docs/ASTNodes.md#parenthesis)
* [URL](docs/ASTNodes.md#url)
* [String](docs/ASTNodes.md#string)
* [Dimension](docs/ASTNodes.md#dimension)
Expand Down
12 changes: 12 additions & 0 deletions docs/ASTNodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ body: [ /* child nodes */ ]
* [Keyword](#keyword)
* [Operator](#operator)
* [HexColor](#hexcolor)
* [Parenthesis](#parenthesis)
* [URL](#url)
* [String](#string)
* [Dimension](#dimension)
Expand Down Expand Up @@ -75,6 +76,17 @@ HexColor represents color values given in hexadecimal notation.
}
```

## Parenthesis
Parenthesis are used to wrap expressions. They may used to enforce e.g. additions to be executed before multiplications. Parenthesis surrounding [Functions](#function) will **not** be parsed into AST nodes.

```javascript
// e.g. (
{
type: 'Parenthesis',
value: '('
}
```

## URL
URL is used for any URI-type string. *It is not validated by the parser!*

Expand Down
2 changes: 1 addition & 1 deletion modules/__tests__/parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Parsing CSS values', () => {

expect(parser.parse('(')).toEqual({
body: [{
type: 'Parenthese',
type: 'Parenthesis',
value: '('
}],
type: 'CSSValue'
Expand Down
4 changes: 2 additions & 2 deletions modules/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class Parser {
tokens: Array<Token>;

constructor(options?: Object = {}) {
this.tokenizer = createTokenizer(CSSValueRules, ['whitespace'])
this.tokenizer = createTokenizer(CSSValueRules)
this.options = options
}

Expand Down Expand Up @@ -216,7 +216,7 @@ export default class Parser {
--this.parenBalance
}
return {
type: 'Parenthese',
type: 'Parenthesis',
value: this.currentToken.value
}
}
Expand Down

0 comments on commit 6389c8a

Please sign in to comment.