mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
tint: Add builtin type aliases (vec3f, etc)
Fixed: tint:1772 Change-Id: I4bed36ded91ca5288875ed6ea819ff4bbb432186 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112340 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
5798f2d021
commit
d5d207ba9f
@@ -93,15 +93,26 @@ func (l *lexer) lex() error {
|
||||
case l.match("/", tok.Divide):
|
||||
case l.match(".", tok.Dot):
|
||||
case l.match("->", tok.Arrow):
|
||||
case l.match("fn", tok.Function):
|
||||
case l.match("op", tok.Operator):
|
||||
case l.match("enum", tok.Enum):
|
||||
case l.match("type", tok.Type):
|
||||
case l.match("init", tok.Initializer):
|
||||
case l.match("conv", tok.Converter):
|
||||
case l.match("match", tok.Match):
|
||||
case unicode.IsLetter(l.peek(0)) || l.peek(0) == '_':
|
||||
l.tok(l.count(alphaNumericOrUnderscore), tok.Identifier)
|
||||
n := l.count(alphaNumericOrUnderscore)
|
||||
switch string(l.runes[:n]) {
|
||||
case "fn":
|
||||
l.tok(n, tok.Function)
|
||||
case "op":
|
||||
l.tok(n, tok.Operator)
|
||||
case "enum":
|
||||
l.tok(n, tok.Enum)
|
||||
case "type":
|
||||
l.tok(n, tok.Type)
|
||||
case "init":
|
||||
l.tok(n, tok.Initializer)
|
||||
case "conv":
|
||||
l.tok(n, tok.Converter)
|
||||
case "match":
|
||||
l.tok(n, tok.Match)
|
||||
default:
|
||||
l.tok(n, tok.Identifier)
|
||||
}
|
||||
case unicode.IsNumber(l.peek(0)) || l.peek(0) == '-':
|
||||
isFloat := false
|
||||
isNegative := false
|
||||
|
||||
@@ -84,6 +84,9 @@ func TestLexTokens(t *testing.T) {
|
||||
{"op", []tok.Token{{Kind: tok.Operator, Runes: []rune("op"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}}},
|
||||
{"operation", []tok.Token{{Kind: tok.Identifier, Runes: []rune("operation"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 10, 9),
|
||||
}}}},
|
||||
{"type", []tok.Token{{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}}},
|
||||
|
||||
Reference in New Issue
Block a user