mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 17:19:31 +08:00
27 lines
703 B
Text
27 lines
703 B
Text
var consumeNumber = require('../../tokenizer/utils').consumeNumber;
|
|
var TYPE = require('../../tokenizer').TYPE;
|
|
|
|
var PERCENTAGE = TYPE.Percentage;
|
|
|
|
module.exports = {
|
|
name: 'Percentage',
|
|
structure: {
|
|
value: String
|
|
},
|
|
parse: function() {
|
|
var start = this.scanner.tokenStart;
|
|
var numberEnd = consumeNumber(this.scanner.source, start);
|
|
|
|
this.eat(PERCENTAGE);
|
|
|
|
return {
|
|
type: 'Percentage',
|
|
loc: this.getLocation(start, this.scanner.tokenStart),
|
|
value: this.scanner.source.substring(start, numberEnd)
|
|
};
|
|
},
|
|
generate: function(node) {
|
|
this.chunk(node.value);
|
|
this.chunk('%');
|
|
}
|
|
};
|