| 35 | } |
| 36 | |
| 37 | export function parseInteger(value: string): number { |
| 38 | if ((/^0b([01]+)$/i).test(value)) { |
| 39 | return parseInt(value.substring(2), 2); |
| 40 | } |
| 41 | else if ((/^0x([0-9a-f]+)$/i).test(value)) { |
| 42 | return parseInt(value.substring(2), 16); |
| 43 | } |
| 44 | else if ((/^[0-9]+/i).test(value)) { |
| 45 | return parseInt(value, 10); |
| 46 | } |
| 47 | else if ((/^#[0-1]+/i).test(value)) { |
| 48 | return parseInt(value.substring(1), 2); |
| 49 | } |
| 50 | return undefined; |
| 51 | } |
| 52 | |
| 53 | export function parseDimIndex(spec: string, count: number): string[] { |
| 54 | if (spec.indexOf(',') !== -1) { |