anchor.diff:  //
   //  -- https://docs.python.org/3.1/reference/lexical_analysis.html#indentation
   private int getIndentationLength(String textOfMatchedNEWLINE) {
  -	int count = 0;
  -
  -	for (char ch : textOfMatchedNEWLINE.toCharArray()) {
  -		switch (ch) {
  -			case ' ': // A normal space char
  -				this.wasSpaceIndentation = true;
  -				count++;
  -				break;
  -			case '\t':
  -				this.wasTabIndentation = true;
  -				count += 8 - (count % 8);
  -				break;
  -		}
  -	}
  -	return count;
  +    int count = 0;
  +    for (char ch : textOfMatchedNEWLINE.toCharArray()) {
  +        switch (ch) {
  +            case ' ': // A normal space char
  +                this.wasSpaceIndentation = true;
  +                count++;
  +                break;
  +            case '\t':
  +                this.wasTabIndentation = true;
  +                count += 8 - (count % 8);
  +                break;
  +        }
  +    }
  +    return count;
   }
   
   private void checkSpaceAndTabIndentation() {
  -	if (this.wasSpaceIndentation && this.wasTabIndentation) {
  -		this.warnings.add("Mixture of space and tab were used for indentation.");
  -	}
  +    if (this.wasSpaceIndentation && this.wasTabIndentation) {
  +        this.warnings.add("Mixture of space and tab were used for indentation.");
  +    }
   }
   
   public List<String> getWarnings() {
  -	return this.warnings;
  +    return this.warnings;
   }
   
   public List<String> getErrorMessages() {
  -	return this.errors;
  +    return this.errors;
   }
   }
   
  
positive.code: // this embedded code section will be copied to the generated file: Python3Lexer.java
  @lexer::members {
  // The stack that keeps track of the indentation lengths
  private Stack<Integer> indentLengths = new Stack<>() {{ push(0); }}; // initializing with default 0 indentation length
  // A queue where extra tokens are pushed on
  private Deque<Token> pendingTokens = new ArrayDeque<>();
  // A token that stores the last pending token (including the inserted INDENT/DEDENT/NEWLINE tokens also)
  private Token lastPendingToken;
  
  // The amount of opened braces, brackets and parenthesis
  private int opened = 0;
  
  // Was there space char in the indentations?
  private boolean wasSpaceIndentation = false;
  // Was there TAB char in the indentations?
  private boolean wasTabIndentation = false;
  
  // A String list that stores the lexer warnings
  
negative.code: 
  @Override
  public Token nextToken() {
      if (_input.size() == 0) {
          return new CommonToken(EOF, "<EOF>"); // processing of the input stream until the first returning EOF
      } else {
          checkNextToken();
          return this.pendingTokens.pollFirst(); // append the token stream with the upcoming pending token
      }
  }
  
  private void checkNextToken() {
      if (this.indentLengths != null) { // after the first incoming EOF token the indentLengths stack will be set to null
          final int startSize = this.pendingTokens.size();
          Token curToken;
          do {
              curToken = super.nextToken(); // get the next token from the input stream
              checkStartOfInput(curToken);
              switch (curToken.getType()) {
                  case OPEN_PAREN:
                  case OPEN_BRACK:
                  case OPEN_BRACE:
                      this.opened++;
                      this.pendingTokens.addLast(curToken);
                      break;
                  case CLOSE_PAREN:
                  case CLOSE_BRACK:
                  case CLOSE_BRACE:
                      this.opened--;
                      this.pendingTokens.addLast(curToken);
                      break;
                  case NEWLINE:
                      handleNewLineToken(curToken);
                      break;
                  case EOF:
                      handleEofToken(curToken); // indentLengths stack will be set to null
                      break;
                  default:
                      this.pendingTokens.addLast(curToken); // insert the current token
              }
          } while (this.pendingTokens.size() == startSize);
          this.lastPendingTokenType = curToken.getType();
      }
  }
  
  private void checkStartOfInput(Token curToken) {
      if (indentLengths.size() == 0) { // We're at the first token
          indentLengths.push(0);  // initialize the stack with default 0 indentation length
          if (_input.getText(new Interval(0, 0)).trim().length() == 0) { // the first char of the input is a whitespace
              this.insertLeadingTokens(curToken.getType(), curToken.getStartIndex());
          }
      }
  }
  
  private void handleNewLineToken(Token curToken) {
      if (this.opened == 0) { //*** https://docs.python.org/3/reference/lexical_analysis.html#implicit-line-joining
          switch (_input.LA(1) /* next symbol */) { //*** https://www.antlr.org/api/Java/org/antlr/v4/runtime/IntStream.html#LA(int)
              case '\r':
              case '\n':
              case '\f':
              case '#':   //*** https://docs.python.org/3/reference/lexical_analysis.html#blank-lines
              case EOF:   // skip the trailing inconsistent dedent or the trailing unexpected indent (or the trailing indent)
                  return; // We're on a blank line or before a comment or before the EOF, skip the NEWLINE token
              default:
                  this.pendingTokens.addLast(curToken); // insert the current NEWLINE token
                  this.insertIndentDedentTokens(this.getIndentationLength(curToken.getText())); //*** https://docs.python.org/3/reference/lexical_analysis.html#indentation
          }
      }
  }
  
  private void handleEofToken(Token curToken) {
      this.insertTrailingTokens(this.lastPendingTokenType); // indentLengths stack will be null!
      this.pendingTokens.addLast(curToken); // insert the current EOF token
      this.checkSpaceAndTabIndentation();
  }
  
  private void insertLeadingTokens(int type, int startIndex) {
      if (type != NEWLINE && type != EOF) { // (after a whitespace) The first token is visible, so We insert a NEWLINE and an INDENT token before it to raise an 'unexpected indent' error later by the parser
          this.insertToken(0, startIndex - 1, "<inserted leading NEWLINE>" + " ".repeat(startIndex), NEWLINE, 1, 0);
          this.insertToken(startIndex, startIndex - 1, "<" + TEXT_INSERTED_INDENT + ", " + this.getIndentationDescription(startIndex) + ">", Python3Parser.INDENT, 1, startIndex);
          this.indentLengths.push(startIndex);
      }
  }
  
  private void insertIndentDedentTokens(int curIndentLength) {
      int prevIndentLength = this.indentLengths.peek();
      if (curIndentLength > prevIndentLength) { // insert an INDENT token
          this.insertToken("<" + TEXT_INSERTED_INDENT + ", " + this.getIndentationDescription(curIndentLength) + ">", Python3Parser.INDENT);
          this.indentLengths.push(curIndentLength);
      } else {
          while (curIndentLength < prevIndentLength) {   // More than 1 DEDENT token may be inserted
              this.indentLengths.pop();
              prevIndentLength = this.indentLengths.peek();
              if (curIndentLength <= prevIndentLength) {
                  this.insertToken("<inserted DEDENT, " + this.getIndentationDescription(prevIndentLength) + ">", Python3Parser.DEDENT);
              } else {
                  this.insertToken("<inserted inconsistent DEDENT, " + "length=" + curIndentLength + ">", Python3Parser.DEDENT);
                  this.errors.add(TEXT_LEXER + "line " + getLine() + ":" + getCharPositionInLine() + "\t IndentationError: unindent does not match any outer indentation level");
              }
          }
      }
  }
  
  private void insertTrailingTokens(int type) {
      if (type != NEWLINE && type != Python3Parser.DEDENT) { // If the last pending token was not a NEWLINE and not a DEDENT then
          this.insertToken("<inserted trailing NEWLINE>", NEWLINE); // insert an extra trailing NEWLINE token that serves as the end of the statement
      }
  
      while (this.indentLengths.size() > 1) { // Now insert as much trailing DEDENT tokens as needed
          this.insertToken("<inserted trailing DEDENT, " + this.getIndentationDescription(this.indentLengths.pop()) + ">", Python3Parser.DEDENT);
      }
      this.indentLengths = null; // there will be no more token read from the input stream
  }
  
  private String getIndentationDescription(int lengthOfIndent) {
      return "length=" + lengthOfIndent + ", level=" + this.indentLengths.size();
  }
  
  private void insertToken(String text, int type) {
      final int startIndex = _tokenStartCharIndex + getText().length(); //*** https://www.antlr.org/api/Java/org/antlr/v4/runtime/Lexer.html#_tokenStartCharIndex
      this.insertToken(startIndex, startIndex - 1, text, type, getLine(), getCharPositionInLine());
  }
  
  private void insertToken(int startIndex, int stopIndex, String text, int type, int line, int charPositionInLine) {
      CommonToken token = new CommonToken(_tokenFactorySourcePair, type, DEFAULT_TOKEN_CHANNEL, startIndex, stopIndex); //*** https://www.antlr.org/api/Java/org/antlr/v4/runtime/CommonToken.html
      token.setText(text);
      token.setLine(line);
      token.setCharPositionInLine(charPositionInLine);
      this.pendingTokens.addLast(token);
  }
  
  // Calculates the indentation of the provided spaces, taking the
  