Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC: [makeTransition(/[0-9]/, "DEC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "DEC_FRAC"), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC_SIGNED_EXP: [makeTransition(/\+|-/, "DEC_EXP"), makeTransition(/[0-9]/, "DEC_EXP")],
DEC_EXP: [makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})],
HEX: [makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "HEX_FRAC"), makeTransition(/p|P/, "HEX_SIGNED_EXP")],
HEX_FRAC: [makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/p|P|/, "HEX_SIGNED_EXP")],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})],
NAN_HEX: [makeTransition(/[0-9|A-F|a-f]/, "NAN_HEX", {
allowedSeparator: NUMERIC_SEPARATOR
})],
STOP: []
}, "START", "STOP");
export function tokenize(input) {
var current = 0;
var char = input[current]; // Used by SourceLocation
var column = 1;
var line = 1;
var tokens = [];
/**
makeTransition(/p|P/, "HEX_SIGNED_EXP")
],
HEX_FRAC: [
makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/p|P|/, "HEX_SIGNED_EXP")
],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [
makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
NAN_HEX: [
makeTransition(/[0-9|A-F|a-f]/, "NAN_HEX", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
STOP: []
},
"START",
"STOP"
);
export function tokenize(input: string) {
let current: number = 0;
let char = input[current];
// Used by SourceLocation
let column = 1;
let line = 1;
makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
HEX: [
makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/\./, "HEX_FRAC"),
makeTransition(/p|P/, "HEX_SIGNED_EXP")
],
HEX_FRAC: [
makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/p|P|/, "HEX_SIGNED_EXP")
],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [
makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
NAN_HEX: [
makeTransition(/[0-9|A-F|a-f]/, "NAN_HEX", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
STOP: []
},
"START",
"STOP"
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
}), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC: [makeTransition(/[0-9]/, "DEC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "DEC_FRAC"), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC_SIGNED_EXP: [makeTransition(/\+|-/, "DEC_EXP"), makeTransition(/[0-9]/, "DEC_EXP")],
DEC_EXP: [makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})],
HEX: [makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "HEX_FRAC"), makeTransition(/p|P/, "HEX_SIGNED_EXP")],
HEX_FRAC: [makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/p|P|/, "HEX_SIGNED_EXP")],
})
],
HEX: [
makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/\./, "HEX_FRAC"),
makeTransition(/p|P/, "HEX_SIGNED_EXP")
],
HEX_FRAC: [
makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/p|P|/, "HEX_SIGNED_EXP")
],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [
makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
NAN_HEX: [
makeTransition(/[0-9|A-F|a-f]/, "NAN_HEX", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
STOP: []
},
"START",
"STOP"
);
| "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")
],
DEC_FRAC: [
makeTransition(/[0-9]/, "DEC_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC: [
makeTransition(/[0-9]/, "DEC", { allowedSeparator: NUMERIC_SEPARATOR }),
makeTransition(/\./, "DEC_FRAC"),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
makeTransition(/\./, "DEC_FRAC")
],
DEC_FRAC: [
makeTransition(/[0-9]/, "DEC_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC: [
makeTransition(/[0-9]/, "DEC", { allowedSeparator: NUMERIC_SEPARATOR }),
makeTransition(/\./, "DEC_FRAC"),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC_SIGNED_EXP: [
makeTransition(/\+|-/, "DEC_EXP"),
makeTransition(/[0-9]/, "DEC_EXP")
],
DEC_EXP: [
makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
HEX: [
makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/\./, "HEX_FRAC"),
makeTransition(/p|P/, "HEX_SIGNED_EXP")
],
HEX_FRAC: [
makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
],
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
}),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC: [
makeTransition(/[0-9]/, "DEC", { allowedSeparator: NUMERIC_SEPARATOR }),
makeTransition(/\./, "DEC_FRAC"),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC_SIGNED_EXP: [
makeTransition(/\+|-/, "DEC_EXP"),
makeTransition(/[0-9]/, "DEC_EXP")
],
DEC_EXP: [
makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
HEX: [
makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}),
}), 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
}), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC: [makeTransition(/[0-9]/, "DEC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "DEC_FRAC"), makeTransition(/e|E/, "DEC_SIGNED_EXP")],
DEC_SIGNED_EXP: [makeTransition(/\+|-/, "DEC_EXP"), makeTransition(/[0-9]/, "DEC_EXP")],
DEC_EXP: [makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})],
HEX: [makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/\./, "HEX_FRAC"), makeTransition(/p|P/, "HEX_SIGNED_EXP")],
HEX_FRAC: [makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}), makeTransition(/p|P|/, "HEX_SIGNED_EXP")],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})],
NAN_HEX: [makeTransition(/[0-9|A-F|a-f]/, "NAN_HEX", {
allowedSeparator: NUMERIC_SEPARATOR
})],
STOP: []
}, "START", "STOP");
export function tokenize(input) {
var current = 0;
DEC: [
makeTransition(/[0-9]/, "DEC", { allowedSeparator: NUMERIC_SEPARATOR }),
makeTransition(/\./, "DEC_FRAC"),
makeTransition(/e|E/, "DEC_SIGNED_EXP")
],
DEC_SIGNED_EXP: [
makeTransition(/\+|-/, "DEC_EXP"),
makeTransition(/[0-9]/, "DEC_EXP")
],
DEC_EXP: [
makeTransition(/[0-9]/, "DEC_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})
],
HEX: [
makeTransition(/[0-9|A-F|a-f]/, "HEX", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/\./, "HEX_FRAC"),
makeTransition(/p|P/, "HEX_SIGNED_EXP")
],
HEX_FRAC: [
makeTransition(/[0-9|A-F|a-f]/, "HEX_FRAC", {
allowedSeparator: NUMERIC_SEPARATOR
}),
makeTransition(/p|P|/, "HEX_SIGNED_EXP")
],
HEX_SIGNED_EXP: [makeTransition(/[0-9|+|-]/, "HEX_EXP")],
HEX_EXP: [
makeTransition(/[0-9]/, "HEX_EXP", {
allowedSeparator: NUMERIC_SEPARATOR
})