Skip to content
Snippets Groups Projects
  • Christopher J. Morrone's avatar
    a77aa3c3
    Make a better parser for node index lists. Negative numbers are allowed · a77aa3c3
    Christopher J. Morrone authored
    in index lists AND in ranges.  Here is how negative numbers work in
    ranges:
    
     If both numbers in a range are of the same sign (both positive, or both
     negative), then the range counts directly from the first number to the
     second number; it will not wrap around the "end" of the node list.
    
     If the numbers in a range differ in sign, the range wraps around the
     end of the list of nodes.
    
     Examples: Given a node allocation of foo[1-16]:
    
    	-2-3  (negative 2 to positive 3) becomes foo[15-16,1-4]
    	3--2  (positive 3 to negative 2) becomes foo[4,3,2,1,16,15]
    	-3--2 becomes foo[14-15]
    	-2--3 becomes foo[15,14]
    	2-3   becomes foo[3-4]
    	3-2   becomes foo[4,3]
    a77aa3c3
    History
    Make a better parser for node index lists. Negative numbers are allowed
    Christopher J. Morrone authored
    in index lists AND in ranges.  Here is how negative numbers work in
    ranges:
    
     If both numbers in a range are of the same sign (both positive, or both
     negative), then the range counts directly from the first number to the
     second number; it will not wrap around the "end" of the node list.
    
     If the numbers in a range differ in sign, the range wraps around the
     end of the list of nodes.
    
     Examples: Given a node allocation of foo[1-16]:
    
    	-2-3  (negative 2 to positive 3) becomes foo[15-16,1-4]
    	3--2  (positive 3 to negative 2) becomes foo[4,3,2,1,16,15]
    	-3--2 becomes foo[14-15]
    	-2--3 becomes foo[15,14]
    	2-3   becomes foo[3-4]
    	3-2   becomes foo[4,3]