anchor.diff:  
     void test_typedefInClass_withoutReturnType() {
       parseCompilationUnit("class C { typedef F(x); }",
  -        codes: [ParserErrorCode.TYPEDEF_IN_CLASS]);
  +        errors: [expectedError(ParserErrorCode.TYPEDEF_IN_CLASS, 10, 7)]);
     }
   
     void test_typedefInClass_withReturnType() {
       parseCompilationUnit("class C { typedef int F(int x); }",
  -        codes: [ParserErrorCode.TYPEDEF_IN_CLASS]);
  +        errors: [expectedError(ParserErrorCode.TYPEDEF_IN_CLASS, 10, 7)]);
     }
   
     void test_unexpectedTerminatorForParameterGroup_named() {
       createParser('(a, b})');
       FormalParameterList list = parser.parseFormalParameterList();
       expectNotNullIfNoErrors(list);
  -    listener.assertErrorsWithCodes(
  -        [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
  +    listener.assertErrors([
  +      expectedError(
  +          ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, 5, 1)
  +    ]);
     }
   
     void test_unexpectedTerminatorForParameterGroup_optional() {
       createParser('(a, b])');
       FormalParameterList list = parser.parseFormalParameterList();
       expectNotNullIfNoErrors(list);
  -    listener.assertErrorsWithCodes(
  -        [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
  +    listener.assertErrors([
  +      expectedError(
  +          ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, 5, 1)
  +    ]);
     }
   
     void test_unexpectedToken_endOfFieldDeclarationStatement() {
       parseStatement("String s = (null));");
  -    assertErrorsWithCodes([ParserErrorCode.UNEXPECTED_TOKEN]);
  +    listener
  +        .assertErrors([expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 17, 1)]);
     }
   
     @failingTest
     void test_unexpectedToken_invalidPostfixExpression() {
       // Note: this might not be the right error to produce, but some error should
       // be produced
  -    parseExpression("f()++", codes: [ParserErrorCode.UNEXPECTED_TOKEN]);
  +    parseExpression("f()++",
  +        errors: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 3, 2)]);
     }
   
     void test_unexpectedToken_returnInExpressionFunctionBody() {
       parseCompilationUnit("f() => return null;",
  -        codes: [ParserErrorCode.UNEXPECTED_TOKEN]);
  +        errors: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 6)]);
     }
   
     void test_unexpectedToken_semicolonBetweenClassMembers() {
       createParser('class C { int x; ; int y;}');
       ClassDeclaration declaration = parseFullCompilationUnitMember();
       expectNotNullIfNoErrors(declaration);
  -    listener.assertErrorsWithCodes([ParserErrorCode.UNEXPECTED_TOKEN]);
  +    listener
  +        .assertErrors([expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 17, 1)]);
     }
   
     void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
       parseCompilationUnit("int x; ; int y;",
  -        codes: [ParserErrorCode.UNEXPECTED_TOKEN]);
  +        errors: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 1)]);
     }
   
     void test_unterminatedString_at_eof() {
  
positive.code:   void test_expressionList_multiple_middle() {
      List<Expression> result = parseExpressionList('1, 2, , 4');
      expectNotNullIfNoErrors(result);
      listener.assertErrorsWithCodes([ParserErrorCode.MISSING_IDENTIFIER]);
      expect(result, hasLength(4));
      Expression syntheticExpression = result[2];
      EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
  
negative.code:     createParser('(var int x)');
      FormalParameterList list = parser.parseFormalParameterList();
      expectNotNullIfNoErrors(list);
      listener.assertErrors([expectedError(ParserErrorCode.VAR_AND_TYPE, 5, 3)]);
    }
  
    void test_varAndType_topLevelVariable() {
      parseCompilationUnit("var int x;",
          errors: [expectedError(ParserErrorCode.VAR_AND_TYPE, 4, 3)]);
    }
  
    void test_varAsTypeName_as() {
      parseExpression("x as var",
          errors: [expectedError(ParserErrorCode.VAR_AS_TYPE_NAME, 7, 3)]);
    }
  
    void test_varClass() {
      parseCompilationUnit("var class C {}",
          errors: usingFastaParser
              ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
              : [expectedError(ParserErrorCode.VAR_CLASS, 0, 3)]);
    }
  
    void test_varEnum() {
      parseCompilationUnit("var enum E {ONE}",
          errors: usingFastaParser
              ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
              : [expectedError(ParserErrorCode.VAR_ENUM, 0, 3)]);
    }
  
    void test_varReturnType() {
      createParser('var m() {}');
      ClassMember member = parser.parseClassMember('C');
      expectNotNullIfNoErrors(member);
      listener
          .assertErrors([expectedError(ParserErrorCode.VAR_RETURN_TYPE, 0, 3)]);
    }
  
    void test_varTypedef() {
      parseCompilationUnit("var typedef F();",
          errors: usingFastaParser
              ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
              : [expectedError(ParserErrorCode.VAR_TYPEDEF, 0, 3)]);
    }
  
    void test_voidParameter() {
  