Add negative number parsing into @test_value

This CL updates the intrinsics lexer to allow negative values for int
and float numerics. This allows doing `@test_value(-2)` in the def file.

Change-Id: I2cad9b25a2932057ce9bc51dec6c32231e06f0a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107440
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair
2022-10-27 18:44:50 +00:00
committed by Dawn LUCI CQ
parent 91ed6f7289
commit c3cbc35650
15 changed files with 162 additions and 94 deletions

View File

@@ -405,9 +405,12 @@ type generator struct {
// eval executes the sub-template with the given name and arguments, returning
// the generated output
// args can be a single argument:
// arg[0]
//
// arg[0]
//
// or a list of name-value pairs:
// (args[0]: name, args[1]: value), (args[2]: name, args[3]: value)...
//
// (args[0]: name, args[1]: value), (args[2]: name, args[3]: value)...
func (g *generator) eval(template string, args ...interface{}) (string, error) {
target := g.t.Lookup(template)
if target == nil {