Hi all,

I've written a patch to extend FileCheck to support matching

arithmetic expressions involving variable [1] (eg. to match REG+1

where REG is a variable with a numeric value). It was suggested to me

in the review to introduce the concept of numeric variable and to

allow for specifying the base the value are written in.

[1] ⚙ D49084 FileCheck: Add support for numeric variables and expressions

I think the syntax should satisfy the below requirements:

* based off the [] construct since anything else might overload an

existing valid syntax (eg. $$ is supposed to match literally now)

* consistent with syntax for expressions using @LINE

* consistent with using ':' to define regular variable

* allows to specify base of the number a numeric variable is being set to

* allows to specify base of the result of the numeric expression

I've come up with the following syntax for which I'd like feedback:

Numeric variable definition: [[#X<base:]] (eg. [[#ADDR<16:]]) where X

is the numeric variable being defined and <base is optional in which

case base defaults to 10

Numeric variable use: [[#X>base]] (eg. [[#ADDR]]>2) where <base is

optional in which case base defaults 10

Numeric expression: [[exp>base]] (eg. [[#ADDR+2>16]] where expression

must contain at least one numeric variable

I'm not a big fan of the > for the output base being inside the

expression but [[exp]]>base would match >base literally.

Any suggestions / opinions?

Best regards,

Thomas