]> ocean-lang.org Git - ocean/blobdiff - csrc/parsergen.mdc
parsergen: allow $$OUT to be satisfied are start-of-line.
[ocean] / csrc / parsergen.mdc
index 76fec3a70a779cefe4589a9d79e861a61acd726e..df73f513ceec725931af6c78832d234a0913e45a 100644 (file)
@@ -2871,9 +2871,13 @@ checks if a given token is in any of these look-ahead sets.
                force_reduce:
                        if (states[tos->state].reduce_prod >= 0 &&
                            states[tos->state].newline_only &&
-                           tk->num != TK_newline && tk->num != TK_eof && tk->num != TK_out) {
-                               /* Anything other than newline in an error as this
-                                * production must end at EOL
+                           !(tk->num == TK_newline ||
+                             tk->num == TK_eof ||
+                             tk->num == TK_out ||
+                             (tos->indents == 0 && tos->since_newline == 0))) {
+                               /* Anything other than newline or out or eof
+                                * in an error unless we are already at start
+                                * of line, as this production must end at EOL.
                                 */
                        } else if (states[tos->state].reduce_prod >= 0) {
                                void **body;