Helper to analyze and parse designtime variables

@private
432003
function getDesigntimePropertyAsArray(sValue) {
			var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
			return (m && m[2]) ? m[2].split(/,/) : null;
		}
70578
function parsePropertyList( root, libs, com, indent ) {
  var first = true;
  var out = '[';
  libs.compileChildren( root );
  root.children.forEach( function( child ) {
    if ( child.type != libs.Tree.TAG ) {
      if ( child.type == libs.Tree.TEXT || child.type == libs.Tree.ENTITY ) {
        if ( child.text.trim( ).length === 0 ) {
          return;
        }
        if ( first ) {
          first = false;
        } else {
          out += ",";
        }
        out += "\n" + indent + JSON.stringify( child.text );
      }
      return;
    }
    if ( first ) {
      first = false;
    } else {
      out += ",";
    }
    out += "\n" + indent;
    if (isWidget( child )) {
      out += parseWidget( child, libs, com, indent + '  ' );
    } else {
      out += parseElement( child, libs, com, indent + '  ' );
    }
  });

  out += ']';
  com.prop[root.name] = out;
}
390253
function loadOwnDesignTime(oMetadata) {
		if (isPlainObject(oMetadata._oDesignTime) || !oMetadata._oDesignTime) {
			return Promise.resolve(oMetadata._oDesignTime || {});
		}

		return new Promise(function(fnResolve) {
			var sModule;
			if (typeof oMetadata._oDesignTime === "string") {
				//oMetadata._oDesignTime points to resource path to another file, for example: "sap/ui/core/designtime/<control>.designtime"
				sModule = oMetadata._oDesignTime;
			} else {
				sModule = oMetadata.getName().replace(/\./g, "/") + ".designtime";
			}
			preloadDesigntimeLibrary(oMetadata).then(function(oLib) {
				sap.ui.require([sModule], function(mDesignTime) {
					mDesignTime.designtimeModule = sModule;
					oMetadata._oDesignTime = mDesignTime;
					mDesignTime._oLib = oLib;
					fnResolve(mDesignTime);
				});
			});
		});
	}
656287
private String[] getDatePatterns(ProjectProperties properties)
   {
      String pattern = "";

      char datesep = properties.getDateSeparator();
      DateOrder dateOrder = properties.getDateOrder();

      switch (dateOrder)
      {
         case DMY:
         {
            pattern = "dd" + datesep + "MM" + datesep + "yy";
            break;
         }

         case MDY:
         {
            pattern = "MM" + datesep + "dd" + datesep + "yy";
            break;
         }

         case YMD:
         {
            pattern = "yy" + datesep + "MM" + datesep + "dd";
            break;
         }
      }

      return new String[]
      {
         pattern
      };
   }
653374
function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
  const { setZone, zone } = opts;
  if (parsed && Object.keys(parsed).length !== 0) {
    const interpretationZone = parsedZone || zone,
      inst = DateTime.fromObject(
        Object.assign(parsed, opts, {
          zone: interpretationZone,
          // setZone is a valid option in the calling methods, but not in fromObject
          setZone: undefined
        })
      );
    return setZone ? inst : inst.setZone(zone);
  } else {
    return DateTime.invalid(
      new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
    );
  }
}
510496
function (v) {
/*Line 401 - 'Atom.js' */        if (!v)
/*Line 402 - 'Atom.js' */            return null;
/*Line 403 - 'Atom.js' */        var d = AtomDate.parse(v);
/*Line 404 - 'Atom.js' */        var now = new Date();

/*Line 406 - 'Atom.js' */        if (now.getFullYear() === d.getFullYear()
/*Line 407 - 'Atom.js' */            && now.getMonth() === d.getMonth()) {
/*Line 408 - 'Atom.js' */            var diff = now.getDate() - d.getDate();
/*Line 409 - 'Atom.js' */            switch(diff){
/*Line 410 - 'Atom.js' */                case -1:
/*Line 411 - 'Atom.js' */                    return "Tomorrow (" + AtomDate.toTimeString(d) + ")";
/*Line 412 - 'Atom.js' */                case 0:
/*Line 413 - 'Atom.js' */                    return "Today (" + AtomDate.toTimeString(d) + ")";
/*Line 414 - 'Atom.js' */                case 1:
/*Line 415 - 'Atom.js' */                    return "Yesterday (" + AtomDate.toTimeString(d) + ")";
/*Line 416 - 'Atom.js' */            }
/*Line 417 - 'Atom.js' */        }
/*Line 418 - 'Atom.js' */        return AtomDate.toDateTimeString(d);
/*Line 419 - 'Atom.js' */    }
360573
function parseVariableIdentifier() {
        var token = lex();

        if (token.type !== Token.Identifier) {
            throwUnexpected(token);
        }

        return {
            type: Syntax.Identifier,
            name: token.value
        };
    }
1087085
def get_time_variable(ds):
    '''
    
    '''
    for var in ds.variables:
        if getattr(ds.variables[var], 'axis', '') == 'T':
            return var
    else:
        candidates = ds.get_variables_by_attributes(standard_name='time')
        if len(candidates) == 1:
            return candidates[0].name
        else:  # Look for a coordinate variable time
            for candidate in candidates:
                if candidate.dimensions == (candidate.name,):
                    return candidate.name

    # If we still haven't found the candidate
    time_variables = set(get_time_variables(ds))
    coordinate_variables = set(get_coordinate_variables(ds))
    if len(time_variables.intersection(coordinate_variables)) == 1:
        return list(time_variables.intersection(coordinate_variables))[0]

    auxiliary_coordinates = set(get_auxiliary_coordinate_variables(ds))
    if len(time_variables.intersection(auxiliary_coordinates)) == 1:
        return list(time_variables.intersection(auxiliary_coordinates))[0]
    return None
908744
function () {
		var self = this,
			dates = Object.keys(this.parse_tree),
			lines = [];
		
		dates.sort();
		dates.forEach(function (dy, i) {
			var times = Object.keys(self.parse_tree[dy]);
			lines.push(dy);
			times.sort();
			times.forEach(function (tm) {
				var tags = "", maps = "", notes = "", rec;
				
				rec = self.parse_tree[dy][tm];
				if (typeof rec === "string") {
					notes = rec;
				} else {
					if (typeof rec.map !== "undefined" &&
							rec.map !== false) {
						maps = [
							rec.map.project_name,
							rec.map.task
						].join(", ") + "; ";
					}
					if (typeof rec.tags !== "undefined" &&
							rec.tags !== false) {
						tags = rec.tags.join(", ") + "; ";
					}
					if (typeof rec.notes !== "undefined") {
						notes = rec.notes;
					}
				}

				lines.push([
					tm,
					"; ",
					tags,
					maps,
					notes
				].join(""));
			});
		});
		
		return lines.join("\n\n");
	}
47771
function parseProperties(source, baseDirectory) {
  // Get the raw SCSS concrete syntax tree.
  const rawTree = parseCSS(source);
  removeWhitespace(rawTree);

  // Convert the concrete syntax tree into a more convenient AST.
  let schema
  const rootRules = []
  for (const rule of rawTree.value) {
    if (rule.type === 'atrule') {
      removeWhitespace(rule);
      const [keyword, argument] = rule.value;
      if (keyword.value === 'schema') {
        schema = visitSchema(argument, baseDirectory)
      } else if (keyword.value === 'import') {
        rootRules.push(...visitImport(argument, baseDirectory))
      }
    } else {
      rootRules.push(visitRule(rule, false))
    }
  }

  // Flatten out any nested selectors.
  const rules = []
  for (const rootRule of rootRules) {
    flattenRule(rootRule, rules, [[]]);
  }

  const validator = new Validator();

  for (const rule of rules) {
    // Validate each rule's properties against the schema.
    for (const property in rule.properties) {
      if (schema) {
        const propertySchema = schema[property]
        const value = rule.properties[property]
        if (!propertySchema) {
          throw new Error(`Property '${property}' is not present in the schema`);
        }
        const {errors} = validator.validate(value, propertySchema);
        if (errors.length > 0) {
          throw new Error(`Invalid value '${value}' for property '${property}'`)
        }
      }
    }

    rule.selectors = rule.selectors.map(applyPseudoClasses)
  }

  return rules;
}
1102661
function decodeRangeTime(map, timeStr){
  let times = timeStr.split('-');

  times[0] = Number(times[0]);
  times[1] = Number(times[1]);
  if(times[0] > times[1]){
    console.log("Error time range");
    return null;
  }

  for(let i = times[0]; i <= times[1]; i++){
    map[i] = i;
  }
}
349426
function parseIncludes(codes, includes) {
    const result = {};
    for (const id of Object.keys(codes)) {
        const code = codes[id];
        result[id] = code.split('\n').map(function(line) {
            if (line.trim().substr(0, 8) !== '#include') return line;
            const pos = line.indexOf('#include') + 8;
            let includeName = line.substr(pos).trim();
            // We accept all this systaxes:
            // #include foo
            // #include 'foo'
            // #include <foo>
            // #include "foo"
            if ("'<\"".indexOf(includeName.charAt(0)) > -1) {
                includeName = includeName.substr(1, includeName.length - 2);
            }
            const snippet = includes[includeName];
            if (typeof snippet !== 'string') {
                console.error("Include <" + includeName + "> not found in ", includes);
                throw Error("Include not found in shader: " + includeName);
            }
            return snippet;
        }).join("\n");
    }
    return result;
}
1140869
private Identifier parseLifetime(EnclosingScope scope, boolean terminated) {
		Identifier id = parseOptionalLifetimeIdentifier(scope, terminated);
		if (id != null) {
			return id;
		} else {
			syntaxError("expecting lifetime identifier", tokens.get(index));
		}
		throw new RuntimeException("deadcode"); // dead-code
	}
1291613
function (v) {
/*Line 426 - 'Atom.js' */        var d = AtomDate.parse(v);
/*Line 427 - 'Atom.js' */        return {
/*Line 428 - 'Atom.js' */            Year: d.getFullYear(),
/*Line 429 - 'Atom.js' */            Month: d.getMonth() + 1,
/*Line 430 - 'Atom.js' */            Date: d.getDate(),
/*Line 431 - 'Atom.js' */            Hours: d.getHours(),
/*Line 432 - 'Atom.js' */            Minutes: d.getMinutes(),
/*Line 433 - 'Atom.js' */            Seconds: d.getSeconds(),
/*Line 434 - 'Atom.js' */            Offset: AtomDate.zoneOffsetMinutes
/*Line 435 - 'Atom.js' */        };
/*Line 436 - 'Atom.js' */    }
789576
async function initializeRealtime({ getApp, onCreate, onDelete, url, token }) {
  const realtimeConfig = { token, url }

  try {
    realtime
      .subscribe(realtimeConfig, APPS_DOCTYPE)
      .onCreate(async app => {
        // Fetch directly the app to get attributes `related` as well.
        let fullApp
        try {
          fullApp = await getApp(app.slug)
        } catch (error) {
          throw new Error(`Cannot fetch app ${app.slug}: ${error.message}`)
        }

        if (typeof onCreate === 'function') {
          onCreate(fullApp)
        }
      })
      .onDelete(app => {
        if (typeof onDelete === 'function') {
          onDelete(app)
        }
      })
  } catch (error) {
    console.warn(`Cannot initialize realtime in Cozy-bar: ${error.message}`)
  }
}
748236
function (v) {
/*Line 86 - 'AtomDateField.js' */                if (this._set_timeCalled)
/*Line 87 - 'AtomDateField.js' */                    return;
/*Line 88 - 'AtomDateField.js' */                this._set_timeCalled = true;
/*Line 89 - 'AtomDateField.js' */                if (v) {
/*Line 90 - 'AtomDateField.js' */                    this._time = v;
/*Line 91 - 'AtomDateField.js' */                    var d = AtomDate.setTime(this.get_value(), v);
/*Line 92 - 'AtomDateField.js' */                    AtomBinder.setValue(this, "value", d);
/*Line 93 - 'AtomDateField.js' */                }
/*Line 94 - 'AtomDateField.js' */                this._set_timeCalled = false;
/*Line 95 - 'AtomDateField.js' */            }
1220764
function findUnusedVariableDeclarators (ast) {
  var unused = [];
  traverse.traverse(ast, {
    enter: function (node, parent) {
      var scope, refs;
      if (node.type === 'VariableDeclarator' && (scope = findScope(ast, node))) {
        refs = fast.filter(findVariableReferences(scope, node.id), function (item) {
          return item !== node.id;
        });

        if (!refs.length) {
          unused.push(node);
        }
      }
    }
  });
  return unused;
}