* When no spaces found, point error at line above assert block
        * When too many spaces found, point error at 2nd blank line
964682
def check_act_assert_spacing(self) -> typing.Generator[AAAError, None, None]:
        
        yield from self.check_block_spacing(
            LineType.act,
            LineType._assert,
            'AAA04 expected 1 blank line before Assert block, found {}',
        )
49577
function error(original, fileName) {
  if (
    original == null ||
    original.location == null ||
    original.location.start == null
  ) {
    return original;
  }

  const start = original.location.start;
  const lineNumber = start.line == null ? 1 : start.line;
  const columnNumber = start.column == null ? 1 : start.column;
  const err = new SyntaxError(`Line ${lineNumber}, column ${columnNumber}: ${original.message}`);

  Object.assign(err, {fileName, lineNumber, columnNumber, original});

  if (fileName == null) {
    return err;
  }

  err.stack = `SyntaxError: ${err.message}\n
    at ${fileName}:${lineNumber}:${columnNumber}
  `;

  return err;
}
1231245
private static int findMinimumLeadingSpaces(String line, int count) {
        int length = line.length();
        int index = 0;
        while (index < length && index < count && Character.isWhitespace(line.charAt(index))) index++;
        return index;
    }
769038
def p_error(self, elem):
        ''''''
        self.errors.append("Syntax error on line " + str(self.lexer.lineno)
                           + ". Got unexpected token " + elem.type)
594909
void validateBlock(Row row)
  {
    if (! row.getDatabase().isValidate()) {
      return;
    }
    
    int rowHead = _rowHead;
    int blobTail = _blobTail;
        
    if (rowHead < blobTail) {
      throw new IllegalStateException(this 
                                      + " rowHead:" + rowHead
                                      + " blobTail:" + blobTail); 
    }
    
    int rowOffset = _rowHead;
    
    byte []buffer = _buffer;

    while (rowOffset < BLOCK_SIZE) {
      int code = buffer[rowOffset] & CODE_MASK;
      
      switch (code) {
      case INSERT:
        row.validate(buffer, rowOffset, rowHead, blobTail);
        break;
        
      case INSERT_DEAD:
      case REMOVE:
        break;
        
      default:
        throw new IllegalStateException(this + " " + rowOffset + " " + code + " unknown code");
      }
      
      int len = getLength(code, row);
      
      if (len < 0 || len + rowOffset > BLOCK_SIZE) {
        throw new IllegalStateException(this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len");
      }
      
      rowOffset += len;
    }  
  }
350543
public void postConstruct() {
        Assert.isTrue(this.spacing == null || this.spacing.length == 2,
                      GridLayer.class.getSimpleName() +
                              ".spacing has the wrong number of elements.  Expected 2 (x,y) but was: " +
                              Arrays.toString(this.spacing));
        Assert.isTrue(this.numberOfLines == null || this.numberOfLines.length == 2,
                      GridLayer.class.getSimpleName() +
                              ".numberOfLines has the wrong number of elements.  Expected 2 (x,y) but was: " +
                              Arrays.toString(this.numberOfLines));
        Assert.isTrue(this.pointsInLine > 2,
                      "There must be at least 2 points in a line.  There were: " + this.pointsInLine);
        Assert.isTrue(this.indent >= 0, "The indent is not permitted to be negative: " + this.indent);
        Assert.isTrue(this.labelColor != null, "labelColor should not be null");
        Assert.isTrue(this.haloColor != null, "haloColor should not be null");
        Assert.isTrue(this.font != null, "font should not be null");

        try {
            if (this.labelProjection != null) {
                if (this.longitudeFirst != null) {
                    this.labelCRS = CRS.decode(this.labelProjection, this.longitudeFirst);
                } else {
                    this.labelCRS = CRS.decode(this.labelProjection);
                }
            }
        } catch (FactoryException e) {
            throw new IllegalArgumentException("The projection code: " + this.labelProjection +
                                                       " is not valid. Error message when parsing code: " +
                                                       e.getMessage());
        }
        if (this.labelFormat != null || this.valueFormat != null || this.unitFormat != null) {
            GridLabelFormat format = GridLabelFormat.fromConfig(this);
            if (format == null) {
                throw new IllegalArgumentException("`labelFormat` or `valueFormat` must be set");
            }
            try {
                format.format(2.0, "m");
            } catch (IllegalFormatException e) {
                throw new IllegalArgumentException("Invalid label format");
            }
            this.gridLabelFormat = format;
        }
    }
1056724
def check_indent(self, definition, docstring):
        
        if docstring:
            indent = self._get_docstring_indent(definition, docstring)
            lines = docstring.split('\n')
            if len(lines) > 1:
                lines = lines[1:]  # First line does not need indent.
                indents = [leading_space(l) for l in lines if not is_blank(l)]
                if set(' \t') == set(''.join(indents) + indent):
                    yield violations.D206()
                if (len(indents) > 1 and min(indents[:-1]) > indent or
                        indents[-1] > indent):
                    yield violations.D208()
                if min(indents) < indent:
                    yield violations.D207()
1073792
function determineKeyValueSpaces(obj, tabSize) {

  let lastDepth = 0;
  let spacesIndex = 0;

  let spaces = [];

    //iterate over all lines
  obj.forEach((line) => {

    if (lastDepth !== line.depth) {
      spacesIndex++;
    }

    //key found
    if (line.key) {

      //value found
      if (line.value) {

        //block line found
        if (line.isBlockLine) {
          line.keyValueSpaces = ' ';
        } else {

          if (!spaces[spacesIndex]) {
            spaces[spacesIndex] = {
              maxKeyLength: 1
            };
          }

          //determine maxKeyLength
          if (spaces[spacesIndex].maxKeyLength < line.key.length) {
            if (spaces[spacesIndex].maxKeyLength < line.key.length) {
              spaces[spacesIndex].maxKeyLength = line.key.length;
            }
          }
        }
      }
    }

    lastDepth = line.depth;
  });

  // reset the counters
  lastDepth = 0;
  spacesIndex = 0;

  //iterate over all lines
  obj.forEach((line) => {
    
    if (lastDepth !== line.depth) {
      spacesIndex++;
    }

    //key found
    if (line.key) {

      //value found
      if (line.value) {

        //block line found
        if (!line.isBlockLine) {
          if(spaces[spacesIndex]){
            let numSpaces = spaces[spacesIndex].maxKeyLength - line.key.length + tabSize;
            line.keyValueSpaces = '';
            for (let i = 0; i < numSpaces; i++) {
              line.keyValueSpaces += ' ';
            }
          }
        }
      }
    }

    lastDepth = line.depth;

  });

  console.log(obj);

  return obj;
}
806865
function isPreviousLineEmpty(text, node, locStart) {
  let idx = locStart(node) - 1;
  idx = skipSpaces(text, idx, { backwards: true });
  idx = skipNewline(text, idx, { backwards: true });
  idx = skipSpaces(text, idx, { backwards: true });
  const idx2 = skipNewline(text, idx, { backwards: true });
  return idx !== idx2;
}
306159
@Override
	public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
			String msg, RecognitionException e) {
		
	}
1356243
function assertThrows(test) {
    var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
    var contains = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];


    if (!Array.isArray(contains)) contains = [contains];

    var shouldErrorName = typeof error === 'string' ? error : error.name;

    var nonThrown = new Error('util.assertThrowsAsync(): Missing rejection' + (error ? ' with ' + error.name : ''));
    var ensureErrorMatches = function ensureErrorMatches(error) {
        // wrong type
        if (error.constructor.name != shouldErrorName) {
            return new Error('\n             util.assertThrowsAsync(): Wrong Error-type\n             - is    : ' + error.constructor.name + '\n             - should: ' + shouldErrorName + '\n             - error: ' + error.toString() + '\n             ');
        }
        // check if contains
        var errorString = error.toString();
        if (contains.length > 0 && (0, _utils.oneOfArrayNotInString)(contains, errorString)) {
            return new Error('\n               util.assertThrowsAsync(): Error does not contain\n               - should contain: ' + contains + '\n               - is string: ' + error.toString() + '\n             ');
        }
        return false;
    };

    return new Promise(function (res, rej) {
        var val = void 0;
        try {
            val = test();
        } catch (err) {
            var wrong = ensureErrorMatches(err);
            if (wrong) rej(wrong);else res(err);
            return;
        }
        if ((0, _isPromise2['default'])(val)) {
            val.then(function () {
                // has not thrown
                rej(nonThrown);
            })['catch'](function (err) {
                var wrong = ensureErrorMatches(err);
                if (wrong) rej(wrong);else res(err);
            });
        } else rej(nonThrown);
    });
}
36904
void readCheckpointFull(InputStream is)
    throws IOException
  {
    _blobTail = BitsUtil.readInt16(is);
    
    if (_blobTail < 0 || _buffer.length < _blobTail) {
      throw new IllegalStateException("Invalid blob tail: " + _blobTail
                                      //+ " pos=" + (is.getPosition() - 2)
                                      + " " + this);
    }
    
    byte []buffer = _buffer;
    
    IoUtil.readAll(is, buffer, 0, _blobTail);
    
    int rowLength = BitsUtil.readInt16(is);
    
    rowHead(_buffer.length - rowLength);
    
    int rowHead = rowHead();
    
    if (rowHead < getBlobTail() || buffer.length < rowHead) {
      throw new IllegalStateException(L.l("Invalid row-head={0} blob-tail={1}",
                                          rowHead(), getBlobTail()));
    }
    IoUtil.readAll(is, buffer, rowHead, buffer.length - rowHead);
    
    // validateBlock(row);    
  }
1191798
function assert(expr) {
  if (expr) return;

  var stack = callsite();
  var call = stack[1];
  var file = call.getFileName();
  var lineno = call.getLineNumber();
  var src = fs.readFileSync(file, 'utf8');
  var line = src.split('\n')[lineno-1];
  var src = line.match(/assert\((.*)\)/)[1];

  var err = new AssertionError({
    message: src,
    stackStartFunction: stack[0].getFunction()
  });

  throw err;
}
564329
def ignorespace(self):
        '''
        
        '''

        while True:

            self.ignore(whitespace)

            if self.nextstr('//'):
                self.noms(until='\n')
                continue

            if self.nextstr('/*'):
                self.expect('*/')
                continue

            break
1368493
def xpatherror(self, file, line, no):
        
        libxml2mod.xmlXPatherror(self._o, file, line, no)
395640
private void convertError(CharBuffer buf, int line)
  {
    String srcFilename = null;
    int destLine = 0;
    int srcLine = 0;
    int srcTailLine = Integer.MAX_VALUE;
    
    for (int i = 0; i < _lines.size(); i++) {
      Line map = (Line) _lines.get(i);

      if (map._dstLine <= line && line <= map.getLastDestinationLine()) {
        srcFilename = map._srcFilename;
        destLine = map._dstLine;
        srcLine = map.getSourceLine(line);
        break;
      }
    }

    if (srcFilename != null) {
    }
    else if (_lines.size() > 0)
      srcFilename = ((Line) _lines.get(0))._srcFilename;
    else
      srcFilename = "";

    buf.append(srcFilename);
    if (line >= 0) {
      buf.append(":");
      buf.append(srcLine + (line - destLine));
    }
  }
315218
def _check_whitespace(string):
    
    if string.count(' ') + string.count('\t') + string.count('\n') > 0:
        raise ValueError(INSTRUCTION_HAS_WHITESPACE)