block       : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; Assumes the leading '{' has been verified by callers.
180319
function block(toks, i, n, handler) {
    ++i; //  skip over '{'
    if (handler['startBlock']) { handler['startBlock'](); }
    while (i < n) {
      var ch = toks[i].charAt(0);
      if (ch == '}') {
        ++i;
        break;
      }
      if (ch === ' ' || ch === ';') {
        i = i+1;
      } else if (ch === '@') {
        i = atrule(toks, i, n, handler, false);
      } else if (ch === '{') {
        i = block(toks, i, n, handler);
      } else {
        // Instead of using (any* block) to subsume ruleset we allow either
        // blocks or rulesets with a non-blank selector.
        // This is more restrictive but does not require atrule specific
        // parse tree fixup to realize that the contents of the block in
        //    @media print { ... }
        // is a ruleset.  We just don't care about any block carrying at-rules
        // whose body content is not ruleset content.
        i = ruleset(toks, i, n, handler);
      }
    }
    if (handler['endBlock']) { handler['endBlock'](); }
    return i;
  }
1152661
function hasAtLeastOneKey(target, attrs) {
    var attrsLen = attrs.length;
    var i = 0;
    var counter = 0;
    for (; i < attrsLen; i++) {
      if (target[attrs[i]] !== undefined) {
        counter++;
      }
    }
    return !!counter;
  }
717663
function isValidForRegexLiteral(context: ParserContext): boolean {
  const previousNonWsToken = context.token(context.count() - 1);

  // Valid if at the beginning of the file.
  if (!previousNonWsToken) return true;

  return (
    !util.contains(
      ["keyword", "ident", "number", "variable", "specialVariable"],
      previousNonWsToken.name
    ) &&
    !(
      previousNonWsToken.name === "punctuation" &&
      !util.contains(["(", "{", "[", ",", ";"], previousNonWsToken.value)
    )
  );
}
872001
function parseCatchClause() {
        var param, body, node = new Node();

        expectKeyword('catch');

        expect('(');
        if (match(')')) {
            throwUnexpectedToken(lookahead);
        }

        param = parseVariableIdentifier();
        // 12.14.1
        if (strict && isRestrictedWord(param.name)) {
            tolerateError(Messages.StrictCatchVariable);
        }

        expect(')');
        body = parseBlock();
        return node.finishCatchClause(param, body);
    }
894421
function (line, block) {
    if (!block.template) {
        return;
    }

    var regex = getRegExp(block.template);
    var match = regex.exec(line);
    return match ? match[1] : match;
}
189659
function processMaybeBlock(node, baseToken) {
            const firstToken = getFirstAndLastTokens(node).firstToken
            setOffsetToToken(
                firstToken,
                isLeftBrace(firstToken) ? 0 : 1,
                baseToken
            )
        }
730420
function () {
    var pn, pn1;
    var i = -1;
    var bracketStack = 0;
    var ret = {};
    if (_.contains(["[", "{"], state.tokens.curr.value))
      bracketStack += 1;
    do {
      pn = (i === -1) ? state.tokens.next : peek(i);
      pn1 = peek(i + 1);
      i = i + 1;
      if (_.contains(["[", "{"], pn.value)) {
        bracketStack += 1;
      } else if (_.contains(["]", "}"], pn.value)) {
        bracketStack -= 1;
      }
      if (pn.identifier && pn.value === "for" && bracketStack === 1) {
        ret.isCompArray = true;
        ret.notJson = true;
        break;
      }
      if (_.contains(["}", "]"], pn.value) && pn1.value === "=" && bracketStack === 0) {
        ret.isDestAssign = true;
        ret.notJson = true;
        break;
      }
      if (pn.value === ";") {
        ret.isBlock = true;
        ret.notJson = true;
      }
    } while (bracketStack > 0 && pn.id !== "(end)" && i < 15);
    return ret;
  }
536248
def encodingStrings( reverse = false )
      @encodingStrings  = [ {"&" => "&amp;" },  {"<" => "&lt;"} , {">" => "&gt;"}, {"'" => "&apos;"}, {"\"" => "&quot;" }  ] if @encodingStrings.nil?
      if block_given?
         if reverse
            @encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
         else
            @encodingStrings.each{ |s| s.each{|k,v| yield k,v }  }
         end
      else
         @encodingStrings
      end
   end
559554
function isLoneBlock(node) {
            return node.parent.type === "BlockStatement" ||
                node.parent.type === "Program" ||

                // Don't report blocks in switch cases if the block is the only statement of the case.
                node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1);
        }
644818
function strategyForRegEx(regex) {
      // Ensure the 'global' flag is set.
      if (regex instanceof RegExp) {
        regex = regex.source;
      }
      regex = new RegExp(regex, "g");

      return function(contentBlock, callback) {
        var text = contentBlock.getText();
        var matchArr = null;
        while ((matchArr = regex.exec(text)) !== null) {
          var start = matchArr.index;
          callback(start, start + matchArr[0].length);
        }
      };
    }
635960
def _xor_block(a, b):
    
    return ''.join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b)])
445395
function getBlockIncreaseFromName(methodName) {
  const matchNumbers = String(methodName).match(/_increaseBlockBy(\d+)/);

  if (matchNumbers !== null
    && typeof matchNumbers[1] === 'string') {
    return parseInt(matchNumbers[1], 10);
  }

  return 0;
}
1063417
function checkBlockdecl(i) {
  let l;

  if (i >= tokensLength) return 0;

  if (l = checkBlockdecl7(i)) tokens[i].bd_type = 7;
  else if (l = checkBlockdecl5(i)) tokens[i].bd_type = 5;
  else if (l = checkBlockdecl6(i)) tokens[i].bd_type = 6;
  else if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1;
  else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2;
  else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3;
  else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4;
  else return 0;

  return l;
}
891530
def handle_block(self, match, block_start=None):
        
        # we have to handle comments inside blocks because you could do this:
        # {% blk foo %}asdf {# {% endblk %} #} {%endblk%}
        # they still end up in the data/raw_data of the block itself, but we
        # have to know to ignore stuff until the end comment marker!
        found = BlockTag(**match.groupdict())
        # the full block started at the given match start, which may include
        # prefixed whitespace! we'll strip it later
        if block_start is None:
            block_start = match.start()

        self._block_contents = ''

        # you can have as many comments in your block as you'd like!
        while True:
            match = self._expect_match(
                '"{}"'.format(found.end_block_type_name),
                found.end_pat(), COMMENT_START_PATTERN, RAW_START_PATTERN,
                regex('''(?P<quote>(['"]))''')
            )
            groups = match.groupdict()
            if groups.get('endblock') is not None:
                break

            self.advance(match.end())

            if groups.get('comment_start') is not None:
                self.expect_comment_end()
            elif groups.get('raw_start') is not None:
                self.expect_raw_end()
            elif groups.get('quote') is not None:
                self.rewind()
                match = self._expect_match('any string', STRING_PATTERN)
                self.advance(match.end())
            else:
                raise dbt.exceptions.InternalException(
                    'unhandled regex in handle_block, no match: {}'
                    .format(groups)
                )

        # we want to advance to just the end tag at first, to extract the
        # contents
        self.advance(match.start())
        found.contents = self._block_contents
        self._block_contents = None
        # now advance to the end
        self.advance(match.end())
        found.full_block = self.data[block_start:self.pos]
        return found
171155
function(block){
    var ast = [];
    if (this.pp) {
      ast.push(t.expressionStatement(t.callExpression(
        t.memberExpression(t.identifier('pug_indent'), t.identifier('push')),
        [t.stringLiteral(Array(this.indents + 1).join(this.pp))]
      )))
    }
    ast.push(
      t.expressionStatement(t.logicalExpression('&&',
        t.identifier('block'),
        this.wrapCallExpression(t.callExpression(t.identifier('block'), []))
      ))
    );
    if (this.pp) {
      ast.push(t.expressionStatement(t.callExpression(
        t.memberExpression(t.identifier('pug_indent'), t.identifier('pop')),
        []
      )))
    }
    return ast;
  }
840916
function validateStatement(node, keywordName) {
            const option = getOption(keywordName);

            if (node.type === "BlockStatement" || option === "any") {
                return;
            }

            const tokenBefore = sourceCode.getTokenBefore(node);

            if (tokenBefore.loc.end.line === node.loc.start.line && option === "below") {
                context.report({
                    node,
                    message: "Expected a linebreak before this statement.",
                    fix: fixer => fixer.insertTextBefore(node, "\n")
                });
            } else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") {
                context.report({
                    node,
                    message: "Expected no linebreak before this statement.",
                    fix(fixer) {
                        if (sourceCode.getText().slice(tokenBefore.range[1], node.range[0]).trim()) {
                            return null;
                        }
                        return fixer.replaceTextRange([tokenBefore.range[1], node.range[0]], " ");
                    }
                });
            }
        }
96765
def block_anyfilter(parser, token):
    
    bits = token.contents.split()
    nodelist = parser.parse(('endblockanyfilter',))
    parser.delete_first_token()
    return BlockAnyFilterNode(nodelist, bits[1], *bits[2:])