Skip to content

Commit

Permalink
Merge pull request #62 from jensneuse/add-byteslices-single-linked-list
Browse files Browse the repository at this point in the history
Add byteslices single linked list
  • Loading branch information
jensneuse authored Apr 8, 2019
2 parents c18ac36 + 58e7088 commit b12e8b8
Show file tree
Hide file tree
Showing 39 changed files with 685 additions and 336 deletions.
2 changes: 1 addition & 1 deletion pkg/document/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (a Argument) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (a Argument) NodeImplementsInterfaces() []int {
func (a Argument) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/argumentsdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (a ArgumentsDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (a ArgumentsDefinition) NodeImplementsInterfaces() []int {
func (a ArgumentsDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
40 changes: 38 additions & 2 deletions pkg/document/byteslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,46 @@ func (b ByteSlice) MarshalJSON() ([]byte, error) {
}

type ByteSliceReference struct {
Start uint32
End uint32
Start uint32
End uint32
NextRef int
}

func (b ByteSliceReference) Length() uint32 {
return b.End - b.Start
}

type ByteSliceReferenceGetter interface {
ByteSliceReference(ref int) ByteSliceReference
}

type ByteSliceReferences struct {
nextRef int
currentRef int
current ByteSliceReference
}

func NewByteSliceReferences(nextRef int) ByteSliceReferences {
return ByteSliceReferences{
nextRef: nextRef,
}
}

func (i *ByteSliceReferences) HasNext() bool {
return i.nextRef != -1
}

func (i *ByteSliceReferences) Next(getter ByteSliceReferenceGetter) bool {
if i.nextRef == -1 {
return false
}

i.currentRef = i.nextRef
i.current = getter.ByteSliceReference(i.nextRef)
i.nextRef = i.current.NextRef
return true
}

func (i *ByteSliceReferences) Value() (ByteSliceReference, int) {
return i.current, i.currentRef
}
2 changes: 1 addition & 1 deletion pkg/document/directivedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (d DirectiveDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (d DirectiveDefinition) NodeImplementsInterfaces() []int {
func (d DirectiveDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/directives.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (d Directive) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (d Directive) NodeImplementsInterfaces() []int {
func (d Directive) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/enumtypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (e EnumTypeDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (e EnumTypeDefinition) NodeImplementsInterfaces() []int {
func (e EnumTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/enumvaluedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (e EnumValueDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (e EnumValueDefinition) NodeImplementsInterfaces() []int {
func (e EnumValueDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (f Field) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (f Field) NodeImplementsInterfaces() []int {
func (f Field) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/fielddefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (f FieldDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (f FieldDefinition) NodeImplementsInterfaces() []int {
func (f FieldDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/fragmentdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (f FragmentDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (f FragmentDefinition) NodeImplementsInterfaces() []int {
func (f FragmentDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/fragmentspread.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (f FragmentSpread) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (f FragmentSpread) NodeImplementsInterfaces() []int {
func (f FragmentSpread) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/implementsinterfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package document

// ImplementsInterfaces as specified in:
// http://facebook.github.io/graphql/draft/#ImplementsInterfaces
type ImplementsInterfaces []int
type ImplementsInterfaces ByteSliceReferences
2 changes: 1 addition & 1 deletion pkg/document/inlinefragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (i InlineFragment) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (i InlineFragment) NodeImplementsInterfaces() []int {
func (i InlineFragment) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/inputfieldsdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (i InputFieldsDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (i InputFieldsDefinition) NodeImplementsInterfaces() []int {
func (i InputFieldsDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/inputobjecttypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (i InputObjectTypeDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (i InputObjectTypeDefinition) NodeImplementsInterfaces() []int {
func (i InputObjectTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/inputvaluedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (i InputValueDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (i InputValueDefinition) NodeImplementsInterfaces() []int {
func (i InputValueDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/interfacetypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (i InterfaceTypeDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (i InterfaceTypeDefinition) NodeImplementsInterfaces() []int {
func (i InterfaceTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Node interface {
NodeOperationType() OperationType
NodeValue() int
NodeDefaultValue() int
NodeImplementsInterfaces() []int
NodeImplementsInterfaces() ByteSliceReferences
InputValueDefinitionsNode
UnionTypeSystemDefinitionNode
ValueNode
Expand Down
2 changes: 1 addition & 1 deletion pkg/document/objectfield.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (o ObjectField) NodeDefaultValue() int {
panic("implement me")
}

func (o ObjectField) NodeImplementsInterfaces() []int {
func (o ObjectField) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/document/objecttypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type ObjectTypeDefinition struct {
Description ByteSliceReference
Name ByteSliceReference
FieldsDefinition FieldDefinitions
ImplementsInterfaces ImplementsInterfaces
ImplementsInterfaces ByteSliceReferences
DirectiveSet int
Position position.Position
}
Expand Down Expand Up @@ -73,7 +73,7 @@ func (o ObjectTypeDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (o ObjectTypeDefinition) NodeImplementsInterfaces() []int {
func (o ObjectTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
return o.ImplementsInterfaces
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/operationdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (o OperationDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (o OperationDefinition) NodeImplementsInterfaces() []int {
func (o OperationDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/scalartypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s ScalarTypeDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (s ScalarTypeDefinition) NodeImplementsInterfaces() []int {
func (s ScalarTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/schemadefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (s SchemaDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (s SchemaDefinition) NodeImplementsInterfaces() []int {
func (s SchemaDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/selectionset.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s SelectionSet) NodeDefaultValue() int {
panic("implement me")
}

func (s SelectionSet) NodeImplementsInterfaces() []int {
func (s SelectionSet) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (t Type) NodeDefaultValue() int {
panic("implement me")
}

func (t Type) NodeImplementsInterfaces() []int {
func (t Type) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/typesystemdefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (t TypeSystemDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (t TypeSystemDefinition) NodeImplementsInterfaces() []int {
func (t TypeSystemDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/uniontypedefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (u UnionTypeDefinition) NodeDefaultValue() int {
panic("implement me")
}

func (u UnionTypeDefinition) NodeImplementsInterfaces() []int {
func (u UnionTypeDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (v Value) NodeDefaultValue() int {
panic("implement me")
}

func (v Value) NodeImplementsInterfaces() []int {
func (v Value) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/document/variabledefinition.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (v VariableDefinition) NodeDirectiveDefinitions() []int {
panic("implement me")
}

func (v VariableDefinition) NodeImplementsInterfaces() []int {
func (v VariableDefinition) NodeImplementsInterfaces() ByteSliceReferences {
panic("implement me")
}

Expand Down
Loading

0 comments on commit b12e8b8

Please sign in to comment.