SHARE
TWEET

hl-num-test

a guest Oct 5th, 2012 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; Examples taken from plt-4.2/collects/tests/mzscheme/numstrs.ss
  2. ;;
  3. ;; Original notes:
  4. ;;   #f means a symbol
  5. ;;   X means fails (syntax forces it to be a number)
  6. ;;   DBZ means fails because divide-by-zero
  7. ;;   NOE means fails because no such exact
  8.  
  9. ;; mz extension tests taken from
  10. ;; plt-4.2/collects/tests/syntax-color/scheme-lexer.ss
  11.  
  12. ;--- These SHOULD highlight as numbers -----------------------------------------
  13.  
  14. (+ 1/2 +i) 1/2+i
  15. (100 100)
  16. (100 #d100)
  17. (0.1 .1)
  18. (0.1 #d.1)
  19. (1/20000 #e1/2e-4)
  20. (10.0 1e1)
  21. (10.0 1E1)
  22. (10.0 1s1)
  23. (10.0 1S1)
  24. (10.0 1f1)
  25. (10.0 1F1)
  26. (10.0 1l1)
  27. (10.0 1L1)
  28. (10.0 1d1)
  29. (10.0 1D1)
  30. (0.0 0e13)
  31. (0.0 #i0)
  32. (-0.0 #i-0)
  33. (+inf.0 .3e2666666666)
  34. (+inf.0 +INF.0)
  35. (+nan.0 +NaN.0)
  36. (+inf.0 1e500)
  37. (-inf.0 -1e500)
  38. (0.0 1e-500)
  39. (-0.0 -1e-500)
  40. (+inf.0 1#e500)
  41. (-inf.0 -1#e500)
  42. (0.0 1#e-500)
  43. (-0.0 -1#e-500)
  44. (+inf.0 1e10000000000000000000000000000000)
  45. (-inf.0 -1e10000000000000000000000000000000)
  46. (+inf.0 1#e10000000000000000000000000000000)
  47. (-inf.0 -1#e10000000000000000000000000000000)
  48. (+0.0 1e-10000000000000000000000000000000)
  49. (-0.0 -1e-10000000000000000000000000000000)
  50. (+0.0 1#e-10000000000000000000000000000000)
  51. (-0.0 -1#e-10000000000000000000000000000000)
  52. (10.0 1#)
  53. (10.0 1#e0)
  54. (10.0 1####e-3)
  55. (10.0 1#.e0)
  56. (10.0 10.#e0)
  57. (10.0 10.e0)
  58. (10.0 1#.e0)
  59. (10.0 10.0#e0)
  60. (10.0 1#.##e0)
  61. (10 #e1#)
  62. (10 #e1#e0)
  63. (10 #e1#.e0)
  64. (5e-5 1/2e-4)
  65. (5e-5 #i1/2e-4)
  66. (0.5 #i1/2)
  67. (1/2 #e1/2)
  68. (0.5 #i0.5)
  69. (1/2 #e0.5)
  70. (1/20 #e0.5e-1)
  71. (1/20 #e0.005e1)
  72. (1.0+0.5i 1+0.5i)
  73. (1/2 1/2@0)
  74. (-1/2 -1/2@0)
  75. (1/2 1/2@-0)
  76. (0 #o#e0)
  77. (8 #o#e10)
  78. (0 #b#e0)
  79. (0.0 #b#i0)
  80. (4.0 #b1e10)
  81. (4 #b#e1e10)
  82. (1/10+1/5i #e0.1+0.2i)
  83. (0.0+80.0i #i+8#i)
  84. (521976 #x7f6f8)
  85. (1+8i #b#e1+1#e10i)
  86. (1.125 #x1.2)
  87. (1.1640625 #x1.2a)
  88. (1.1640625 #x1.2a####)
  89. (10.0 #xa.)
  90. (10.25 #xa.4)
  91. (160.0 #xa#.)
  92. (416.0 #x1a#.)
  93. (2816.0 #xb##.##)
  94. (4e62 #i4000000000000000000000000000000000000000000000000000000000000e2)
  95. (-0.0 #b-0.0)
  96. (+nan.0+1i +nan.0+1i)
  97. (1+nan.0i 1+nan.0i)
  98. (0.5+nan.0i 1/2+nan.0i)
  99. (1+inf.0i 1+inf.0i)
  100. (1-inf.0i 1-inf.0i)
  101. (+inf.0i +inf.0i)
  102. (-inf.0i -inf.0i)
  103. (+nan.0i +nan.0i)
  104. (-nan.0i -nan.0i)
  105. (+inf.0i +INF.0i)
  106. (-inf.0-nan.0i -inf.0-nan.0i)
  107. (+nan.0@1 +nan.0@1)
  108. (+inf.0@1 +inf.0@1)
  109. (1@+inf.0 1@+inf.0)
  110. (1@+inf.0 1/1@+inf.0)
  111. (+inf.0@1 +inf.0@1/1)
  112. (1.0+0.0i 1@0000.0)
  113. (1.0 0001.0@0)
  114. (#i10/3 1#/3)
  115. (#i1/300 1/3##)
  116. (#i10/3 #d1#/3)
  117. (+inf.0 1/0#)
  118. (-inf.0 -1/0#)
  119. (500.0 1/2#e4)
  120. (5000.0 1#/2#e4)
  121. (500000000.0 1/2#e10)
  122. (500000000 #e1/2#e10)
  123. (16140901064495857664-50176i #e#x+e#s+e@-e#l-e)
  124.  
  125. (NOE #e+inf.0)
  126. (NOE #e-inf.0)
  127. (NOE #e+nan.0)
  128. (NOE #e1/0#)
  129.  
  130. (DBZ 1/0)
  131. (DBZ 5+1/0i)
  132. (DBZ 1/0+5i)
  133. (DBZ 5@1/0)
  134. (DBZ 1/0@5)
  135. (DBZ 1/0e2)
  136. (DBZ 1/0+inf.0i)
  137. (DBZ +inf.0+1/0i)
  138. (DBZ 1/0@+inf.0)
  139. (DBZ +inf.0@1/0)
  140.  
  141. ;; Numbers (mzscheme extensions)
  142.  
  143. #b1.1
  144. #o1.1
  145. #d1.1
  146. #xa.F
  147. #b1e+1
  148. #o1E+2
  149. #d1E+2
  150. #b1D+1
  151. #o1d+2
  152. #d1d+2
  153. 1/2e2
  154. +iNf.0
  155. -InF.0
  156. +naN.0
  157. -nAN.0
  158. -inf.0+1i
  159. 1-inf.0I
  160.  
  161. 1.+i
  162. 1.-i
  163.  
  164. ; sad panda :(
  165.  
  166. +.1
  167. -.1
  168.  
  169. ; </sad panda>
  170.  
  171. ;--- These should NOT highlight as numbers (though ssyntax is fine) ------------
  172.  
  173. (#f 1.0/3)
  174. (#f 1/3.0)
  175. (#f 1#/#3)
  176. (#f d)
  177. (#f i)
  178. (#f 3i)
  179. (#f 33i)
  180. (#f 3.3i)
  181. (#f e)
  182. (#f e1)
  183. (#f e1)
  184. (#f -)
  185. (#f +)
  186. (#f +.)
  187. (#f /)
  188. (#f +1+1)
  189. (#f +1/+1)
  190. (#f 1//2)
  191. (#f mod//)
  192. (#f -1.0/2)
  193. (#f /2)
  194. (#f 2..)
  195. (#f .2.)
  196. (#f 1#.0e4)
  197. (#f 1#0e4)
  198. (#f 1#0.e4)
  199. (#f 1##.##0e4)
  200. (#f 2i)
  201. (#f /2i)
  202. (#f 2@2i)
  203. (#f 2@@2)
  204. (#f -2@-+2)
  205. (#f 1/1-e4)
  206. (#f 1.-2)
  207. (#f --1)
  208. (#f -+1)
  209. (#f -1+3-4)
  210. (#f 1\0002)
  211. (#f 4ef5)
  212. (#f 1/0+hi)
  213. (#f x+1/0i)
  214. (#f 1++nan.0i)
  215. (#f 1++inf.0i)
  216. (#f +inf.0@1@1)
  217. (#f +inf.0@3@0)
  218. (#f +inf.0@3+4i)
  219. (#f +ina.0)
  220. (#f 1@3+4i)
  221. (#f @2)
  222. (#f +a@2)
  223. (#f 1e1/0)
  224. (#f 011111122222222223333333333444444x)
  225.  
  226. (X #b1000000000020e1)
  227. (X #d1#/#3)
  228. (X #e-)
  229. (X #e+)
  230. (X #i-)
  231. (X #i+)
  232. (X #e+.)
  233. (X #e2..)
  234. (X #e.2.)
  235. (X #xg)
  236. (X #x)
  237. (X #xa#a)
  238. (X #i#j0)
  239. (X #x12.a#b)
  240. (X #e1.-2)
  241. (X #b#b0)
  242. (X #b#o0)
  243. (X #i#i0)
  244. (X #e#e0)
  245. (X #i8#i)
  246. (X #i4@#i5)
  247. (X #i4+#d6i)
  248. (X #i4+#d6)
  249. (X #e4ef5)
  250. (X #d1e)
  251. (X #b1e)
  252. (X #o1e)
  253.  
  254. foldl1
  255. p2p
  256. 1up
  257. 127.0.0.1
  258. +.1.2
  259. (foldl1 1up p2p)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top