From eeb98f44a148729b35f2a87c63dbfb46fe0925bc Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 21 Jul 2013 18:10:45 +1000 Subject: [PATCH] parsergen: change sort order for items. I want items with larger indexes to always preceed smaller indexes. This makes the report easier to follow. So negate the index number (and add an offset) when sorting. Signed-off-by: NeilBrown --- csrc/parsergen.mdc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index 4ec6d66..7b917b4 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -1003,7 +1003,7 @@ the list in the symset, and then only compare items before the first "0". ###### declarations static inline unsigned short item_num(int production, int index) { - return production | (((index-1)&0x1f) << 11); + return production | ((31-index) << 11); } static inline int item_prod(unsigned short item) { @@ -1011,7 +1011,7 @@ the list in the symset, and then only compare items before the first "0". } static inline int item_index(unsigned short item) { - return ((item >> 11)+1) & 0x1f; + return (31-(item >> 11)) & 0x1f; } For LR(1) analysis we need to compare not just the itemset in a state -- 2.43.0