Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
703 bytes
|
Line | |
---|
1 | var consumeNumber = require('../../tokenizer/utils').consumeNumber;
|
---|
2 | var TYPE = require('../../tokenizer').TYPE;
|
---|
3 |
|
---|
4 | var PERCENTAGE = TYPE.Percentage;
|
---|
5 |
|
---|
6 | module.exports = {
|
---|
7 | name: 'Percentage',
|
---|
8 | structure: {
|
---|
9 | value: String
|
---|
10 | },
|
---|
11 | parse: function() {
|
---|
12 | var start = this.scanner.tokenStart;
|
---|
13 | var numberEnd = consumeNumber(this.scanner.source, start);
|
---|
14 |
|
---|
15 | this.eat(PERCENTAGE);
|
---|
16 |
|
---|
17 | return {
|
---|
18 | type: 'Percentage',
|
---|
19 | loc: this.getLocation(start, this.scanner.tokenStart),
|
---|
20 | value: this.scanner.source.substring(start, numberEnd)
|
---|
21 | };
|
---|
22 | },
|
---|
23 | generate: function(node) {
|
---|
24 | this.chunk(node.value);
|
---|
25 | this.chunk('%');
|
---|
26 | }
|
---|
27 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.