]> ocean-lang.org Git - ocean/commitdiff
parsergen: change sort order for items.
authorNeilBrown <neilb@suse.de>
Sun, 21 Jul 2013 08:10:45 +0000 (18:10 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 21 Jul 2013 08:17:24 +0000 (18:17 +1000)
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 <neilb@suse.de>
csrc/parsergen.mdc

index 4ec6d6682339cca49b5c5de12858fdea3fe14f63..7b917b408d3cd7193504863dabca86b5a299918f 100644 (file)
@@ -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