Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Parsing errors on semicolon-delimited generic type parameters in routine implementation headers.
- Incorrect return types for `Length`, `High`, and `Low` on open/dynamic arrays depending on the
compiler version and toolchain.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,12 @@ genericConstraint : typeReference
| CONSTRUCTOR
;
genericArguments : '<' typeReferenceOrStringOrFile (',' typeReferenceOrStringOrFile)* '>'
-> ^(TkGenericArguments<GenericArgumentsNodeImpl> typeReferenceOrStringOrFile typeReferenceOrStringOrFile*)
-> ^(TkGenericArguments<GenericArgumentsNodeImpl> '<' typeReferenceOrStringOrFile (',' typeReferenceOrStringOrFile)* '>')
;
routineNameGenericArguments : '<' typeReferenceOrStringOrFile (commaOrSemicolon typeReferenceOrStringOrFile)* '>'
-> ^(TkGenericArguments<GenericArgumentsNodeImpl> '<' typeReferenceOrStringOrFile (commaOrSemicolon typeReferenceOrStringOrFile)* '>')
;
commaOrSemicolon : ',' | ';'
;

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -810,7 +815,7 @@ routineDeclarationName : (
)
-> ^(TkRoutineName<RoutineNameNodeImpl> $decl)
;
routineImplementationName : nameReference -> ^(TkRoutineName<RoutineNameNodeImpl> nameReference)
routineImplementationName : routineNameReference -> ^(TkRoutineName<RoutineNameNodeImpl> routineNameReference)
;
routineKey : PROCEDURE
| CONSTRUCTOR
Expand Down Expand Up @@ -1182,6 +1187,12 @@ simpleNameReference : ident
extendedNameReference : extendedIdent genericArguments? ('.' extendedNameReference)?
-> ^(TkNameReference<NameReferenceNodeImpl> extendedIdent genericArguments? ('.' extendedNameReference)?)
;
routineNameReference : ident routineNameGenericArguments? ('.' extendedRoutineNameReference)?
-> ^(TkNameReference<NameReferenceNodeImpl> ident routineNameGenericArguments? ('.' extendedRoutineNameReference)?)
;
extendedRoutineNameReference : extendedIdent routineNameGenericArguments? ('.' extendedRoutineNameReference)?
-> ^(TkNameReference<NameReferenceNodeImpl> extendedIdent routineNameGenericArguments? ('.' extendedRoutineNameReference)?)
;
extendedIdent : ident
| keywords -> ^({changeTokenType(TkIdentifier)})
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,9 @@ void testImmediatelyTerminatedComments() {
void testConditionalAsm() {
assertParsed("ConditionalAsm.pas");
}

@Test
void testSemicolonSeparatedGenericArguments() {
assertParsed("SemicolonSeparatedGenericArguments.pas");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
unit SemicolonSeparatedGenericArguments;

interface

implementation

type
TFoo = class
class procedure Bar<T; C>;
end;

class procedure TFoo.Bar<T; C>;
begin
// ...
end;

end.
Loading