Mechanism to try to indent expressions like the user had done.
See in particular parse-expressions, which annotates certain
expressions with a
This function should be called when we are ready to insert a newline but only if one was present in the original source code. If the attributes indicate that there was a newline here, we insert a newline and indent appropriately.
(defun vl-mimic-linestart-fn (atts attname ps) (declare (xargs :stobjs (ps))) (declare (xargs :guard (and (vl-atts-p atts) (stringp attname)))) (let ((__function__ 'vl-mimic-linestart)) (declare (ignorable __function__)) (b* (((unless atts) ps) (look (assoc-equal (string-fix attname) (vl-atts-fix atts))) ((unless look) ps) ((unless (vl-ps->mimic-linebreaks-p)) ps) (indent (if (and (vl-expr-p (cdr look)) (vl-expr-resolved-p (cdr look)) (<= 0 (vl-resolved->val (cdr look)))) (vl-resolved->val (cdr look)) 0)) (indent (max indent (vl-ps->autowrap-ind)))) (vl-ps-seq (vl-println "") (vl-indent indent)))))
(defthm vl-mimic-linestart-fn-of-vl-atts-fix-atts (equal (vl-mimic-linestart-fn (vl-atts-fix atts) attname ps) (vl-mimic-linestart-fn atts attname ps)))
(defthm vl-mimic-linestart-fn-vl-atts-equiv-congruence-on-atts (implies (vl-atts-equiv atts atts-equiv) (equal (vl-mimic-linestart-fn atts attname ps) (vl-mimic-linestart-fn atts-equiv attname ps))) :rule-classes :congruence)
(defthm vl-mimic-linestart-fn-of-str-fix-attname (equal (vl-mimic-linestart-fn atts (str-fix attname) ps) (vl-mimic-linestart-fn atts attname ps)))