/*
Note that both an empty Set and an empty Map are represented by {}. The
parser will always parse {} as an empty Set and special handling is required
to convert it to an empty Map when appropriate.
196264
final public void MapData() throws ParseException {
                          /*@bgen(jjtree) MapData */
  AstMapData jjtn000 = new AstMapData(JJTMAPDATA);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(START_SET_OR_MAP);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case START_SET_OR_MAP:
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
      case TRUE:
      case FALSE:
      case NULL:
      case LPAREN:
      case LBRACK:
      case NOT0:
      case NOT1:
      case EMPTY:
      case MINUS:
      case IDENTIFIER:
        MapEntry();
        label_18:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[46] = jj_gen;
            break label_18;
          }
          jj_consume_token(COMMA);
          MapEntry();
        }
        break;
      default:
        jj_la1[47] = jj_gen;
        ;
      }
      jj_consume_token(RBRACE);
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
876541
public static <T> Collection<T> valuesOrEmpty(Map<String, Collection<T>> map, String key) {
    return map.containsKey(key) && map.get(key) != null ? map.get(key) : Collections.<T>emptyList();
  }
1362032
function(map, key, value) {

    var list = [];

    if (map.has(key)) {

      list = map.get(key);

      if (!list) {
        list = [];
      }


    }
    list.push(value);
    map.set(key, list);

}
1176961
function supportsMapAndSet() {
  if (typeof Symbol === 'undefined' || typeof Map === 'undefined' || typeof Set === 'undefined') {
    return false;
  }
  var prop = Object.getOwnPropertyDescriptor(Map, Symbol.species);
  return prop && 'get' in prop && Map[Symbol.species] === Map;
}
1281449
@SuppressWarnings("unchecked")
	protected Map<String, Object> getNestedMap(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return Collections.emptyMap();
		}
		return (Map<String, Object>) value;
	}
1117106
@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public Object parse(String source) throws Exception {

		// Parse source
		Tree node = new Tree();
		LinkedProperties properties = new LinkedProperties();
		properties.load(new StringReader(source));
		LinkedHashMap<Object, Object> map = properties.map;

		final HashMap<String, Boolean> zeroIndexes = new HashMap<>();
		final HashMap<String, Boolean> arrays = new HashMap<>();

		// Convert Map to Node
		final StringBuilder path = new StringBuilder();
		for (Map.Entry<Object, Object> entry : map.entrySet()) {
			String key = (String) entry.getKey();
			String value = (String) entry.getValue();

			final StringTokenizer st = new StringTokenizer(key, ". ");
			path.setLength(0);
			while (st.hasMoreTokens()) {
				String token = st.nextToken();

				String prefix = path.toString();
				Boolean array = arrays.get(prefix);

				boolean number;
				if (array != null && !array) {
					number = false;
				} else {
					number = isNumeric(token);
				}

				if (number && array == null) {

					// Analyze array
					array = true;
					final ArrayList<Integer> indexes = new ArrayList<>();
					for (Object o : map.keySet()) {
						String t = (String) o;
						if (t.startsWith(prefix)) {
							int l = prefix.length() + 1;
							int i = t.indexOf('.', l);
							if (i > -1) {
								t = t.substring(l, i);
							} else {
								t = t.substring(l);
							}
							if (isNumeric(t)) {
								int idx = Integer.parseInt(t);
								if (indexes.contains(idx) && i == -1) {

									// Double index!
									array = false;
									break;
								}
								indexes.add(idx);
							} else {

								// Not numeric!
								array = false;
								break;
							}
						}
					}

					// Check index sequence (1,2,3,etc.)
					Collections.sort(indexes);
					int prev = Integer.MIN_VALUE;
					for (int idx : indexes) {
						if (prev == Integer.MIN_VALUE) {

							// First element is not "0" or "1"
							if (idx != 0 && idx != 1) {
								array = false;
								break;
							}

						} else if (prev - idx > 1) {

							// Not sequential!
							array = false;
							break;
						}
						prev = idx;
					}

					arrays.put(prefix, array);
					if (array) {
						String test = prefix + ".0";
						boolean zeroIndex = false;
						for (Object o : map.keySet()) {
							if (((String) o).startsWith(test)) {
								zeroIndex = true;
								break;
							}
						}
						zeroIndexes.put(prefix, zeroIndex);
					} else {
						number = false;
					}
				}

				if (number) {
					path.append('[');
					int idx = Integer.parseInt(token);
					if (!zeroIndexes.get(prefix)) {
						idx--;
					}
					path.append(idx);
					path.append(']');
				} else {
					if (path.length() > 0) {
						path.append('.');
					}
					path.append(token);
				}

			}
			node.put(path.toString(), (String) value);
		}

		// Store first indexes in metadata block
		Object result = node.asObject();
		if (!zeroIndexes.isEmpty()) {
			Tree meta = node.getMeta();
			Tree indexMap = meta.putMap(FIRST_INDEX);
			for (Map.Entry<String, Boolean> entry : zeroIndexes.entrySet()) {
				indexMap.put(entry.getKey(), entry.getValue() ? 0 : 1);
			}

			// Pushback metadata into the value map
			if (result instanceof Map) {
				((Map) result).put(Config.META, meta.asObject());
			}
		}
		return result;
	}
1224417
def _qualify_map(key, content):
    
    if not isinstance(key, basestring):
        return key, content

    min_len  = None
    max_len  = None
    modifier = []
    m        = RE_MATCH_CSTR(key)

    if not m:
        raise KeyError("Unable to parse, invalid key: %r" % key)

    if m.group(3) is not None:
        min_len = max_len = int(m.group(3))
    elif m.group(4) is not None:
        if m.group(4):
            min_len = int(m.group(4))
        else:
            min_len = 0
        if m.group(5):
            max_len = int(m.group(5))
    elif m.group(6) == '*':
        min_len = 0
    elif m.group(6) == '+':
        min_len = 1
    elif m.group(6) == '?':
        min_len = 0
        max_len = 1

    if m.group(7):
        modifier = m.group(7).split(',')

    if m.group(8) == '-':
        modifier.append('strip')

    if m.group(2) == '*':
        return m.group(1), OptionalNull(content, min_len, max_len, modifier)
    elif m.group(2) == '?':
        return m.group(1), Optional(content, min_len, max_len, modifier)
    elif m.group(2) == '+':
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
    else:
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
488951
public static <T> Set<T> nullToEmpty(final Set<T> set) {
        return set == null ? N.<T> emptySet() : set;
    }
250909
private String _serializeMap(Map map, Set<Object> done) throws ConverterException {
	StringBuilder sb = new StringBuilder(goIn() + "<struct>");

	Iterator it = map.keySet().iterator();

	deep++;
	while (it.hasNext()) {
	    Object key = it.next();
	    sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">");
	    sb.append(_serialize(map.get(key), done));
	    sb.append(goIn() + "</var>");
	}
	deep--;

	sb.append(goIn() + "</struct>");
	return sb.toString();
    }
713007
function(parser) {
    return highland.map(function(item) {
      if (_.isFunction(parser)) {
        return parser(item);
      }
      if (_.isObject(parser) && (parser.parse != null)) {
        return parser.parse(item);
      }
      return item;
    });
  }
811155
function ensureMap(set) {
            if (!set['[[SetData]]']) {
              var m = set['[[SetData]]'] = new collectionShims.Map();
              Object.keys(set._storage).forEach(function(k) {
                // fast check for leading '$'
                if (k.charCodeAt(0) === 36) {
                  k = k.substring(1);
                } else {
                  k = +k;
                }
                m.set(k, k);
              });
              set._storage = null; // free old backing storage
            }
          }
1140889
public static Map<Object,Object> parse(List<String>   args)
	{
		final short START =1, VAL=2;
		short state = START;
		Map<Object,Object> map = new HashMap<>(args.size());
		
		String key=null,value=null;
		for (String arg : args)
		{
			arg = arg.trim();
			
			switch(state)
			{
				case START: 
					
					if(arg.startsWith("-"))
						arg = Text.replaceForRegExprWith(arg, "^-*", "");
					
					if(arg.contains("="))
					{
						String[] tokens = Text.splitRE(arg, "=");
						if(tokens.length == 2)
						{
							key = tokens[0];
							value = tokens[1];
							
							map.put(key, formatValue(value));
							
							state = START;
						}
					}
					else
					{
						key = arg;
						state = VAL;
					}
					
					System.out.println("key:"+key);
					
					
				break;
				case VAL: 
					
					map.put(key, formatValue(arg));
					state = START;
				break;
			 	default: throw new RuntimeException("Unknown message:");
			}
		}
		
		
		return map;
	}
493562
private Map<String, String> parseMap() {
        final Map<String, String> map = new HashMap<>();
        for (String pair : browserInput.split("&")) {
            String[] kv = pair.split("=");
            map.put(kv[0], kv[1]);
        }
        return map;
    }
530626
function mapObject(key, value) {
		var c = key.charAt(0);
		if (c === "_" || c === "$") {
			return undefined;
		} else if (isArray(this) && key.match(INTRINSIC)) {
			return undefined;
		} else if (isType(value)) {
			return parse(value);
		} else if (gui.Type.isComplex(value)) {
			switch (value.constructor) {
				case Object:
				case Array:
					return value;
			}
			return undefined;
		} else {
			if (isType(this)) {
				var base = this.constructor.prototype;
				var desc = Object.getOwnPropertyDescriptor(base, key);
				if (desc && (desc.set || desc.get)) {
					return undefined;
				}
			}
			return value;
		}
	}
151840
function( element, set ) {
		var val, i;
		for( i=0; i < set.length; i++ ) {
			if ( set[ i ] !== null ) {
				val = element.data( dataSpace + set[ i ] );
				// support: jQuery 1.6.2
				// http://bugs.jquery.com/ticket/9917
				// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
				// We can't differentiate between "" and 0 here, so we just assume
				// empty string since it's likely to be a more common value...
				if ( val === undefined ) {
					val = "";
				}
				element.css( set[ i ], val );
			}
		}
	}
844379
function (keyOrMap, value) {
				if (typeof keyOrMap === typeObj) {
					for (var key in keyOrMap) {
						if (hasOwn.call(keyOrMap, key)) {
							set(nucleus, key, keyOrMap[key]);
						}
					}
				} else {
					set(nucleus, keyOrMap, value);
				}
				return me;
			}
809002
@Override
	public Map<String, Object> parseMap(InputStream source) {
		Map<String, Object> map = new LinkedHashMap<>();

		try (ParserWrapper parserWrapper = createParser(source)) {
			Map<String, Object> result = BindMapHelper.parseMap(this, parserWrapper, map);
			return result;
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
	}