Skip to content
Snippets Groups Projects
Commit 34f90e69 authored by Daniel Martin's avatar Daniel Martin
Browse files

Improve lexer with better string handling and grouping parens/brackets

This allows the lexer to correctly handle strings like:
    ${'backslash quote right-curly is \\\'}'}

And also allows users to use the bitwise-or operator to mean bitwise or
simply by enclosing the expression inside parens:
    ${(0x5432 | 0x8000)}

or by using it in the middle of a dictionary literal:
    ${ {'foo-val': 0x43 | 0x100, 'bar-val': 0x22 | 0x100}[thing+'-val']}

or inside brackets:
    ${ big_lookup_dict[index_low | (indexhigh << 3)] }

Basically, only "top level" uses of the vertical bar mean pipe.

(Note that currently, any non-top-level use of the vertical bar in
an expression just results in a syntax error in the generated python,
so no working code is affected by this change)
parent 1cfcf16f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment