How to use @webassemblyjs/helper-fsm - 10 common examples

To help you get started, we’ve selected a few @webassemblyjs/helper-fsm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wast-parser / esm / tokenizer.js View on Github external
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 = [];
  /**
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
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;
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
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"
github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wast-parser / esm / tokenizer.js View on Github external
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")],
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
})
    ],
    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"
);
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
| "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")
    ],
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
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
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
],
    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
      }),
github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wast-parser / esm / tokenizer.js View on Github external
}), 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;
github xtuc / webassemblyjs / packages / wast-parser / src / tokenizer.js View on Github external
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
      })

@webassemblyjs/helper-fsm

FSM implementation

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis

Similar packages