 multident = (code, tab) ->
   code = code.replace /\n/g, '$&' + tab
   code.replace /\s+$/, ''
+
+# Parse a number (+- decimal/hexadecimal)
+# Examples: 0, -1, 1, 2e3, 2e-3, -0xfe, 0xfe
+parseNum = (x) ->
+  if not x?
+    0
+  else if x.match HEXNUM
+    parseInt x, 16
+  else
+    parseFloat x


    # Generate the condition.
    condPart = if @stepNum
      if +@stepNum > 0 then "#{lt} #{@toVar}" else "#{gt} #{@toVar}"
    else if known
      [from, to] = [+@fromNum, +@toNum]
      if from <= to then "#{lt} #{to}" else "#{gt} #{to}"
    else
      cond = if @stepVar then "#{@stepVar} > 0" else "#{@fromVar} <= #{@toVar}"

    kvarAssign = if kvar isnt ivar then "#{kvar} = " else ""
    if @step and not @range
      [step, stepVar] = @cacheToCodeFragments @step.cache o, LEVEL_LIST
      stepNum = stepVar.match NUMBER
    name      = ivar if @pattern
    varPart   = ''
    guardPart = ''
