anchor.diff:      createParser('C.x() : this() {}');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes(
  -        [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]);
  +    listener.assertErrors([
  +      expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15, 2)
  +    ]);
     }
   
     void test_redirectingConstructorWithBody_unnamed() {
       createParser('C() : this.x() {}');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes(
  -        [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]);
  +    listener.assertErrors([
  +      expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15, 2)
  +    ]);
     }
   
     void test_redirectionInNonFactoryConstructor() {
       createParser('C() = D;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes(
  -        [ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
  +    listener.assertErrors([
  +      expectedError(
  +          ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, 4, 1)
  +    ]);
     }
   
     void test_setterInFunction_block() {
       parseStatement("set x(v) {_x = v;}");
  -    assertErrorsWithCodes([ParserErrorCode.SETTER_IN_FUNCTION]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
     }
   
     void test_setterInFunction_expression() {
       parseStatement("set x(v) => _x = v;");
  -    assertErrorsWithCodes([ParserErrorCode.SETTER_IN_FUNCTION]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
     }
   
     void test_staticAfterConst() {
       createParser('final static int f;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes([ParserErrorCode.STATIC_AFTER_FINAL]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.STATIC_AFTER_FINAL, 6, 6)]);
     }
   
     void test_staticAfterFinal() {
       createParser('const static int f;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes(usingFastaParser
  -        ? [
  -            ParserErrorCode.STATIC_AFTER_CONST,
  -            CompileTimeErrorCode.CONST_NOT_INITIALIZED
  -          ]
  -        : [ParserErrorCode.STATIC_AFTER_CONST]);
  +    if (usingFastaParser) {
  +      listener.assertErrors([
  +        expectedError(ParserErrorCode.STATIC_AFTER_CONST, 6, 6),
  +        expectedError(CompileTimeErrorCode.CONST_NOT_INITIALIZED, 17, 1)
  +      ]);
  +    } else {
  +      listener.assertErrorsWithCodes([ParserErrorCode.STATIC_AFTER_CONST]);
  +    }
     }
   
     void test_staticAfterVar() {
       createParser('var static f;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes([ParserErrorCode.STATIC_AFTER_VAR]);
  +    listener
  +        .assertErrors([expectedError(ParserErrorCode.STATIC_AFTER_VAR, 4, 6)]);
     }
   
     void test_staticConstructor() {
       createParser('static C.m() {}');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes([ParserErrorCode.STATIC_CONSTRUCTOR]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.STATIC_CONSTRUCTOR, 0, 6)]);
     }
   
     void test_staticGetterWithoutBody() {
       createParser('static get m;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener
  -        .assertErrorsWithCodes([ParserErrorCode.STATIC_GETTER_WITHOUT_BODY]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, 12, 1)]);
     }
   
     void test_staticOperator_noReturnType() {
       createParser('static operator +(int x) => x + 1;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes([ParserErrorCode.STATIC_OPERATOR]);
  +    listener
  +        .assertErrors([expectedError(ParserErrorCode.STATIC_OPERATOR, 0, 6)]);
     }
   
     void test_staticOperator_returnType() {
       createParser('static int operator +(int x) => x + 1;');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener.assertErrorsWithCodes([ParserErrorCode.STATIC_OPERATOR]);
  +    listener
  +        .assertErrors([expectedError(ParserErrorCode.STATIC_OPERATOR, 0, 6)]);
     }
   
     void test_staticSetterWithoutBody() {
       createParser('static set m(x);');
       ClassMember member = parser.parseClassMember('C');
       expectNotNullIfNoErrors(member);
  -    listener
  -        .assertErrorsWithCodes([ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
  +    listener.assertErrors(
  +        [expectedError(ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, 15, 1)]);
     }
   
     void test_staticTopLevelDeclaration_class() {
  -    parseCompilationUnit("static class C {}",
  -        codes: [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
  +    parseCompilationUnit("static class C {}", errors: [
  +      expectedError(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, 0, 6)
  +    ]);
     }
   
     void test_staticTopLevelDeclaration_enum() {
  -    parseCompilationUnit("static enum E { v }",
  -        codes: [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
  +    parseCompilationUnit("static enum E { v }", errors: [
  +      expectedError(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, 0, 6)
  +    ]);
     }
   
     void test_staticTopLevelDeclaration_function() {
  -    parseCompilationUnit("static f() {}",
  -        codes: [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
  +    parseCompilationUnit("static f() {}", errors: [
  +      expectedError(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, 0, 6)
  +    ]);
     }
   
     void test_staticTopLevelDeclaration_typedef() {
  -    parseCompilationUnit("static typedef F();",
  -        codes: [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
  +    parseCompilationUnit("static typedef F();", errors: [
  +      expectedError(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, 0, 6)
  +    ]);
     }
   
     void test_staticTopLevelDeclaration_variable() {
  -    parseCompilationUnit("static var x;",
  -        codes: [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
  +    parseCompilationUnit("static var x;", errors: [
  +      expectedError(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, 0, 6)
  +    ]);
     }
   
     void test_string_unterminated_interpolation_block() {
  
positive.code:     createParser('..<E>()');
      MethodInvocation methodInvocation = parser.parseCascadeSection();
      expectNotNullIfNoErrors(methodInvocation);
      listener.assertErrorsWithCodes([ParserErrorCode.MISSING_IDENTIFIER]);
      expect(methodInvocation.target, isNull);
      expect(methodInvocation.methodName.name, "");
      expect(methodInvocation.typeArguments, isNotNull);
  
negative.code: 
    void test_withBeforeExtends() {
      parseCompilationUnit("class A with B extends C {}",
          errors: [expectedError(ParserErrorCode.WITH_BEFORE_EXTENDS, 15, 7)]);
    }
  
    void test_withWithoutExtends() {
      createParser('class A with B, C {}');
      ClassDeclaration declaration = parseFullCompilationUnitMember();
      expectNotNullIfNoErrors(declaration);
      listener.assertErrors(
          [expectedError(ParserErrorCode.WITH_WITHOUT_EXTENDS, 8, 4)]);
    }
  
    void test_wrongSeparatorForPositionalParameter() {
      createParser('(a, [b : 0])');
      FormalParameterList list = parser.parseFormalParameterList();
      expectNotNullIfNoErrors(list);
      listener.assertErrors([
        expectedError(
            ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, 7, 1)
      ]);
    }
  
    void test_wrongTerminatorForParameterGroup_named() {
      createParser('(a, {b, c])');
      FormalParameterList list = parser.parseFormalParameterList();
      expectNotNullIfNoErrors(list);
      if (fe.Scanner.useFasta) {
        listener.assertErrors([
          // fasta scanner generates '(a, {b, c]})' where '}' is synthetic
          expectedError(
              ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, 9, 1),
          expectedError(ScannerErrorCode.EXPECTED_TOKEN, 9, 1),
        ]);
      } else {
        listener.assertErrorsWithCodes(
            [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
      }
    }
  
    void test_wrongTerminatorForParameterGroup_optional() {
      createParser('(a, [b, c})');
      FormalParameterList list = parser.parseFormalParameterList();
      expectNotNullIfNoErrors(list);
      if (usingFastaScanner) {
        listener.assertErrors([
          // fasta scanner generates '(a, [b, c}])' where ']' is synthetic
          expectedError(
              ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, 9, 1),
          expectedError(ScannerErrorCode.EXPECTED_TOKEN, 9, 1),
        ]);
      } else {
        listener.assertErrorsWithCodes(
            [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
      }
    }
  }
  
  