## Tests of the JSONSelect lexer

Simple tokens

    $ JSONSelect._lex(">");
    [1, ">"]
    $ JSONSelect._lex("*");
    [1, "*"]
    $ JSONSelect._lex(",");
    [1, ","]
    $ JSONSelect._lex(".");
    [1, "."]

Offsets

    $ JSONSelect._lex("foobar>",6);
    [7, ">"]

Types

    $ JSONSelect._lex("string");
    [6, 3, "string"]
    $ JSONSelect._lex("boolean");
    [7, 3, "boolean"]
    $ JSONSelect._lex("null");
    [4, 3, "null"]
    $ JSONSelect._lex("array");
    [5, 3, "array"]
    $ JSONSelect._lex("object");
    [6, 3, "object"]
    $ JSONSelect._lex("number");
    [6, 3, "number"]

Whitespace

    $ JSONSelect._lex("\r");
    [1, " "]
    $ JSONSelect._lex("\n");
    [1, " "]
    $ JSONSelect._lex("\t");
    [1, " "]
    $ JSONSelect._lex(" ");
    [1, " "]
    $ JSONSelect._lex("     \t   \r\n  !");
    [13, " "]

pseudo classes

    $ JSONSelect._lex(":root");
    [5, 1, ":root"]
    $ JSONSelect._lex(":first-child");
    [12, 1, ":first-child"]
    $ JSONSelect._lex(":last-child");
    [11, 1, ":last-child"]
    $ JSONSelect._lex(":only-child");
    [11, 1, ":only-child"]

json strings

    $ JSONSelect._lex('"foo bar baz"');
    [13, 4, "foo bar baz"]
    $ JSONSelect._lex('"\\u0020"');
    [8, 4, " "]
    $ JSONSelect._lex('\"not terminated');
    Error: unclosed json string
    $ JSONSelect._lex('"invalid escape: \\y"');
    Error: invalid json string

identifiers (like after '.')

    $ JSONSelect._lex("foo");
    [3, 4, "foo"]
    $ JSONSelect._lex("foo\\ bar");
    [8, 4, "foo bar"]
    $ JSONSelect._lex("_aB129bcde-\\:foo\\@$");
    [18, 4, "_aB129bcde-:foo@"]

non-ascii

    $ JSONSelect._lex("обичам\\ те\\!");
    [12, 4, "обичам те!"]