Open Idorobots opened 8 months ago
Most of the rules just select a part of the parse result, give it a name and push it downward in a more convenient format:
(ValidCommand (Spacing (/ "compile" "exec" "repl")) (lambda (input result) (match (list 'command (cadr (match-match result))) (match-start result) (match-end result))))
This could have been done by the rule itself, by imposing a more useful format for the match result:
(ValidCommand (Spacing (@ 'command (/ "compile" "exec" "repl"))))
With the default full-match under the rule name. Then the parser would merge all these partial results automatically to produce a value with all the captures included.
Most of the rules just select a part of the parse result, give it a name and push it downward in a more convenient format:
This could have been done by the rule itself, by imposing a more useful format for the match result:
With the default full-match under the rule name. Then the parser would merge all these partial results automatically to produce a value with all the captures included.