|
|
|
@ -95,6 +95,28 @@ func (this *parser) parseType() (Type, error) {
|
|
|
|
|
|
|
|
|
|
|
|
switch this.Kind() {
|
|
|
|
switch this.Kind() {
|
|
|
|
case TokenIdent:
|
|
|
|
case TokenIdent:
|
|
|
|
|
|
|
|
switch this.Value() {
|
|
|
|
|
|
|
|
case "U8": return TypeInt { Bits: 8 }, this.Next()
|
|
|
|
|
|
|
|
case "U16": return TypeInt { Bits: 16 }, this.Next()
|
|
|
|
|
|
|
|
case "U32": return TypeInt { Bits: 32 }, this.Next()
|
|
|
|
|
|
|
|
case "U64": return TypeInt { Bits: 64 }, this.Next()
|
|
|
|
|
|
|
|
case "U128": return TypeInt { Bits: 128 }, this.Next()
|
|
|
|
|
|
|
|
case "U256": return TypeInt { Bits: 256 }, this.Next()
|
|
|
|
|
|
|
|
case "I8": return TypeInt { Bits: 8, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "I16": return TypeInt { Bits: 16, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "I32": return TypeInt { Bits: 32, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "I64": return TypeInt { Bits: 64, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "I128": return TypeInt { Bits: 128, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "I256": return TypeInt { Bits: 256, Signed: true }, this.Next()
|
|
|
|
|
|
|
|
case "F16": return TypeFloat { Bits: 16 }, this.Next()
|
|
|
|
|
|
|
|
case "F32": return TypeFloat { Bits: 32 }, this.Next()
|
|
|
|
|
|
|
|
case "F64": return TypeFloat { Bits: 64 }, this.Next()
|
|
|
|
|
|
|
|
case "F128": return TypeFloat { Bits: 128 }, this.Next()
|
|
|
|
|
|
|
|
case "F256": return TypeFloat { Bits: 256 }, this.Next()
|
|
|
|
|
|
|
|
case "String": return TypeString { }, this.Next()
|
|
|
|
|
|
|
|
case "Buffer": return TypeBuffer { }, this.Next()
|
|
|
|
|
|
|
|
case "Table": return TypeTable { }, this.Next()
|
|
|
|
|
|
|
|
}
|
|
|
|
return this.parseTypeNamed()
|
|
|
|
return this.parseTypeNamed()
|
|
|
|
case TokenLBracket:
|
|
|
|
case TokenLBracket:
|
|
|
|
return this.parseTypeArray()
|
|
|
|
return this.parseTypeArray()
|
|
|
|
|