Requires

Provides

License:
MIT
Authors:
Yaroslaff Fedin
  1. 17
(function(exports) {

  1. 19
  2. 20
  3. 21
  4. 22
var combineRegExp = (typeof require == 'undefined') ? exports.combineRegExp : require('./sg-regex-tools').combineRegExp var SheetParser = exports.SheetParser

  1. 25
  2. 26
  3. 27
  4. 28
  5. 29
  6. 30
  7. 31
  8. 32
  9. 33
  10. 34
  11. 35
  12. 36
  13. 37
  14. 38
  15. 39
  16. 40
  17. 41
  18. 42
  19. 43
  20. 44
  21. 45
  22. 46
  23. 47
  24. 48
  25. 49
  26. 50
  27. 51
  28. 52
  29. 53
  30. 54
  31. 55
  32. 56
  33. 57
  34. 58
  35. 59
  36. 60
  37. 61
  38. 62
  39. 63
  40. 64
  41. 65
  42. 66
  43. 67
  44. 68
  45. 69
  46. 70
  47. 71
  48. 72
  49. 73
  50. 74
  51. 75
  52. 76
  53. 77
  54. 78
  55. 79
  56. 80
  57. 81
  58. 82
  59. 83
  60. 84
  61. 85
  62. 86
  63. 87
  64. 88
  65. 89
  66. 90
  67. 91
  68. 92
  69. 93
  70. 94
  71. 95
  72. 96
  73. 97
  74. 98
  75. 99
  76. 100
  77. 101
  78. 102
  79. 103
  80. 104
  81. 105
  82. 106
  83. 107
  84. 108
var Value = SheetParser.Value = {version: '1.0.2 dev'}; Value.translate = function(value) { var found, result = [], matched = [], scope = result, func, text; var regex = Value.tokenize; var names = regex.names; while (found = regex.exec(value)) matched.push(found); for (var i = 0; found = matched[i++];) { if (func = found[names['function']]) { var obj = {}; var translated = obj[found[names['function']]] = Value.translate(found[names._arguments]); for (var j = 0, bit; bit = translated[j]; j++) if (bit && bit.length == 1) translated[j] = bit[0]; scope.push(obj); } else if (found[names.comma]) { if (!result[0].push) result = [result]; result.push(scope = []); } else if (found[names.whitespace]) { var length = scope.length; if (length && (scope == result) && !scope[length - 1].push) scope = scope[length - 1] = [scope[length - 1]]; } else if (text = (found[names.dstring] || found[names.sstring])) { scope.push(text) } else if (text = found[names.token]) { if (!text.match(Value.hex)) { var match = Value.length.exec(text); Value.length.lastIndex = 0; if (match) { var number = parseFloat(match[1]); text = match[2] ? {number: number, unit: match[2]} : number; } else if (!text.match(Value.keyword)) return false; } scope.push(text); } } return result.length == 1 ? result[0] : result; } var x = combineRegExp var OR = '|' var rRound = "(?:[^()]|\\((?:[^()]|\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\))*\\))"; ;(Value.stringDouble = x(/"((?:[^"]|\\")*)"/)).names = ['dstring'] ;(Value.stringSingle = x(/'((?:[^']|\\')*)'/)).names = ['sstring'] ;(Value.string = x([Value.stringSingle, OR, Value.stringDouble])) ;(Value.keyword = x(/[-a-zA-Z0-9]+/, "keyword")) ;(Value.token = x(/[^$,\s\/)]+/, "token")) ;(Value['function'] = x("([-a-zA-Z0-9]+)\\((" + rRound + "*)\\)")) .names = [ 'function', '_arguments'] ;(Value.integer = x(/-?\d+/)) ;(Value.float = x(/-?\d+\.\d*/)) ;(Value.number = x(['(', Value.float, OR, Value.integer, ')'])) .names = [ 'number'] ;(Value.unit = x(/em|px|pt|%|fr/, 'unit')) ;(Value.length = x(['^', Value.number, Value.unit, "?$"])) ;(Value.direction = x(/top|left|bottom|right|center/, 'direction')) ;(Value.position = x([Value.length, OR, Value.direction])) ;(Value.hex = x(/#[0-9a-z]+/, 'hex')) ;(Value.comma = x(/\s*,\s*/, 'comma')) ;(Value.whitespace = x(/\s+/, 'whitespace')) ;(Value.slash = x(/\//, 'slash')) Value.tokenize = x ( [ x(Value['function']), , OR , x(Value.comma) , OR , x(Value.whitespace) , OR , x(Value.slash) , OR , x(Value.string) , OR , x(Value.token) ] ) })(typeof exports != 'undefined' ? exports : this);