Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
type NumberLiteralState =
| "START"
| "AFTER_SIGN"
| "HEX"
| "HEX_FRAC"
| "NAN_HEX"
| "DEC"
| "DEC_EXP"
| "DEC_FRAC"
| "DEC_SIGNED_EXP"
| "STOP"
| "HEX_SIGNED_EXP"
| "HEX_EXP";
const numberLiteralFSM: FSM = new FSM(
{
START: [
makeTransition(/-|\+/, "AFTER_SIGN"),
makeTransition(/nan:0x/, "NAN_HEX", { n: 6 }),
makeTransition(/nan|inf/, "STOP", { n: 3 }),
makeTransition(/0x/, "HEX", { n: 2 }),
makeTransition(/[0-9]/, "DEC"),
makeTransition(/\./, "DEC_FRAC")
],
AFTER_SIGN: [
makeTransition(/nan:0x/, "NAN_HEX", { n: 6 }),
makeTransition(/nan|inf/, "STOP", { n: 3 }),
makeTransition(/0x/, "HEX", { n: 2 }),
makeTransition(/[0-9]/, "DEC"),
makeTransition(/\./, "DEC_FRAC")
],
global: "global",
anyfunc: "anyfunc",
mut: "mut",
data: "data",
type: "type",
elem: "elem",
start: "start",
offset: "offset"
};
exports.keywords = keywords;
var NUMERIC_SEPARATOR = "_";
/**
* Build the FSM for number literals
*/
var numberLiteralFSM = new _helperFsm.FSM({
START: [(0, _helperFsm.makeTransition)(/-|\+/, "AFTER_SIGN"), (0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
n: 6
}), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
n: 3
}), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
n: 2
}), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
AFTER_SIGN: [(0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
n: 6
}), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
n: 3
}), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
n: 2
}), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
DEC_FRAC: [(0, _helperFsm.makeTransition)(/[0-9]/, "DEC_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
table: "table",
global: "global",
anyfunc: "anyfunc",
mut: "mut",
data: "data",
type: "type",
elem: "elem",
start: "start",
offset: "offset"
};
var NUMERIC_SEPARATOR = "_";
/**
* Build the FSM for number literals
*/
var numberLiteralFSM = new FSM({
START: [makeTransition(/-|\+/, "AFTER_SIGN"), makeTransition(/nan:0x/, "NAN_HEX", {
n: 6
}), makeTransition(/nan|inf/, "STOP", {
n: 3
}), makeTransition(/0x/, "HEX", {
n: 2
}), makeTransition(/[0-9]/, "DEC"), makeTransition(/\./, "DEC_FRAC")],
AFTER_SIGN: [makeTransition(/nan:0x/, "NAN_HEX", {
n: 6
}), makeTransition(/nan|inf/, "STOP", {
n: 3
}), makeTransition(/0x/, "HEX", {
n: 2
}), makeTransition(/[0-9]/, "DEC"), makeTransition(/\./, "DEC_FRAC")],
DEC_FRAC: [makeTransition(/[0-9]/, "DEC_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
global: "global",
anyfunc: "anyfunc",
mut: "mut",
data: "data",
type: "type",
elem: "elem",
start: "start",
offset: "offset"
};
exports.keywords = keywords;
var NUMERIC_SEPARATOR = "_";
/**
* Build the FSM for number literals
*/
var numberLiteralFSM = new _helperFsm.FSM({
START: [(0, _helperFsm.makeTransition)(/-|\+/, "AFTER_SIGN"), (0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
n: 6
}), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
n: 3
}), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
n: 2
}), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
AFTER_SIGN: [(0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
n: 6
}), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
n: 3
}), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
n: 2
}), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
DEC_FRAC: [(0, _helperFsm.makeTransition)(/[0-9]/, "DEC_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR