Project: expression-editor
Task (challenging): # Target
Use JavaScript to implement a `tokenize` function in `parser.js` and export `tokenize` with ESM named export.

CAUTION: I want the file to be implemented with JavaScript but NOT TypeScript, and the filename should be `parser.js`.

# Technical Design Document
To complete the target, let's dig it deeper.

## `tokenize` function implemention detail

`tokenize` receive a `string` as input, and return `Token[]` as output.

### Constraints

Ignore all tab、whitespaces、newlines

### Token Types

I'll give you the TypeScript type definitions for your convenience.

```ts
type Token = Identifier | Operator | LeftParen | RightParen

type Identifier = {
  type: 'identifier';
  from: number;
  to: number;
  value: string;
}

type Operator = {
  type: 'operator';
  from: number;
  to: number;
  value: 'AND' | 'OR';
}

type LeftParen = {
  type: 'lparen';
  from: number;
  to: number;
}

type RightParen = {
  type: 'rparen';
  from: number;
  to: number;
}
```

### Examples
Besides these, here are some examples for you to better understand the tokenize result.
<examples>
  <example source="" description="empty source">
    ```js
    []
    ```
  </example>

  <example source="foo" description="Single identifier">
    ```js
    [
      {
        type: 'identifier',
        from: 0,
        to: 3,
        value: 'foo'
      }
    ]
    ```
  </example>

  <example source="foo AND bar" description="Use AND with two identifiers">
    ```js
    [
      {
        type: 'identifier',
        from: 0,
        to: 3,
        value: 'foo'
      },
      {
        type: 'operator',
        from: 4,
        to: 7,
        value: 'AND'
      },
      {
        type: 'identifier',
        from: 8,
        to: 11,
        value: 'bar'
      }
    ]
    ```
  </example>

  <example source="foo OR (bar OR baz)" description="Compound expression with parens">
    ```js
    [
      {
        type: 'identifier',
        from: 0,
        to: 3,
        value: 'foo'
      },
      {
        type: 'operator',
        from: 4,
        to: 6,
        value: 'OR'
      },
      {
        type: 'lparen',
        from: 7,
        to: 8,
      },
      {
        type: 'identifier',
        from: 8,
        to: 11,
        value: 'bar'
      },
      {
        type: 'operator',
        from: 12,
        to: 14,
        value: 'OR'
      },
      {
        type: 'identifier',
        from: 15,
        to: 18,
        value: 'baz'
      },
      {
        type: 'rparen',
        from: 18,
        to: 19,
      },
    ]
    ```
  </example>
</examples>