Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | pt::rdengine (C) - Fixed the generation of error messages by the dynamic C runtime, i.e. made it generate proper lists. |
---|---|
Timelines: | family | ancestors | descendants | both | pt-work |
Files: | files | file ages | folders |
SHA1: |
5eca9d60095c43109477efb40f79c9ab |
User & Date: | aku 2014-06-28 21:17:30 |
Context
2014-06-28
| ||
21:18 | pt::parse::peg (C) - Updated with the fixes to the C generator. Updated all testsuite results with the same fixes. Closed-Leaf check-in: af55e30def user: aku tags: pt-work | |
21:17 | pt::rdengine (C) - Fixed the generation of error messages by the dynamic C runtime, i.e. made it generate proper lists. check-in: 5eca9d6009 user: aku tags: pt-work | |
21:16 | Fixed the generators to generate properly listified and quoted error messages check-in: 51a676d805 user: aku tags: pt-work | |
Changes
Changes to modules/pt/rde_critcl/m.c.
︙ | ︙ | |||
744 745 746 747 748 749 750 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ sym = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, sym); return TCL_OK; } int param_I_er_popmerge (RDE_STATE p, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv) |
︙ | ︙ | |||
1227 1228 1229 1230 1231 1232 1233 | return TCL_ERROR; } /* * interning: msg as is. Already has PE operator in the message. */ | | | 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 | return TCL_ERROR; } /* * interning: msg as is. Already has PE operator in the message. */ msg = rde_ot_intern0 (p, objv [2]); rde_param_i_input_next (p->p, msg); return TCL_OK; } int param_I_test_alnum (RDE_STATE p, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv) |
︙ | ︙ | |||
1304 1305 1306 1307 1308 1309 1310 | } /* * interning: t + space + char */ ch = Tcl_GetString (objv [2]); | | | 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | } /* * interning: t + space + char */ ch = Tcl_GetString (objv [2]); msg = rde_ot_intern1 (p, "t", objv [2]); rde_param_i_test_char (p->p, ch, msg); return TCL_OK; } int param_I_test_control (RDE_STATE p, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv) |
︙ | ︙ | |||
1451 1452 1453 1454 1455 1456 1457 | /* * interning: .. + space + char + space + char */ chs = Tcl_GetString (objv [2]); che = Tcl_GetString (objv [3]); | | | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | /* * interning: .. + space + char + space + char */ chs = Tcl_GetString (objv [2]); che = Tcl_GetString (objv [3]); msg = rde_ot_intern2 (p, "..", objv [2], objv[3]); rde_param_i_test_range (p->p, chs, che, msg); return TCL_OK; } int |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | } /* * interning: t + space + char */ ch = Tcl_GetString (objv [2]); | | | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 | } /* * interning: t + space + char */ ch = Tcl_GetString (objv [2]); msg = rde_ot_intern1 (p, "t", objv [2]); rde_param_i_input_next (p->p, msg); if (rde_param_query_st (p->p)) { rde_param_i_test_char (p->p, ch, msg); } return TCL_OK; } |
︙ | ︙ | |||
1827 1828 1829 1830 1831 1832 1833 | /* * interning: .. + space + char + space + char */ chs = Tcl_GetString (objv [2]); che = Tcl_GetString (objv [3]); | | | 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 | /* * interning: .. + space + char + space + char */ chs = Tcl_GetString (objv [2]); che = Tcl_GetString (objv [3]); msg = rde_ot_intern2 (p, "..", objv [2], objv[3]); rde_param_i_input_next (p->p, msg); if (rde_param_query_st (p->p)) { rde_param_i_test_range (p->p, chs, che, msg); } return TCL_OK; } |
︙ | ︙ | |||
2477 2478 2479 2480 2481 2482 2483 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ msg = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, msg); rde_param_i_ast_pop_rewind (p->p); rde_param_i_loc_pop_discard (p->p); if (rde_param_query_st (p->p)) { rde_param_i_ast_value_push (p->p); |
︙ | ︙ | |||
2529 2530 2531 2532 2533 2534 2535 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ msg = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, msg); rde_param_i_loc_pop_discard (p->p); if (rde_param_query_st (p->p)) { rde_param_i_ast_value_push (p->p); } |
︙ | ︙ | |||
2580 2581 2582 2583 2584 2585 2586 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ msg = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, msg); rde_param_i_ast_pop_rewind (p->p); rde_param_i_loc_pop_discard (p->p); if (rde_param_query_st (p->p)) { rde_param_i_ast_value_push (p->p); |
︙ | ︙ | |||
2627 2628 2629 2630 2631 2632 2633 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ msg = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, msg); rde_param_i_ast_pop_rewind (p->p); rde_param_i_loc_pop_discard (p->p); return TCL_OK; } |
︙ | ︙ | |||
2670 2671 2672 2673 2674 2675 2676 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ | | | 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 | * * The obj literal here is very likely shared with the arguments of * i_symbol_save/restore, and i_value_leaf/reduce, and derivatives. This * here is the only point between these where we save the string id in the * Tcl_Obj*. */ msg = rde_ot_intern1 (p, "n", objv [2]); rde_param_i_error_nonterminal (p->p, msg); rde_param_i_loc_pop_discard (p->p); return TCL_OK; } |
︙ | ︙ | |||
2699 2700 2701 2702 2703 2704 2705 | } /* * interning: str + space + char */ str = Tcl_GetStringFromObj (objv [2], &len); | | | 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 | } /* * interning: str + space + char */ str = Tcl_GetStringFromObj (objv [2], &len); msg = rde_ot_intern1 (p, "str", objv [2]); rde_param_i_next_str (p->p, str, msg); return TCL_OK; } int param_SI_next_class (RDE_STATE p, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv) |
︙ | ︙ | |||
2726 2727 2728 2729 2730 2731 2732 | } /* * interning: cl + space + char */ class = Tcl_GetStringFromObj (objv [2], &len); | | | 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 | } /* * interning: cl + space + char */ class = Tcl_GetStringFromObj (objv [2], &len); msg = rde_ot_intern1 (p, "cl", objv [2]); rde_param_i_next_class (p->p, class, msg); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to modules/pt/rde_critcl/ot.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | static Tcl_ObjType ot_type = { "tcllib/pt::rde/critcl", ot_free_rep, ot_dup_rep, ot_string_rep, ot_from_any }; | | > > > > > > > > | > > > > | > > > > > > > > > > | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | < | < < < < < < < < < < | < < < | < < < < < < | < | < < | < < < < < < | < | < < < < < < < < < < > > > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | static Tcl_ObjType ot_type = { "tcllib/pt::rde/critcl", ot_free_rep, ot_dup_rep, ot_string_rep, ot_from_any }; static int IsCached (RDE_STATE p, Tcl_Obj* obj, long int* id); static long int Make (RDE_STATE p, Tcl_Obj* obj, const char* str); /* * = = == === ===== ======== ============= ===================== */ long int rde_ot_intern0 (RDE_STATE p, Tcl_Obj* detail) { long int id; TRACE (("rde_ot_intern0 (%p, %p = '%s')", p, detail, Tcl_GetString(detail))); if (IsCached (p, detail, &id)) { return id; } TRACE (("INTERNALIZE")); return Make (p, detail, Tcl_GetString (detail)); } long int rde_ot_intern1 (RDE_STATE p, const char* operator, Tcl_Obj* detail) { long int id; Tcl_DString buf; TRACE (("rde_ot_intern1 (%p, '%s' %p = '%s')", p, operator, detail, Tcl_GetString(detail))); if (IsCached (p, detail, &id)) { return id; } TRACE (("INTERNALIZE")); /* Create a list of operator + detail. * Using a DString. */ Tcl_DStringInit (&buf); Tcl_DStringAppendElement (&buf, operator); Tcl_DStringAppendElement (&buf, Tcl_GetString (detail)); id = Make (p, detail, Tcl_DStringValue (&buf)); Tcl_DStringFree (&buf); return id; } long int rde_ot_intern2 (RDE_STATE p, const char* operator, Tcl_Obj* detail1, Tcl_Obj* detail2) { long int id; Tcl_DString buf; TRACE (("rde_ot_intern2 (%p, '%s' %p = '%s', %p = '%s')", p, operator, detail1, Tcl_GetString(detail1) detail2, Tcl_GetString(detail2))); if (IsCached (p, detail1, &id)) { return id; } TRACE (("INTERNALIZE")); /* Create a list of operator + detail1 + detail2. * Using a DString. */ Tcl_DStringInit (&buf); Tcl_DStringAppendElement (&buf, operator); Tcl_DStringAppendElement (&buf, Tcl_GetString (detail1)); Tcl_DStringAppendElement (&buf, Tcl_GetString (detail2)); id = Make (p, detail1, Tcl_DStringValue (&buf)); Tcl_DStringFree (&buf); return id; } /* * = = == === ===== ======== ============= ===================== */ static int IsCached (RDE_STATE p, Tcl_Obj* obj, long int* id) { /* * Quick exit if we have a cached and valid value. */ if ((obj->typePtr == &ot_type) && (obj->internalRep.twoPtrValue.ptr1 == p)) { RDE_STRING* rs = (RDE_STRING*) obj->internalRep.twoPtrValue.ptr2; TRACE (("CACHED %p = %d", rs, rs->id)); *id = rs->id; return 1; } return 0; } static long int Make (RDE_STATE p, Tcl_Obj* obj, const char* str) { long int id = param_intern (p, str); RDE_STRING* rs = ALLOC (RDE_STRING); rs->next = p->sfirst; rs->self = obj; rs->id = id; p->sfirst = rs; /* Invalidate previous int.rep before setting our own. * Inlined copy of TclFreeIntRep() macro (tclInt.h) */ if ((obj)->typePtr && (obj)->typePtr->freeIntRepProc) { (obj)->typePtr->freeIntRepProc(obj); } obj->internalRep.twoPtrValue.ptr1 = p; obj->internalRep.twoPtrValue.ptr2 = rs; obj->typePtr = &ot_type; return id; } |
︙ | ︙ | |||
129 130 131 132 133 134 135 | RDE_STRING* iter = p->sfirst; while (iter->next != rs) { iter = iter->next; } iter->next = rs->next; } | | > > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | RDE_STRING* iter = p->sfirst; while (iter->next != rs) { iter = iter->next; } iter->next = rs->next; } /* Drop the now un-tracked structure */ ckfree ((char*) rs); /* Nothing to release in the obj itself, just resetting references. */ obj->internalRep.twoPtrValue.ptr1 = NULL; obj->internalRep.twoPtrValue.ptr2 = NULL; } static void ot_dup_rep(Tcl_Obj* obj, Tcl_Obj* dup) { |
︙ | ︙ |
Changes to modules/pt/rde_critcl/ot.h.
1 2 3 4 5 6 7 8 9 10 11 | /* * = = == === ===== ======== ============= ===================== * == pt::rde (critcl) - Data Structures - ObjType for interned strings. */ #ifndef _RDE_DS_OT_H #define _RDE_DS_OT_H 1 #include "tcl.h" #include <p.h> /* State declarations */ | | > > > | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * = = == === ===== ======== ============= ===================== * == pt::rde (critcl) - Data Structures - ObjType for interned strings. */ #ifndef _RDE_DS_OT_H #define _RDE_DS_OT_H 1 #include "tcl.h" #include <p.h> /* State declarations */ long int rde_ot_intern0 (RDE_STATE p, Tcl_Obj* detail); long int rde_ot_intern1 (RDE_STATE p, const char* operator, Tcl_Obj* detail); long int rde_ot_intern2 (RDE_STATE p, const char* operator, Tcl_Obj* detail1, Tcl_Obj* detail2); #endif /* _RDE_DS_OT_H */ /* * Local Variables: * mode: c * c-basic-offset: 4 |
︙ | ︙ |
Changes to modules/pt/rde_critcl/param.c.
︙ | ︙ | |||
736 737 738 739 740 741 742 | * * FUTURE :: keep track of what location the data stored in CC is * for. If the location is identical no extraction is required. This * may help when a choice repeatedly tests the same character. */ rde_tc_get (p->TC, p->CL, &p->CC, &p->CC_len); | < | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | * * FUTURE :: keep track of what location the data stored in CC is * for. If the location is identical no extraction is required. This * may help when a choice repeatedly tests the same character. */ rde_tc_get (p->TC, p->CL, &p->CC, &p->CC_len); /* Note: BOUNDS(n) <=> [0..(n-1)]. * cc_len in [1..utfmax] <=> cc_len-1 in [0...utfmax-1] <=> BOUNDS(utfmax) */ ASSERT_BOUNDS (p->CC_len-1, TCL_UTF_MAX); p->ST = 1; ER_CLEAR (p); |
︙ | ︙ |