Assists with parsing var-arg'ed tags
@param tags
@return {*}
351661
function parseTags(tags) {
    if (tags.length > 0 && util.isArray(tags[0])) {
        tags = tags[0];
    }

    return tags;
}
511137
function endTagToTokens(endTag) {
            const tokens = [endTag.tagOpen, endTag.tagClose]

            return tokens
                .filter(t => Boolean(t))
                .sort((a, b) => a.range[0] - b.range[0])
        }
619605
public static Map<String, String> tags(String ... strings) {
        Map<String, String> tags = new HashMap<>();
        for (int i = 0; i < strings.length - 1; i+=2) {
            String key = strings[i];
            String value = strings[i + 1];
            if (key != null && value != null) {
                tags.put(key, value);
            }
        }
        return tags;
    }
901207
function parseVariableDeclarations(string, syntax, options) {
  string = ignoreBlock.removeIgnoredBlocks(string);
  var parser = getParserForSyntax(syntax, options);
  if (parser) {
    return parser.parseVariableDeclarations(string);
  }
  return [];
}
340556
private static List<String> parseTagNames(String tagNames) {
    return Arrays.stream(tagNames.split("\\s*,\\s*"))
        .map(String::trim)
        .collect(Collectors.toList());
  }
573066
function serializeTags( lineNumber, tags ) {

        return tags.split( /\n/ )
        .reduce( function ( acc, line, index ) {

            if ( !index || rTagName.test( line ) ) {
                acc.push( `${line}\n` );
            }
            else {
                acc[ acc.length - 1 ] += `${line}\n`;
            }

            return acc;

        }, [] )
        .map( function ( block ) {

            const trimmed = block.trim();
            const tag = block.match( rTagName )[0];

            const result = {
                line: lineNumber,
                tag: tag.replace( patterns.tagPrefix, '' ),
                value: trimmed.replace( tag, '' ).replace( rLeadSpaces, '' ),
                valueParsed: [],
                source: trimmed
            };

            lineNumber = lineNumber + getLinesLength( block );

            return result;
        })
        .map( function ( tag ) {

            const parser = parsers[ tag.tag ];

            if ( parser ) {

                try {

                    tag.valueParsed = parser( tag.value );
                }
                catch ( err ) {

                    tag.error = err;
                }
            }

            return tag;
        });
    }
967108
function decodeTags (tags) {
  let elementType = 'p';
  const classes = [];
  tags.forEach(tag => {
    if (typeof tag !== 'string') return;
    const foundTag = tag.match(/^<([\w-]+)>$/);
    if (foundTag) {
      elementType = foundTag[1];
      return;
    }
    const foundClass = tag.match(/^\.([\w-]+)$/);
    if (foundClass) {
      classes.push(foundClass[1]);
      return;
    }
  });
  return {elementType, classes};
}
313215
private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) {
    String keyWithValue;
    int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER);
    if (firstPropertyIndex != -1) { // Tag with properties.
      keyWithValue = stringTag.substring(0, firstPropertyIndex);
      // TODO(songya): support decoding tag properties.
    } else { // Tag without properties.
      keyWithValue = stringTag;
    }
    List<String> keyValuePair = TAG_KEY_VALUE_SPLITTER.splitToList(keyWithValue);
    checkArgument(keyValuePair.size() == 2, "Malformed tag " + stringTag);
    TagKey key = TagKey.create(keyValuePair.get(0).trim());
    TagValue value = TagValue.create(keyValuePair.get(1).trim());
    TagValueWithMetadata valueWithMetadata =
        TagValueWithMetadata.create(value, METADATA_UNLIMITED_PROPAGATION);
    tags.put(key, valueWithMetadata);
  }
442312
function parse(args) {
  const cliArgs = [];
  const nodeArgs = [];

  for (const arg of args) {
    if (NODE_FLAGS.test(arg)) {
      nodeArgs.push(arg);
    } else {
      cliArgs.push(arg);
    }
  }

  return {
    cliArgs,
    nodeArgs
  };
}
722756
function parseTag(str, line) {
    var tokens, parser, chunks, tagName, tag, args, last;

    if (utils.startsWith(str, 'end')) {
      last = stack[stack.length - 1];
      if (last && last.name === str.split(/\s+/)[0].replace(/^end/, '') && last.ends) {
        switch (last.name) {
        case 'autoescape':
          escape = opts.autoescape;
          break;
        case 'raw':
          inRaw = false;
          break;
        }
        stack.pop();
        return;
      }

      if (!inRaw) {
        utils.throwError('Unexpected end of tag "' + str.replace(/^end/, '') + '"', line, opts.filename);
      }
    }

    if (inRaw) {
      return;
    }

    chunks = str.split(/\s+(.+)?/);
    tagName = chunks.shift();

    if (!tags.hasOwnProperty(tagName)) {
      utils.throwError('Unexpected tag "' + str + '"', line, opts.filename);
    }

    tokens = lexer.read(utils.strip(chunks.join(' ')));
    parser = new TokenParser(tokens, filters, false, line, opts.filename);
    tag = tags[tagName];

    /**
     * Define custom parsing methods for your tag.
     * @callback parse
     *
     * @example
     * exports.parse = function (str, line, parser, types, options, swig) {
     *   parser.on('start', function () {
     *     // ...
     *   });
     *   parser.on(types.STRING, function (token) {
     *     // ...
     *   });
     * };
     *
     * @param {string} str The full token string of the tag.
     * @param {number} line The line number that this tag appears on.
     * @param {TokenParser} parser A TokenParser instance.
     * @param {TYPES} types Lexer token type enum.
     * @param {TagToken[]} stack The current stack of open tags.
     * @param {SwigOpts} options Swig Options Object.
     * @param {object} swig The Swig instance (gives acces to loaders, parsers, etc)
     */
    if (!tag.parse(chunks[1], line, parser, _t, stack, opts, swig)) {
      utils.throwError('Unexpected tag "' + tagName + '"', line, opts.filename);
    }

    parser.parse();
    args = parser.out;

    switch (tagName) {
    case 'autoescape':
      escape = (args[0] !== 'false') ? args[0] : false;
      break;
    case 'raw':
      inRaw = true;
      break;
    }

    /**
     * A parsed tag token.
     * @typedef {Object} TagToken
     * @property {compile} [compile] Method for compiling this token.
     * @property {array} [args] Array of arguments for the tag.
     * @property {Token[]} [content=[]] An array of tokens that are children of this Token.
     * @property {boolean} [ends] Whether or not this tag requires an end tag.
     * @property {string} name The name of this tag.
     */
    return {
      block: !!tags[tagName].block,
      compile: tag.compile,
      args: args,
      content: [],
      ends: tag.ends,
      name: tagName
    };
  }
1021275
function encodeTags(tags) {
  var bufLength = 0;
  var tagLengths = []
  
  for (var i = 0; i < tags.length; i++) {
    var tagLength = getTagLength(tags[i]);
    tagLengths.push(tagLength);
    bufLength += tagLength;
  }
  
  var buf = new Buffer(bufLength);
  var slicedBuf = buf;
  
  for (var i = 0; i < tags.length; i++) {
    encodeNumber(slicedBuf, tags[i], tagLengths[i]);
    slicedBuf = slicedBuf.slice(tagLengths[i]);
  }
  
  return buf;
}
98237
function parseTag(position, tokens) {
	let token;
	let tag = {
		name : null,
		self : false,
		open : true
	};

	while (token = tokens[position++]) {
		// tag's end found so parsing must stop
		if (token.type === TokenTypes.TagEnd) {
			break;
		}

		// save the tag's name and continue parsing
		if (!tag.name && token.type === TokenTypes.TagName) {
			tag.name = token.value;
			continue;
		}

		// if a "/" is found after the tag's name, then it's a self-closing tag
		if (token.type === TokenTypes.TagClose) {
			tag.self = tag.open = !!tag.name;
		}
	}

	return tag;
}
1195307
def tag(*tags):
    '''
    
    '''
    def dfn(fn):
        _tags = getattr(fn, 'tags', set())
        _tags.update(tags)
        fn.tags = _tags
        return fn
    return dfn
75867
def parse_vars(self, args):
        
        result = {}
        for arg in args:
            if '=' not in arg:
                raise ValueError(
                    'Variable assignment %r invalid (no "=")'
                    % arg)
            name, value = arg.split('=', 1)
            result[name] = value
        return result
350618
function getTags($) {
  const tags = [];

  const tagElements = $('.concept_light-tag');
  for (let i = 0; i < tagElements.length; i += 1) {
    const tagText = tagElements.eq(i).text();
    tags.push(tagText);
  }

  return tags;
}
1338681
function selectTags(tags) {
  // select all tags
  if (!tags) {
    var keys = Object.keys(__TAG_IMPL);
    return keys + selectTags(keys)
  }

  return tags
    .filter(function (t) { return !/[^-\w]/.test(t); })
    .reduce(function (list, t) {
      var name = t.trim().toLowerCase();
      return list + ",[" + IS_DIRECTIVE + "=\"" + name + "\"]"
    }, '')
}
328957
function setTags(swig, tags) {
  var name, tag;
  for (name in tags) {
    tag = tags[name];
    swig.setTag(name, tag.parse, tag.compile, tag.ends, tag.blockLevel);
  }
}