You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
393 B
JavaScript

"use strict";
const { wholeMatch, optional } = require("../../operations");
const Digits = require("./digits");
module.exports = function* Decimal() {
// NOTE: this gets converted to a floating point value!
let decimalString = yield wholeMatch(function* () {
yield Digits;
yield optional(function* () {
yield ".";
yield Digits;
});
});
return parseFloat(decimalString);
};