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

100% Statements 13/13
100% Branches 10/10
100% Functions 3/3
100% Lines 13/13

    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
    28x
    28x
    28x
    28x
    28x
    28x

    28x

    27483x

    28x
    17177x

    28x
    10306x

    28x

     // @flow
    import token from "../token";
    import punctuator from "../punctuator";
    import constant from "../constant";
    import string from "../string";
    import Syntax from "../../Syntax";
    import Stream from "../../utils/stream";

    const isValidIdentifier = char => {
      // Don't allow these
      return (
        !string(char) && !punctuator(char) && !Stream.eol(char) && char !== " "
      );
    };

    const supportAny = char => {
      return isValidIdentifier(char) ? supportAny : null;
    };

    const parse = char => {
      return isValidIdentifier(char) && !constant(char) ? supportAny : null;
    };
    const tokenParser = token(parse, Syntax.Identifier);
    export default tokenParser;