BVB Source Codes

reactide Show brackets.js Source code

Return Download reactide: download brackets.js Source code - Download reactide Source code - Type:.js
  1. (function() {
  2.   var brackets, last;
  3.  
  4.   last = function(array) {
  5.     return array[array.length - 1];
  6.   };
  7.  
  8.   brackets = {
  9.     parse: function(str) {
  10.       var current, j, len, stack, sym;
  11.       current = [''];
  12.       stack = [current];
  13.       for (j = 0, len = str.length; j < len; j++) {
  14.         sym = str[j];
  15.         if (sym === '(') {
  16.           current = [''];
  17.           last(stack).push(current);
  18.           stack.push(current);
  19.         } else if (sym === ')') {
  20.           stack.pop();
  21.           current = last(stack);
  22.           current.push('');
  23.         } else {
  24.           current[current.length - 1] += sym;
  25.         }
  26.       }
  27.       return stack[0];
  28.     },
  29.     stringify: function(ast) {
  30.       var i, j, len, result;
  31.       result = '';
  32.       for (j = 0, len = ast.length; j < len; j++) {
  33.         i = ast[j];
  34.         if (typeof i === 'object') {
  35.           result += '(' + brackets.stringify(i) + ')';
  36.         } else {
  37.           result += i;
  38.         }
  39.       }
  40.       return result;
  41.     }
  42.   };
  43.  
  44.   module.exports = brackets;
  45.  
  46. }).call(this);
  47.  
downloadbrackets.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top