]> Repositorios git - scryer-prolog.git/commitdiff
fix acceptance of invalid syntax, update iso_conformity_tests.pl (#2270)
authorMark <[email protected]>
Thu, 4 Jan 2024 20:14:50 +0000 (13:14 -0700)
committerMark <[email protected]>
Thu, 4 Jan 2024 20:14:58 +0000 (13:14 -0700)
src/parser/parser.rs
tests-pl/iso-conformity-tests.pl

index 473cbe46a500f09c4ec2e00215db9e20ea1c0893..3637df24fe6faa5d79ff7428478f88b9c38c3a31 100644 (file)
@@ -885,11 +885,7 @@ impl<'a, R: CharRead> Parser<'a, R> {
                         .push(Term::Literal(Cell::default(), Literal::Atom(atom)));
                 }
 
-                self.stack[idx].spec = if self.stack[idx].priority > 0 {
-                    TERM
-                } else {
-                    BTERM
-                };
+                self.stack[idx].spec = BTERM;
                 self.stack[idx].tt = TokenType::Term;
                 self.stack[idx].priority = 0;
 
index bfd74c61b064c84468e5ba50375b4e06e026a9f0..dc08ce2d57c66f3c4b9cfd3d086af939255bd5d7 100644 (file)
@@ -1005,6 +1005,18 @@ test_311 :- test_syntax_error("Finis ().", syntax_error(incomplete_reduction)).
 test_318 :- writeq_term_to_chars(+((1*2)^3), C),
             C == "+ (1*2)^3".
 
+test_320 :- writeq_term_to_chars([a|\+2], C),
+            C == "[a|\\+2]".
+
+test_321 :- test_syntax_error("writeq((a)(b)).", syntax_error(incomplete_reduction)).
+
+test_324 :- writeq_term_to_chars('%', C),
+            C == "'%'".
+
+test_325 :- test_syntax_error("writeq({[y}]).", syntax_error(incomplete_reduction)).
+
+test_326 :- test_syntax_error("(>)(1,2).", syntax_error(incomplete_reduction)).
+
 run_tests([Test|Tests]) -->
     (  { call(Test) } ->
        []