Abstract the logic for adding items to the grammar.

@private
@param {string} name - Required to identify the match.
@param {string} value - To be escaped and used within a RegExp.
@returns {object} The normalized metadata.
188495
function makeEntry(name, value) {
    var escaped = escapeDelimiter(value);

    return {
      name: name,
      escaped: escaped,
      test: new RegExp("^" + escaped)
    };
  }
410650
@SuppressWarnings("unchecked")
    public <R> R put(@NotNull final String name, R value) {
        if (value == null) {
            return (R) context.remove(name);
        }
        return (R) context.put(name, value);
    }
1135488
function (name, value) {
			var options = this.options;

			if (value === void 0) {
				return options[name];
			} else {
				options[name] = value;
			}
		}
224455
function(name, value) {
            var parameters = this.parameters;

            if (arguments.length < 1)
                return parameters[name] || parameters['/' + name];

            if (value !== parameters[name]) {
                parameters[name] = value;
            }
        }
1234214
function stringDotToObj(result, name, value) {
        var parts = name.split('.'),
            prop = parts[0];

        parts.forEach(function (prop, i) {
            if (i === parts.length - 1) {
                result[prop] = value;
            } else {
                if (!result[prop]) {
                    result[prop] = {};
                }
                result = result[prop];
            }

        });
    }
243197
function stringDotToObj(result, prop, name, value) {
        if (!result[prop]) {
            result[prop] = {};
        }
        name = name.substring((prop + '.').length, name.length);
        result[prop][name] = value;
    }
1149449
function(name, value) {
			if (name == value) {
				return true;
			}

			var boolAttrs = prefs.get('profile.booleanAttributes');
			if (!value && boolAttrs) {
				boolAttrs = new RegExp(boolAttrs, 'i');
				return boolAttrs.test(name);
			}

			return false;
		}
871367
function(value)
	{
		value = value.split("\r\n").join("\n").split("\r").join("\n");

		if ( !/\n$/.test(value) )
		{
			value += "\n";
		}

		// strip YAML header
		var count = 0;
		var regex = /^\%YAML[: ][\d\.]+.*\n/;
		while ( regex.test(value) )
		{
			value = value.replace(regex, '');
			count++;
		}
		this.offset += count;

		// remove leading comments
		regex = /^(#.*?\n)+/;
		if ( regex.test(value) )
		{
			var trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;
		}

		// remove start of the document marker (---)
		regex = /^\-\-\-.*?\n/;
		if ( regex.test(value) )
		{
			trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;

			// remove end of the document marker (...)
			value = value.replace(/\.\.\.\s*$/g, '');
		}

		return value;
	}
551920
function(name, value) {
      // try to match this attribute to a property (attributes are
      // all lower-case, so this is case-insensitive search)
      var name = this.propertyForAttribute(name);
      if (name) {
        // filter out 'mustached' values, these are to be
        // replaced with bound-data and are not yet values
        // themselves
        if (value && value.search(scope.bindPattern) >= 0) {
          return;
        }
        // get original value
        var currentValue = this[name];
        // deserialize Boolean or Number values from attribute
        var value = this.deserializeValue(value, currentValue);
        // only act if the value has changed
        if (value !== currentValue) {
          // install new value (has side-effects)
          this[name] = value;
        }
      }
    }
917072
function (name, value) {
            var result;
            if (arguments.length === 0) {
                /*  return list of keys  */
                result = [];
                for (var key in this.__config)
                    if (_cs.isown(this.__config, key))
                        result.push(key);
            }
            else if (arguments.length === 1 && typeof name === "string") {
                /*  retrieve value  */
                result = this.__config[name];
            }
            else if (arguments.length === 2 && value !== null) {
                /*  set value  */
                result = this.__config[name];
                this.__config[name] = value;
            }
            else if (arguments.length === 2) {
                /*  remove key/value pair  */
                result = this.__config[name];
                delete this.__config[name];
            }
            else
                throw _cs.exception("cfg", "invalid arguments");
            return result;
        }
163443
public OverpassFilterQuery tagRegex(String name, String value) {
        builder.regexMatches(name, value);

        return this;
    }
563379
private static InputElement createHiddenInput(String name, String value) {

        InputElement input = Document.get().createHiddenInputElement();
        input.setName(name);
        input.setValue(value);
        return input;
    }
971003
function(name) {
			var val = this.get(name);
			if (typeof val === 'undefined' || val === null || val === '')  {
				return null;
			}

			val = val.split(',').map(utils.trim);
			if (!val.length) {
				return null;
			}
			
			return val;
		}
82212
public static Attribute<HtmlTag> meta( String name, String value )
    {
        return head( "meta", ignored ->
        {
        }, new Attribute<Void>()
        {
            @Override
            public String name()
            {
                return name;
            }

            @Override
            public String value( Void target )
            {
                return value;
            }
        } );
    }
465981
function (name, value, tag/*, ...*/) {
    var args = SLICE.call(arguments, 2);
    args[0] = value;
    return this.visit.apply(this, args);
  }
751569
public OrmDescriptor addNamespace(String name, String value)
   {
      model.attribute(name, value);
      return this;
   }
580690
def a(value):
    
    name = getattr(value, 'name', value)
    return some(lambda t: t == value).named(u'(a "%s")' % (name,))