function DFS(o, callback, type, visited) {
        visited = visited || {};

        var objId = _.util.objId;

        for (var i in o) {
          if (o.hasOwnProperty(i)) {
            callback.call(o, i, o[i], type || i);

            var property = o[i],
              propertyType = _.util.type(property);

            if (propertyType === "Object" && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, null, visited);
            } else if (propertyType === "Array" && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, i, visited);
            }
          }
        }
      }
// Traverse a language definition with Depth First Search
Traverse a language definition with Depth First Search
Traverse a language definition with Depth First Search
function DFS(o, callback, type, visited) {
        visited = visited || {};
        var objId = _.util.objId;
        for (var i in o) {
          if (o.hasOwnProperty(i)) {
            callback.call(o, i, o[i], type || i);
            var property = o[i],
              propertyType = _.util.type(property);
            if (propertyType === "Object" && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, null, visited);
            } else if (propertyType === "Array" && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, i, visited);
            }
          }
        }
      }
function DFS ( o , callback , type , visited ) { visited = visited || { } ; var objId = _ . util . objId ; for ( var i in o ) { if ( o . hasOwnProperty ( i ) ) { callback . call ( o , i , o [ i ] , type || i ) ; var property = o [ i ] , propertyType = _ . util . type ( property ) ; if ( propertyType === "Object" && ! visited [ objId ( property ) ] ) { visited [ objId ( property ) ] = true ; DFS ( property , callback , null , visited ) ; } else if ( propertyType === "Array" && ! visited [ objId ( property ) ] ) { visited [ objId ( property ) ] = true ; DFS ( property , callback , i , visited ) ; } } } }
Traverse a language definition with Depth First Search
Traverse a language definition with Depth First Search