From 89f40ce7a611361e3f6c4ec156471e05781f7682 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 29 May 2022 00:52:39 -0400 Subject: [PATCH] Improved error report for literal string with %word --- docs/native.wasm | Bin 401581 -> 401614 bytes peglib.h | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/native.wasm b/docs/native.wasm index 6f42a9842d774f5ed84b5c64715fc1080cabb35c..a53b8d704d39915b11ab12a8d6b19d564595b647 100755 GIT binary patch delta 1633 zcmZuxX-rgC6rOYLTV_Ls%I1LZW`*fnhp*2E|-X-pfnrY${#OEhU-a=-JP_1<&OyWRcK zU-w5J3Lu#E07e>HagjWB3q1bnS&dq)R;e4Em1;n(XBFxe!)%@|!=N!MB-IYh`sKlS z+z|?$Mxpa!8vLM7UU(KO!1!mOtU{sA@)if#(!84hW%}&=k{~;rUpQ8+0ZmFoJD=c@ zlZ@GAZC0fcG}7^YCr0RZsuQ77ch4~5NK8x7&c?Hvh{t?h|Rn-RNfhcvRyDE-2R7vO|`=A&NPguZd_bXEs${okQ@ z{pY<`p}{!0&u$&@yk;CZvJ9Y2k2pFU+;4>V6rj$ya4elcgHB+~JKo`eX5;dp#Y%=7 zL*qgyKI~p^)We1dYKSKcDn+UWUIzq3aSAwruyzu7Jy6a27Q-5XWh)?-Yb(IabCy8b zLxqPQSOPb&8hHEycu{wqFmPs8RF`LCGlCtgr137nAP8AEV*Ec;1d>NR1O+ zqww`G3|Pc)Jf?$L(HLEuOXag%nEsNgDVZkCl4|*g3=k2Z-k}z+=}BaxKx~p z<(k5~T{uxzG%JahT=?=MG2Z<|T<*s4(TW$NHAR}KDVjpHGQsCX$%Zp|mm4EfRLZaU z9La8bX89a)Vl+u|BGRJCNhVvSX>N?8+zvL)rrCWin~k4zV=P~j&Eoh2H;x6BM|*I$ z5{wQ({-pZBvvYazs>nKFMupCgs;>cwpFUKj4OKrN@MeUlfQz}Swp zkS?qTup1t0clQ5}RPnEE6p_Z^hMwTK!I~Yn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8wY-;ubt9>|fkMPkUFsKN zt5>N5cbL)o+Gz2^Hk>Z&4a^Q#fkiNy%@@@Nk(u?}@wP^Tvf3X~wXe}aeMUowUKKbeC6NA5d_^90@Zip{6+ zIs^r!S|+ca#tthqh*x{@48hd%SYvMhkE+|K53`kNqVfX9iyP;04NX|l1zZk7 zMm4$c4bF>(fK2Vfr@hcDU&>%-RcICC#7&*3_`51}K6>M(=;gl*SIfeYCmR+$Do@-@x7sb5N%?gk(YcF#?O@4Vl zGMr1}nxrYQ;;U44N}SOYo6LAp88+9`PCH2FG!>e2$W(Rpfk_+6*)EG4m1ux=xw=W| z)SyjTI+Xj_&?GIVl@68owl9?V3Z38WRW>?^ufL{Ti-o|h;(jF#Hp|5kya7U^cEiah zx?qP)Oy`mDRFcf;e4$3~tDDV_X?V{iXUykYnSF3mMtfj}BTV#aI7&u6&o48DbXEBJ zl_%tgMf|Ld65U+RY0s?|Wu<%tB@h=&c@CrsTNzIZS-r-~pFk;VV^` XC#J3C=^=-*wR}XVN5Qvv{*HeDj(heF diff --git a/peglib.h b/peglib.h index d225804..82a719f 100644 --- a/peglib.h +++ b/peglib.h @@ -2535,7 +2535,10 @@ inline size_t parse_literal(const char *s, size_t n, SemanticValues &vs, NotPredicate ope(c.wordOpe); auto len = ope.parse(s + i, n - i, dummy_vs, dummy_c, dummy_dt); - if (fail(len)) { return len; } + if (fail(len)) { + c.set_error_pos(s, lit.data()); + return len; + } i += len; } }