[fpc-pascal] method-definition
Adriaan van Os
adriaan at adriaan.biz
Fri Dec 15 14:56:34 CET 2023
I am puzzled by the syntax rule <method-list> in Chapter 6. Classes of the FreePascal Language
Reference (version 3.2.0)
Section 6.1 Class definitions has
method-definition = [ "CLASS" ] ( function-header | procedure-header | constructor-header |
destructor-header ) ";" [ ( ( ( "virtual" | "dynamic" ) [ ";" "abstract" ] ) | "override" |
"message" ( integer-constant | string-constant ) ) ";" ] [ call-modifiers ";" ] .
Section 6.6.1 Declaration has:
method-definition = ( function-header | procedure-header | constructor-header | destructor-header
) ";" method-directives .
method-directives = ( ( "virtual" | "dynamic" ) [ ";" "abstract" ] | "reintroduce" ";" |
"override" ";" | "message" constant-expression ) [ call-modifiers ";" ] .
Is this supposed to be the same rule for <method-definition> ?
Some notes:
1. I don't see a rule <constant-expression> anywhere in the Language Reference
2. "reintroduce" is in just one of the two definitions.
3. the optional "CLASS" is in just one of the two definitions.
What complicates things, is that many conflicting rules have the same name in the Language
Reference. For example, conceptually we have object-methods, record-methods, class-methods,
interface-methods and objcclass-methods. But only the record method rules are prefixed as such.
Regards,
Adriaan van Os
More information about the fpc-pascal
mailing list