improved identifier classification function

This commit is contained in:
2025-09-22 00:39:00 +09:00
parent 5819be7fa5
commit a0fd6c5048
4 changed files with 129 additions and 90 deletions

View File

@ -1,12 +1,12 @@
$?a ##ERROR: syntax error - '?' prohibited as first character after '$'
$?a ##ERROR: syntax error - invalid dollar-prefixed identifier '$?a'
---
$include ##ERROR: syntax error - $include target not specified
$include ##ERROR: syntax error - '$include' target not specified
---
$include 10 ##ERROR: syntax error - $include target expected in place of '10'
$include 10 ##ERROR: syntax error - '$include' target expected in place of '10'
---
@ -146,11 +146,11 @@ abc- := 20 ##ERROR: syntax error - '-' prohibited as last character of identifie
---
self.g- := 20 ##ERROR: syntax error - '-' prohibited as last character of identifier or identifier segment
self.g- := 20 ##ERROR: syntax error - wrong multi-segment identifier - self.g-
---
self.-g := 20 ##ERROR: syntax error - '-' prohibited as first character of identifier or identifier segment
self.-g := 20 ##ERROR: syntax error - wrong multi-segment identifier - self.-g
---
@ -162,7 +162,7 @@ abc. := 20 ##ERROR: syntax error - blank segment after 'abc.'
---
abc.? := 20 ##ERROR: syntax error - '?' prohibited as first character of identifier or identifier segment after 'abc.'
abc.? := 20 ##ERROR: syntax error - wrong multi-segment identifier - abc.?
---

View File

@ -54,3 +54,18 @@ if (~= c 30) {
} else {
printf "OK: %d\n" c
}
## TODO: make the below line work...
##set prim-plus + ## this is not allowed currently...
##fun plus (a b ...) {
## | sum vac i |
## sum := (prim-plus a b)
## vac := (va-count)
## i := 0;
## while (< i vac) {
## sum := (prim-plus sum (va-get i))
## i := (prim-plus i 1)
## }
## sum := (prim-plus sum 9999)
##}
##printf "%d\n" (plus 10 20 30)