From 62b61b1ea2bc8c5e5d447ddc4529b7977439804a Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sun, 5 Mar 2023 09:08:01 +0000 Subject: Renames walk.Datum to walk.Atom --- subex/parse.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'subex/parse.go') diff --git a/subex/parse.go b/subex/parse.go index 59b784d..1d64c20 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -4,7 +4,7 @@ import ( "main/walk" ) -func expectBracket(l *RuneReader, ifLeft walk.Datum, ifRight walk.Datum) walk.Datum { +func expectBracket(l *RuneReader, ifLeft walk.Atom, ifRight walk.Atom) walk.Atom { switch l.next() { case '(': return ifLeft @@ -15,8 +15,8 @@ func expectBracket(l *RuneReader, ifLeft walk.Datum, ifRight walk.Datum) walk.Da } } -// Having just read termType, read in a bracket and return the corresponding walk.Datum -func parseTerminatorDatumLiteral(termType rune, l *RuneReader) walk.Datum { +// Having just read termType, read in a bracket and return the corresponding Atom +func parseTerminatorAtomLiteral(termType rune, l *RuneReader) walk.Atom { switch termType { case '@': return expectBracket(l, walk.ArrayBegin, walk.ArrayEnd) @@ -43,21 +43,21 @@ func parseReplacement(l *RuneReader) (output []TransducerOutput) { if slot == eof { panic("Missing slot character") } - output = append(output, TransducerReplacementLoad{datum: slot}) + output = append(output, TransducerReplacementLoad{atom: slot}) case '@', '~', '#': - output = append(output, TransducerReplacementRune{datum: parseTerminatorDatumLiteral(r, l)}) + output = append(output, TransducerReplacementAtom{atom: parseTerminatorAtomLiteral(r, l)}) default: - output = append(output, TransducerReplacementRune{datum: r}) + output = append(output, TransducerReplacementAtom{atom: r}) } } return output } // Parse the contents of a range subex [] into a map -func parseRangeSubex(l *RuneReader) map[walk.Datum]walk.Datum { +func parseRangeSubex(l *RuneReader) map[walk.Atom]walk.Atom { // TODO escaping - parts := make(map[walk.Datum]walk.Datum) - var froms []walk.Datum + parts := make(map[walk.Atom]walk.Atom) + var froms []walk.Atom var hasTo bool for { fromsStart := l.next() @@ -68,9 +68,9 @@ func parseRangeSubex(l *RuneReader) map[walk.Datum]walk.Datum { hasTo = true break } else { - datum := parseTerminatorDatumLiteral(fromsStart, l) - if datum != nil { - froms = append(froms, datum) + atom := parseTerminatorAtomLiteral(fromsStart, l) + if atom != nil { + froms = append(froms, atom) continue } } @@ -91,16 +91,16 @@ func parseRangeSubex(l *RuneReader) map[walk.Datum]walk.Datum { panic("Missing from part of range expression") } - var tos []walk.Datum + var tos []walk.Atom if hasTo { for { tosStart := l.next() if tosStart == ']' { break } else { - datum := parseTerminatorDatumLiteral(tosStart, l) - if datum != nil { - tos = append(tos, datum) + atom := parseTerminatorAtomLiteral(tosStart, l) + if atom != nil { + tos = append(tos, atom) continue } } @@ -166,9 +166,9 @@ func parseSubex(l *RuneReader, minPower int) SubexAST { case '.': lhs = SubexASTCopyAny{} case '@', '#', '~': - lhs = SubexASTCopyRune{datum: parseTerminatorDatumLiteral(r, l)} + lhs = SubexASTCopyAtom{atom: parseTerminatorAtomLiteral(r, l)} default: - lhs = SubexASTCopyRune{datum: r} + lhs = SubexASTCopyAtom{atom: r} } loop: for { if minPower <= 0 { -- cgit v1.2.3