New, more flexible, parser context datatype that includes and extends

the previous flags allowForest and allowVarRef.
Added binary operator (work in progress).
Better implementation of +=,-=,*=, and /= (new) operators.
This commit is contained in:
2024-12-19 14:48:27 +01:00
parent 5c44532790
commit 6ee21e10af
16 changed files with 537 additions and 140 deletions
+16 -10
View File
@@ -91,6 +91,7 @@ func init() {
SymDoubleDot: {"..", symClassOperator}, // 58: '..'
SymTripleDot: {"...", symClassOperator}, // 59: '...'
SymStarEqual: {"*=", symClassOperator}, // 60: '*='
SymSlashEqual: {"/=", symClassOperator}, // 61: '/='
// SymChangeSign
// SymUnchangeSign
// SymIdentifier
@@ -140,16 +141,21 @@ func SymToString(sym Symbol) string {
func SymListToString(symList []Symbol, quote bool) string {
var sb strings.Builder
for _, sym := range symList {
if sb.Len() > 0 {
sb.WriteByte(',')
}
if quote {
sb.WriteByte('\'')
}
sb.WriteString(SymToString(sym))
if quote {
sb.WriteByte('\'')
if len(symList) == 0 {
sb.WriteString("<nothing>")
} else {
for _, sym := range symList {
if sb.Len() > 0 {
sb.WriteByte(',')
sb.WriteByte(' ')
}
if quote {
sb.WriteByte('`')
}
sb.WriteString(SymToString(sym))
if quote {
sb.WriteByte('`')
}
}
}
return sb.String()