/* Copyright 2010 Aaron J. Radke Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package cc.drx //TODO move the specific data should live relative to the own domain, this separate data section is odd object Data{ //--color val CSSColors:Map[String,Color] = Color.cssColorNames private val nom:String = "0123456789+-=()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ??????????" private val sup:String = "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ ᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂ ᵅᵝᵞᵟᵋᶿᶥᶲᵠᵡ" private val sub:String = "?????????????????????????????????????????????????????????????????????????????" /**Unicode superscript and subscript values https://stackoverflow.com/a/17909597/622016*/ def toSup(c:Char):Char = sup lift nom.indexOf(c) getOrElse c def toSub(c:Char):Char = sub lift nom.indexOf(c) getOrElse c //--text val Vowels = Set('a','e','i','o','u','A','E','I','O','U') val AlphaNumeric = (('0' to '9') ++ ('A' to 'Z') ++ ('a' to 'z')).toSet val Whitespace = "\t\n\r".toSet val Brackets:Map[Char,Char] = ("()[]<>{}“”‘’⟨⟩‹›«»⟦⟧⌊⌋⌈⌉⁽⁾₍₎⸤⸥⸢⸣❬❭❮❯❰❱".toList.grouped(2).flatMap{ case List(a,b) => List(a->b, b->a) case _ => List() }).toMap.withDefault(c => c) //https://en.wikipedia.org/w/index.php?title=Bracket§ion=24#Encoding_in_digital_media // case class Sep(value:String) extends AnyVal //TODO think about moving this elsewhere but elsewhere is not just data ??? object Ansi{ val EscapePat = "(\u009b|\u001b\\[)[0-?]*[ -\\/]*[@-~]".r //from fansi!https://github.com/lihaoyi/fansi from stackoverflow!http://stackoverflow.com/a/33925425/871202 from ecma!http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf val Field = "\u001f" val Record = "\u001e" val Space = "\u0020" val Escape = "\u001b" val Left = "\u001b" val Colon = ":" } //--Date //private lazy val days = Seq("mon", "tue", "wed", "thu", "fri", "sat", "sun") //--math lazy val Primes = (1 to 1000).filter{_.isPrime}.toArray //TODO make this a lazy stream, or idea: create this index at compile time.. val Radix36:IndexedSeq[Char] = ('0' to '9') ++ ('a' to 'z') ++ ('A' to 'Z') ++ Vector('_','-') val Radix64:IndexedSeq[Char] = ('A' to 'Z') ++ ('a' to 'z') ++ ('0' to '9') ++ Vector('+','/') val IntegerWords:Map[Int,String] = Map(0->"zero",1->"one", 2->"two", 3 ->"three", 4 -> "four", 5->"five", 6->"six", 7->"seven", 8->"eight",9->"nine",10->"ten",11->"eleven",12->"twelve", 13->"thirteen",14->"fourteen",15->"fifteen",16->"sixteen",17->"seventeen",18->"eighteen",19->"nineteen",20->"twenty",30->"thirty",40->"fourty",50->"fifty",60->"sixty",70->"seventy",80->"eighty",90->"ninety",100->"hundred",1E3.toInt->"thousand",1E6.toInt->"million",1E9.toInt->"billion") }