From 8b4fee50aba4bd107bae6bd8eef8d5ca3a78cc0a Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 18 Oct 2022 23:39:07 -0400 Subject: [PATCH] Literals call themselves literals instead of arg --- analyzer/data-section_test.go | 8 ++++---- analyzer/enum-section_test.go | 30 +++++++++++++++--------------- analyzer/func-section_test.go | 4 +++- analyzer/literals.go | 8 ++++---- analyzer/type-section_test.go | 10 +++++----- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/analyzer/data-section_test.go b/analyzer/data-section_test.go index 1d08449..e05f039 100644 --- a/analyzer/data-section_test.go +++ b/analyzer/data-section_test.go @@ -6,15 +6,15 @@ func TestDataSection (test *testing.T) { checkTree ("../tests/analyzer/dataSection", false, `dataSection ro ../tests/analyzer/dataSection.aBasicInt type 1 basic Int - arg uint 5 + uintLiteral 5 dataSection ro ../tests/analyzer/dataSection.bRune type 1 basic Int - arg string 'A' + stringLiteral 'A' dataSection ro ../tests/analyzer/dataSection.cString type 1 basic String - arg string 'A very large bird' + stringLiteral 'A very large bird' dataSection ro ../tests/analyzer/dataSection.dCharBuffer type 32 basic U8 - arg string 'A very large bird` + "\000" + `' + stringLiteral 'A very large bird` + "\000" + `' `, test) } diff --git a/analyzer/enum-section_test.go b/analyzer/enum-section_test.go index a2f22a6..68c6bd8 100644 --- a/analyzer/enum-section_test.go +++ b/analyzer/enum-section_test.go @@ -5,40 +5,40 @@ import "testing" func TestEnumSection (test *testing.T) { checkTree ("../tests/analyzer/enumSection", false, `enumSection ro ../tests/analyzer/enumSection.aWeekday - arg uint 1 + uintLiteral 1 type 1 basic Int member sunday - arg uint 1 + uintLiteral 1 member monday - arg uint 2 + uintLiteral 2 member tuesday - arg uint 3 + uintLiteral 3 member wednesday - arg uint 4 + uintLiteral 4 member thursday - arg uint 5 + uintLiteral 5 member friday - arg uint 6 + uintLiteral 6 member saturday - arg uint 7 + uintLiteral 7 typeSection ro ../tests/analyzer/enumSection.bColor type 1 basic U32 enumSection ro ../tests/analyzer/enumSection.cNamedColor - arg uint 16711680 + uintLiteral 16711680 type 1 basic bColor member red - arg uint 16711680 + uintLiteral 16711680 member green - arg uint 65280 + uintLiteral 65280 member blue - arg uint 255 + uintLiteral 255 enumSection ro ../tests/analyzer/enumSection.dFromFarAway - arg uint 5 + uintLiteral 5 type 1 basic dInheritFromOther member bird - arg uint 5 + uintLiteral 5 member bread - arg uint 4 + uintLiteral 4 typeSection ro ../tests/analyzer/typeSection/required.aBasic type 1 basic Int typeSection ro ../tests/analyzer/typeSection.dInheritFromOther diff --git a/analyzer/func-section_test.go b/analyzer/func-section_test.go index 389d7cd..49bd3ee 100644 --- a/analyzer/func-section_test.go +++ b/analyzer/func-section_test.go @@ -6,7 +6,9 @@ func TestFuncSection (test *testing.T) { checkTree ("../tests/analyzer/funcSection", false, ` typeSection ro ../tests/analyzer/funcSection.aCString - type 1 pointer {Int} + type 1 pointer { + type 1 basic U8 + } funcSection ro ../tests/analyzer/funcSection.bArbitrary block arbitraryPhrase diff --git a/analyzer/literals.go b/analyzer/literals.go index e1a090c..5b515f4 100644 --- a/analyzer/literals.go +++ b/analyzer/literals.go @@ -28,7 +28,7 @@ type StringLiteral struct { // ToString outputs the data in the argument as a string. func (literal IntLiteral) ToString (indent int) (output string) { - output += doIndent(indent, fmt.Sprint("arg int ", literal.value, "\n")) + output += doIndent(indent, fmt.Sprint("intLiteral ", literal.value, "\n")) return } @@ -71,7 +71,7 @@ func (literal IntLiteral) canBePassedAs (what Type) (allowed bool) { // ToString outputs the data in the argument as a string. func (literal UIntLiteral) ToString (indent int) (output string) { - output += doIndent(indent, fmt.Sprint("arg uint ", literal.value, "\n")) + output += doIndent(indent, fmt.Sprint("uintLiteral ", literal.value, "\n")) return } @@ -120,7 +120,7 @@ func (literal FloatLiteral) What () (what Type) { // ToString outputs the data in the argument as a string. func (literal FloatLiteral) ToString (indent int) (output string) { - output += doIndent(indent, fmt.Sprint("arg float ", literal.value, "\n")) + output += doIndent(indent, fmt.Sprint("floatLiteral ", literal.value, "\n")) return } @@ -170,7 +170,7 @@ func (literal StringLiteral) What () (what Type) { // ToString outputs the data in the argument as a string. func (literal StringLiteral) ToString (indent int) (output string) { - output += doIndent(indent, fmt.Sprint("arg string '", literal.value, "'\n")) + output += doIndent(indent, fmt.Sprint("stringLiteral '", literal.value, "'\n")) return } diff --git a/analyzer/type-section_test.go b/analyzer/type-section_test.go index c728b8a..680747b 100644 --- a/analyzer/type-section_test.go +++ b/analyzer/type-section_test.go @@ -10,10 +10,10 @@ typeSection ro ../tests/analyzer/typeSection/required.bBird type 1 basic Obj member rw wing type 1 basic Int - arg uint 2 + uintLiteral 2 typeSection ro ../tests/analyzer/typeSection.aBasicInt type 1 basic Int - arg uint 5 + uintLiteral 5 typeSection ro ../tests/analyzer/typeSection.bOnBasicInt type 1 basic aBasicInt typeSection ro ../tests/analyzer/typeSection.cBasicObject @@ -28,15 +28,15 @@ typeSection ro ../tests/analyzer/typeSection.eInheritObject type 1 basic cBasicObject member ro that type 1 basic UInt - arg uint 5 + uintLiteral 5 typeSection ro ../tests/analyzer/typeSection.fInheritObjectFromOther type 1 basic bBird member ro wing type 1 basic Int - arg uint 2 + uintLiteral 2 member ro beak type 1 basic Int - arg uint 238 + uintLiteral 238 typeSection ro ../tests/analyzer/typeSection.gPointer type 1 pointer { type 1 basic Int