@@ -1128,7 +1128,85 @@ public void testConformity() {
11281128 assertEquals ("writeq('a\\ nb')" , parseEd ("writeq('a\\ \n b'). % \" a\\ \\ \\ nb\" " ).next ().toString ());
11291129 assertEquals ("writeq('\\ na')" , parseEd ("writeq('\\ \n a'). % \" \\ \\ \\ na\" " ).next ().toString ());
11301130 assertEquals ("writeq('\\ n')" , parseEd ("writeq('\\ \n '). % \" \\ \\ \\ n\" " ).next ().toString ());
1131-
1131+ assertEquals ("* = *" , parseEd ("* = * ." ).next ().toString ());
1132+ assertEquals ("[:- - c] = [(:- - c)]" , parseEd ("[:- -c] = [(:- -c)]." ).next ().toString ());
1133+ assertEquals ("X = '\\ '" , parseEd ("X = '\\ \\ ' ." ).next ().toString ());
1134+ assertEquals ("X = `a`" , parseEd ("X = `a`." ).next ().toString ());
1135+ assertEquals ("writeq(- (a * b))" , parseEd ("writeq(- (a*b))." ).next ().toString ());
1136+ assertEquals ("writeq(\\ (a * b))" , parseEd ("writeq(\\ (a*b))." ).next ().toString ());
1137+ assertEquals ("writeq([1])" , parseEd ("/**/ writeq([1])." ).next ().toString ());
1138+ assertEquals ("writeq(- [1])" , parseEd (" /**/ writeq(-[1])." ).next ().toString ());
1139+ assertEquals ("write_canonical(1 p (p p 2))" , parseEd ("write_canonical(1 p p p 2)." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (9 , FY , "p" ), Op .make (9 , YFX , "p" ))).next ().toString ());
1140+ assertEquals ("write_canonical(1 p p p 2)" , parseEd ("write_canonical(1 p p p 2)." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (9 , FY , "p" ), Op .make (9 , XFY , "p" ))).next ().toString ());
1141+ assertEquals ("write_canonical(1 p p p 2)" , parseEd ("write_canonical(1 p p p 2)." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (7 , FY , "p" ), Op .make (9 , YFX , "p" ))).next ().toString ());
1142+ // assertEquals("atom('.\'-\'.')",parseEd("atom('.\'-\'.').").next().toString());
1143+ assertEquals ("op(0, xfy, '|')" , parseEd ("op(0,xfy,'|')." ).next ().toString ());
1144+ assertEquals ("writeq((a | b))" , parseEd ("/**/ writeq((a|b))." ).next ().toString ());
1145+ assertEquals ("X is 10.0 ** (-323)" , parseEd ("X is 10.0** -323." ).next ().toString ());
1146+ assertEquals ("10E-324.0 =:= 10.0 ** (-323)" , parseEd ("1.0e-323=:=10.0** -323." ).next ().toString ());
1147+ assertEquals ("-1 = -1" , parseEd ("-1 = -0x1." ).next ().toString ());
1148+ assertEquals ("T = t(1, 1, 1)" , parseEd ("T = t(0b1,0o1,0x1)." ).next ().toString ());
1149+ assertEquals ("X is 1 mod 2" , parseEd ("X is 0b1mod 2." ).next ().toString ());
1150+ assertEquals ("writeq((a --> b , c | d))" , parseEd ("/**/ writeq((a-->b,c|d))." ).next ().toString ());
1151+ assertEquals ("writeq([(a | b)])" , parseEd ("/**/ writeq([(a|b)])." ).next ().toString ());
1152+ assertEquals ("X = 7" , parseEd ("X/* /*/=7." ).next ().toString ());
1153+ assertEquals ("X = 7" , parseEd ("X/*/*/=7." ).next ().toString ());
1154+ assertEquals ("atom(- $)" , parseEd ("atom(-$)." ).next ().toString ());
1155+ assertEquals ("\\ " , parseEd ("\\ ." ).next ().toString ());
1156+ assertEquals ("write_canonical(_ + _)" , parseEd ("write_canonical(_+_)." ).next ().toString ());
1157+ assertEquals ("writeq(nop(1))" , parseEd ("writeq(nop (1))." ).next ().toString ());
1158+ assertEquals ("writeq(1 = f)" , parseEd ("/**/ writeq(1 = f)." ).next ().toString ());
1159+ assertEquals ("write_canonical(a - - - b)" , parseEd ("write_canonical(a- - -b)." ).next ().toString ());
1160+ // assertEquals("writeq(0 bop 2)",parseEd("writeq(0bop 2).", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(9, YFX, "bop","bo","b","op","xor"))).next().toString());
1161+ assertEquals ("writeq(0 bop 2)" , parseEd ("/**/ writeq(0 bop 2)." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (9 , YFX , "bop" , "bo" , "b" , "op" , "xor" ))).next ().toString ());
1162+ // assertEquals("writeq(0 bo 2)",parseEd("/**/ writeq(0bo 2).", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(9, YFX, "bop","bo","b","op","xor"))).next().toString());
1163+ // assertEquals("writeq(0 b 2)",parseEd("/**/ writeq(0b 2).", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(9, YFX, "bop","bo","b","op","xor"))).next().toString());
1164+ // assertEquals("writeq(0 op 2)",parseEd("/**/ writeq(0op 2).", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(9, YFX, "bop","bo","b","op","xor"))).next().toString());
1165+ // assertEquals("writeq(0 xor 2)",parseEd("/**/ writeq(0xor 2).", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(9, YFX, "bop","bo","b","op","xor"))).next().toString());
1166+ assertEquals ("writeq('^`')" , parseEd ("writeq('^`')." ).next ().toString ());
1167+ assertEquals ("writeq('\\ b\\ r\\ f\\ t\\ n')" , parseEd ("writeq('\\ b\\ r\\ f\\ t\\ n')." ).next ().toString ());
1168+ assertEquals ("writeq(-- a)" , parseEd ("writeq(--(a))." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (20 , FX , "--" ))).next ().toString ());
1169+ assertEquals ("writeq(-- a)" , parseEd ("writeq(--(a))." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (0 , FY , "--" ))).next ().toString ());
1170+ assertEquals ("writeq(10 mod 2)" , parseEd ("writeq(0xamod 2)." ).next ().toString ());
1171+
1172+
1173+ // assertThrows(PrologParserException.class, () -> parseEd("integer(0'').").next());
1174+ assertThrows (PrologParserException .class , () -> parseEd ("writeq('\\ ^J')." ).next ());
1175+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(00'a)." ).next ());
1176+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(00'+'1)." ).next ());
1177+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(0B1)." ).next ());
1178+ assertThrows (PrologParserException .class , () -> parseEd ("**/ writeq(0b2)." ).next ());
1179+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ writeq(0o8)." ).next ());
1180+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical(a>)." ).next ());
1181+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical((a>,b))." ).next ());
1182+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical(a> =b)." ).next ());
1183+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical(a> >b)." ).next ());
1184+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(0'\\ )." ).next ());
1185+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(0'\\ c)." ).next ());
1186+ assertThrows (PrologParserException .class , () -> parseEd ("char_code('\\ ^',X)." ).next ());
1187+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(0'\\ z)." ).next ());
1188+ assertThrows (PrologParserException .class , () -> parseEd ("atom($-)." ).next ());
1189+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ writeq(\" \\ z\" )" ).next ());
1190+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical(fy yf)." ).next ());
1191+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ write_canonical(f f)." ).next ());
1192+ assertThrows (PrologParserException .class , () -> parseEd ("writeq(0'f')." , DefaultParserContext .of (FLAG_BLOCK_COMMENTS , Op .make (100 , XF , "f" ))).next ());
1193+
1194+
1195+ // assertThrows(PrologParserException.class, () -> parseEd("/**/ X = 1.e.", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(100, XF, "f"))).next());
1196+ assertThrows (PrologParserException .class , () -> parseEd ("/**/ writeq(1 .2)." ).next ());
1197+ // assertThrows(PrologParserException.class, () -> parseEd("X = 2'1.").next());
1198+ assertThrows (PrologParserException .class , () -> parseEd ("is 0'mod'1." ).next ());
1199+ assertThrows (PrologParserException .class , () -> parseEd ("X = '\\ 77777777777\\ '." ).next ());
1200+ assertThrows (PrologParserException .class , () -> parseEd ("X = '\\ N'." ).next ());
1201+ assertThrows (PrologParserException .class , () -> parseEd ("X = '\\ 9'." ).next ());
1202+ assertThrows (PrologParserException .class , () -> parseEd ("a = '\\ 141'." ).next ());
1203+ assertThrows (PrologParserException .class , () -> parseEd ("X = [] (1)." ).next ());
1204+ // assertThrows(PrologParserException.class, () -> parseEd("writeq([a,b|,]).").next());
1205+ assertThrows (PrologParserException .class , () -> parseEd ("(- - - -) = -(-(-(-)))." ).next ());
1206+ assertThrows (PrologParserException .class , () -> parseEd ("(- - -) = -(-(-))." ).next ());
1207+ assertThrows (PrologParserException .class , () -> parseEd ("(- -) = -(-)." ).next ());
1208+ assertThrows (PrologParserException .class , () -> parseEd (":- = :- ." ).next ());
1209+ assertThrows (PrologParserException .class , () -> parseEd ("- = - ." ).next ());
11321210 assertThrows (PrologParserException .class , () -> parseEd ("writeq(//*.*/)." ).next ());
11331211 assertThrows (PrologParserException .class , () -> parseEd ("writeq(//*)." ).next ());
11341212 assertThrows (PrologParserException .class , () -> parseEd ("X = 0'\\ . ." ).next ());
0 commit comments