# All files / src/tokenizer/keyword index.js

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    27x
    27x
    27x

    27x

    27x
    27x

     // @flow
    import Trie from '../../utils/trie';
    import token from '../token';
    import Syntax from '../../Syntax';

    const supported = [
      // EcmaScript
      'break',
      'if',
      'else',
      'import',
      'as',
      'from',
      'export',
      'return',
      'switch',
      'case',
      'default',
      'const',
      'let',
      'for',
      'continue',
      'do',
      'while',
      'function',

      // s-expression
      'global',
      'module',
      'type',
      'lambda',

      // Unsupported
      'catch',
      'extends',
      'super',
      // There is no concept of this in wast
      'this',
      'debugger',
      // vars and lets are replaced with types (i32, f32, etc)
      'var',
      // no classes in wast
      'class',
      'try',
      'finally',
      // Everything is statically typed
      'typeof',
    ];

    const trie = new Trie(supported);
    const root = trie.fsearch;

    export default token(root, Syntax.Keyword, supported);