Compare commits
No commits in common. "419c3651bf26d20cc9de7433ae27bc1e219cfed7" and "b7bdaba69418ba0e7e169f697d5d47bde6c3cd2e" have entirely different histories.
419c3651bf
...
b7bdaba694
@ -627,7 +627,7 @@ func (this *Generator) generateDecodeValue(typ Type, typeName, valueSource, tagS
|
|||||||
case TypeTable:
|
case TypeTable:
|
||||||
// KTV: <length: UN> (<key: U16> <tag: Tag> <value>)*
|
// KTV: <length: UN> (<key: U16> <tag: Tag> <value>)*
|
||||||
nn, err := this.iprintf(
|
nn, err := this.iprintf(
|
||||||
"nn, err = tape.DecodeAnyInto(decoder, %s, %s)\n",
|
"nn, err = tape.DecodeAny(decoder, %s, %s)\n",
|
||||||
valueSource, tagSource)
|
valueSource, tagSource)
|
||||||
n += nn; if err != nil { return n, err }
|
n += nn; if err != nil { return n, err }
|
||||||
nn, err = this.generateErrorCheck()
|
nn, err = this.generateErrorCheck()
|
||||||
|
@ -116,7 +116,6 @@ func (this *parser) parseType() (Type, error) {
|
|||||||
case "String": return TypeString { }, this.Next()
|
case "String": return TypeString { }, this.Next()
|
||||||
case "Buffer": return TypeBuffer { }, this.Next()
|
case "Buffer": return TypeBuffer { }, this.Next()
|
||||||
case "Table": return TypeTable { }, this.Next()
|
case "Table": return TypeTable { }, this.Next()
|
||||||
case "Any": return TypeAny { }, this.Next()
|
|
||||||
}
|
}
|
||||||
return this.parseTypeNamed()
|
return this.parseTypeNamed()
|
||||||
case TokenLBracket:
|
case TokenLBracket:
|
||||||
|
@ -31,7 +31,6 @@ func TestParse(test *testing.T) {
|
|||||||
0x0002: Field { Name: "Followers", Type: TypeInt { Bits: 32 } },
|
0x0002: Field { Name: "Followers", Type: TypeInt { Bits: 32 } },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
correct.Types["Anything"] = TypeAny { }
|
|
||||||
test.Log("CORRECT:", &correct)
|
test.Log("CORRECT:", &correct)
|
||||||
|
|
||||||
got, err := ParseReader("test.pdl", strings.NewReader(`
|
got, err := ParseReader("test.pdl", strings.NewReader(`
|
||||||
@ -49,8 +48,6 @@ func TestParse(test *testing.T) {
|
|||||||
0001 Bio String,
|
0001 Bio String,
|
||||||
0002 Followers U32,
|
0002 Followers U32,
|
||||||
}
|
}
|
||||||
|
|
||||||
Anything Any
|
|
||||||
`))
|
`))
|
||||||
if err != nil { test.Fatal(parse.Format(err)) }
|
if err != nil { test.Fatal(parse.Format(err)) }
|
||||||
test.Log("GOT: ", got)
|
test.Log("GOT: ", got)
|
||||||
|
@ -99,12 +99,6 @@ func (typ TypeNamed) String() string {
|
|||||||
return typ.Name
|
return typ.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
type TypeAny struct { }
|
|
||||||
|
|
||||||
func (typ TypeAny) String() string {
|
|
||||||
return "Any"
|
|
||||||
}
|
|
||||||
|
|
||||||
func HashType(typ Type) [16]byte {
|
func HashType(typ Type) [16]byte {
|
||||||
// TODO: if we ever want to make the compiler more efficient, this would
|
// TODO: if we ever want to make the compiler more efficient, this would
|
||||||
// be a good place to start, complex string concatenation in a hot path
|
// be a good place to start, complex string concatenation in a hot path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user