main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
811 bytes
|
Line | |
---|
1 | var consumeNumber = require('../../tokenizer/utils').consumeNumber;
|
---|
2 | var TYPE = require('../../tokenizer').TYPE;
|
---|
3 |
|
---|
4 | var DIMENSION = TYPE.Dimension;
|
---|
5 |
|
---|
6 | module.exports = {
|
---|
7 | name: 'Dimension',
|
---|
8 | structure: {
|
---|
9 | value: String,
|
---|
10 | unit: String
|
---|
11 | },
|
---|
12 | parse: function() {
|
---|
13 | var start = this.scanner.tokenStart;
|
---|
14 | var numberEnd = consumeNumber(this.scanner.source, start);
|
---|
15 |
|
---|
16 | this.eat(DIMENSION);
|
---|
17 |
|
---|
18 | return {
|
---|
19 | type: 'Dimension',
|
---|
20 | loc: this.getLocation(start, this.scanner.tokenStart),
|
---|
21 | value: this.scanner.source.substring(start, numberEnd),
|
---|
22 | unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
|
---|
23 | };
|
---|
24 | },
|
---|
25 | generate: function(node) {
|
---|
26 | this.chunk(node.value);
|
---|
27 | this.chunk(node.unit);
|
---|
28 | }
|
---|
29 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.