rpg_source.zig: settle() reads the finished text with a validator and reports its findings in the receipt #788
Loading…
Reference in a new issue
No description provided.
Delete branch "validator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
rpg_source.zig:
settle()reads the finished text with a validator and reports its findings in the receiptEmitter.runends withsettle()(afterrender()and the short-namesre-render). It calls
rpg_source_validate.checkon the final lines of thefree-form render (
e.out.textand the forms ofe.out.lines), so a statementthat a late pass (
dropUnreferenced,failUndeclared,fitGlobals,checkNames, the render) refused is a failure line there, whatever its entrywas when
balance()ran.settle()writes onlyEmitter.findings: itre-balances nothing, re-renders nothing and adds no failure line. The columns
and the mixed render are not read.
The
savf rpgleJSON receipt has a new keyvalidator:{findings: [{rule, line, statement?, detail}], counts: {rule: n}}, outsideform_counts. Adetailends with(validator: RULE). The text of the emitis unchanged (emit-bytes-diff: identical; capture-emit-diff: same).
Rules, each a detector now:
blocks: ELSE, ELSEIF, WHEN, OTHER, ON-ERROR or an end without its head, ahead without its end (
rpg_source_blocks.brokenover the final lines), aDCL-PROC without END-PROC and the reverse.
loop_exit: LEAVE or ITER with no emitted DOW, DOU or FOR around it.return: a procedure whose DCL-PI declares a return type and that has noRETURN line.
interface: a call that is emitted to a procedure or prototype whose DCL-PIor DCL-PR holds a
fail_pi_parameter_v1orfail_pr_parameter_v1line.condition_literal: a DOW, DOU, IF or WHEN whose condition is a bare number.bif_numeric: a %REM operand declared as other than a number, read from thedeclarations of the same text.
Measured on v0.1.504 with this build (statements, emits and failure counts of
the six public Async programs are the same as the base binary's):
returnblockscondition_literaldow 1;, one in each program)bif_numericchar(2182) basedfield, one in each program)loop_exitinterfaceThe twins are the 852 program rows of the committed twins (the sources of
runs/emit/0.1.504): 475 have the matrix verdictmatchormatch_except_file_identity; of the other 377, 304 aredifferent, 36failed, 6refused, 3 have no matrix row and 28 have no verdict (no emit).44 of the 824 emits are in columns or mixed and are not read. The three non-matching findings are on
failedrows:init-auto-char-heldout(a DCL-PROC with no END-PROC),lsel-for-arr-if-if(a call to RETHROW whose DCL-PI holds a failure line) andreturn-switch-utf8-stripped(WORK declaresint(10), its RETURN is notrecovered). The census of v0.1.503 counts RNF7423 once in each of the six
programs: 6, as here.
Tests:
src/rpg_source_validate_test.zig.Gate (coordinator)
gate.shv0.1.504 -> this build over 87 captures plus the committed twins: dev emits same x5, L10-test unchanged, emit-bytes-diff identical, 0 of 87 captures changed, suspect 94/94, wrong parameters 24/24. Findings on the six public Async programs: return 45, blocks 12, condition_literal 6, bif_numeric 6; none on any of 475 host-matching twins.Emitter.run ends with settle(), which reads the final lines of the free-form render with rpg_source_validate.check and stores the findings. It changes no emitted text. The receipt has a new key validator {findings, counts}, outside form_counts. Rules: blocks, loop_exit, return, interface, condition_literal, bif_numeric.