From 9a2aac9e0e4486964d2cfe015013bad7a025c09c Mon Sep 17 00:00:00 2001 From: "Quirin F. Schroll" Date: Fri, 14 Feb 2025 03:48:47 +0100 Subject: [PATCH] =?UTF-8?q?`BasicType`=20=E2=86=92=20`PrimaryType`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/class.dd | 24 +++++++----------------- spec/declaration.dd | 12 ++++++------ spec/expression.dd | 10 +++++----- spec/function.dd | 6 +++--- spec/interface.dd | 7 ++----- spec/simd.dd | 10 +++++----- spec/template.dd | 11 ++++------- spec/type.dd | 17 +++++++---------- 8 files changed, 39 insertions(+), 58 deletions(-) diff --git a/spec/class.dd b/spec/class.dd index f5c48b9235..e08926e5af 100644 --- a/spec/class.dd +++ b/spec/class.dd @@ -28,22 +28,15 @@ $(HEADERNAV_TOC) $(GRAMMAR $(GNAME ClassDeclaration): $(D class) $(GLINK_LEX Identifier) $(D ;) - $(D class) $(GLINK_LEX Identifier) $(GLINK BaseClassList)$(OPT) $(GLINK2 struct, AggregateBody) + $(D class) $(GLINK_LEX Identifier) $(GLINK SupertypeList)$(OPT) $(GLINK2 struct, AggregateBody) $(GLINK2 template, ClassTemplateDeclaration) -$(GNAME BaseClassList): - $(D :) $(GLINK SuperClassOrInterface) - $(D :) $(GLINK SuperClassOrInterface) $(D ,) $(GLINK Interfaces) +$(GNAME SupertypeList): + $(D :) $(GLINK BasicTypes) -$(GNAME SuperClassOrInterface): - $(GLINK2 type, BasicType) - -$(GNAME Interfaces): - $(GLINK Interface) - $(GLINK Interface) $(D ,) $(GSELF Interfaces) - -$(GNAME Interface): +$(GNAME BasicTypes): $(GLINK2 type, BasicType) + $(GLINK2 type, BasicType) $(D ,) $(GSELF BasicTypes) ) $(P A class consists of:) @@ -1439,20 +1432,17 @@ $(H3 $(LNAME2 anonymous, Anonymous Nested Classes)) $(GRAMMAR $(GNAME NewAnonClassExpression): - $(D new) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK AnonBaseClassList)$(OPT) $(GLINK2 struct, AggregateBody) + $(D new) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK BasicTypes)$(OPT) $(GLINK2 struct, AggregateBody) $(GNAME ConstructorArgs): $(D $(LPAREN)) $(GLINK2 expression, NamedArgumentList)$(OPT) $(D $(RPAREN)) -$(GNAME AnonBaseClassList): - $(GLINK SuperClassOrInterface) - $(GLINK SuperClassOrInterface) $(D ,) $(GLINK Interfaces) ) which is equivalent to: $(INFORMATIVE_GRAMMAR -$(D class) $(GLINK_LEX Identifier) $(D :) $(I AnonBaseClassList) $(I AggregateBody) +$(D class) $(GLINK_LEX Identifier) $(D :) $(I BasicTypes) $(I AggregateBody) // ... $(D new) $(I Identifier) $(I ConstructorArgs) ) diff --git a/spec/declaration.dd b/spec/declaration.dd index 844231dc37..7a4cc05cc0 100644 --- a/spec/declaration.dd +++ b/spec/declaration.dd @@ -41,7 +41,7 @@ $(H3 $(LNAME2 variable-declarations, Variable Declarations)) $(GRAMMAR $(GNAME VarDeclarations): - $(GLINK StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 type, TypeSuffixes)$(OPT) $(GLINK IdentifierInitializers) $(D ;) + $(GLINK StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK2 type, TypeSuffixes)$(OPT) $(GLINK IdentifierInitializers) $(D ;) $(GLINK AutoDeclaration) $(GNAME IdentifierInitializers): $(LEGACY_LNAME2 Declarators, DeclaratorIdentifierList) @@ -334,8 +334,8 @@ $(H2 $(LNAME2 alias, Alias Declarations)) $(GRAMMAR $(GNAME AliasDeclaration): - $(D alias) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 type, TypeSuffixes)$(OPT) $(GLINK Identifiers) $(D ;) - $(D alias) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 function, FuncDeclarator) $(D ;) + $(D alias) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK2 type, TypeSuffixes)$(OPT) $(GLINK Identifiers) $(D ;) + $(D alias) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK2 function, FuncDeclarator) $(D ;) $(D alias) $(GLINK AliasAssignments) $(D ;) $(GNAME Identifiers): @@ -397,8 +397,8 @@ void foo(myint m) { ... } // error, multiply defined function foo alias abc = foo.bar; // is it a type or a symbol? -------------------- - $(BEST_PRACTICE Other than when aliasing simple basic type names, - type alias names should be Capitalized.) + $(BEST_PRACTICE Other than when aliasing simple fundamental type names, + type alias names should be capitalized.) $(H3 $(LNAME2 alias-symbol, Symbol Aliases)) @@ -690,7 +690,7 @@ $(GRAMMAR $(GNAME AliasReassignment): $(GLINK_LEX Identifier) $(D =) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, Type) $(GLINK_LEX Identifier) $(D =) $(GLINK2 expression, FunctionLiteral) - $(GLINK_LEX Identifier) $(D =) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT) + $(GLINK_LEX Identifier) $(D =) $(GLINK StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT) ) $(P An alias declaration inside a template can be reassigned a new value.) diff --git a/spec/expression.dd b/spec/expression.dd index e24046823b..fb2bbdd625 100644 --- a/spec/expression.dd +++ b/spec/expression.dd @@ -1708,7 +1708,7 @@ $(GNAME PostfixExpression): $(GSELF PostfixExpression) $(D ++) $(GSELF PostfixExpression) $(D --) $(GSELF PostfixExpression) $(D $(LPAREN)) $(GLINK NamedArgumentList)$(OPT) $(D $(RPAREN)) - $(GLINK2 type, TypeCtors)$(OPT) $(GLINK2 type, BasicType) $(D $(LPAREN)) $(GLINK NamedArgumentList)$(OPT) $(D $(RPAREN)) + $(GLINK2 type, TypeCtors)$(OPT) $(GLINK2 type, PrimaryType) $(D $(LPAREN)) $(GLINK NamedArgumentList)$(OPT) $(D $(RPAREN)) $(GSELF PostfixExpression) $(GLINK IndexOperation) $(GSELF PostfixExpression) $(GLINK SliceOperation) ) @@ -2393,14 +2393,14 @@ $(H3 $(LNAME2 function_literals, Function Literals)) $(GRAMMAR $(GNAME FunctionLiteral): - $(D function) $(GLINK RefOrAutoRef)$(OPT) $(GLINK BasicTypeWithSuffixes)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody) - $(D delegate) $(GLINK RefOrAutoRef)$(OPT) $(GLINK BasicTypeWithSuffixes)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody) + $(D function) $(GLINK RefOrAutoRef)$(OPT) $(GLINK PrimaryTypeWithSuffixes)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody) + $(D delegate) $(GLINK RefOrAutoRef)$(OPT) $(GLINK PrimaryTypeWithSuffixes)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody) $(GLINK RefOrAutoRef)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody) $(GLINK2 statement, BlockStatement) $(IDENTIFIER) $(D =>) $(GLINK AssignExpression) -$(GNAME BasicTypeWithSuffixes): - $(GLINK2 type, BasicType) $(GLINK2 type, TypeSuffixes)$(OPT) +$(GNAME PrimaryTypeWithSuffixes): + $(GLINK2 type, PrimaryType) $(GLINK2 type, TypeSuffixes)$(OPT) $(GNAME ParameterWithAttributes): $(GLINK2 function, Parameters) $(GLINK2 function, FunctionAttributes)$(OPT) diff --git a/spec/function.dd b/spec/function.dd index 4a869b98f8..1554859841 100644 --- a/spec/function.dd +++ b/spec/function.dd @@ -8,8 +8,8 @@ $(H2 $(LNAME2 grammar, Function Declarations)) $(GRAMMAR $(GNAME FuncDeclaration): - $(GLINK2 declaration, StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK FuncDeclarator) $(GLINK FunctionBody) - $(GLINK2 declaration, StorageClasses)$(OPT) $(GLINK2 type, BasicType) $(GLINK FuncDeclarator) $(GLINK MissingFunctionBody) + $(GLINK2 declaration, StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK FuncDeclarator) $(GLINK FunctionBody) + $(GLINK2 declaration, StorageClasses)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK FuncDeclarator) $(GLINK MissingFunctionBody) $(GLINK AutoFuncDeclaration) $(GNAME AutoFuncDeclaration): @@ -49,7 +49,7 @@ $(GNAME Parameter): $(GLINK ParameterDeclaration) $(D =) $(ASSIGNEXPRESSION) $(D ...) $(GNAME ParameterDeclaration): - $(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator) + $(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, PrimaryType) $(GLINK2 declaration, Declarator) $(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, Type) $(GNAME ParameterAttributes): diff --git a/spec/interface.dd b/spec/interface.dd index e48c67136b..708eec3abd 100644 --- a/spec/interface.dd +++ b/spec/interface.dd @@ -12,14 +12,11 @@ $(H2 $(LNAME2 declarations, Interface Declarations)) $(GRAMMAR $(GNAME InterfaceDeclaration): $(D interface) $(GLINK_LEX Identifier) $(D ;) - $(D interface) $(GLINK_LEX Identifier) $(GLINK BaseInterfaceList)$(OPT) $(GLINK2 struct, AggregateBody) + $(D interface) $(GLINK_LEX Identifier) $(GLINK2 class, SupertypeList)$(OPT) $(GLINK2 struct, AggregateBody) $(GLINK2 template, InterfaceTemplateDeclaration) - -$(GNAME BaseInterfaceList): - $(D :) $(GLINK2 class, Interfaces) ) - $(IMPLEMENTATION_DEFINED $(P Specialized interfaces may be supported:) + $(IMPLEMENTATION_DEFINED Specialized interfaces may be supported: $(OL $(LI $(RELATIVE_LINK2 com-interfaces, $(I COM Interfaces)) diff --git a/spec/simd.dd b/spec/simd.dd index 4582c307c9..67bd544ab2 100644 --- a/spec/simd.dd +++ b/spec/simd.dd @@ -9,10 +9,10 @@ $(HEADERNAV_TOC) Vector types are a fixed array of floating or integer types, and vector operations operate simultaneously on them.) - $(P Specialized $(GLINK2 type, Vector) types provide access to them.) + $(P Specialized $(D __vector$(LPAREN))$(GLINK2 type, Type)$(D $(RPAREN)) types provide access to them.) - $(P The $(GLINK2 type, VectorBaseType) must be a $(DDSUBLINK spec/arrays, static-arrays, Static Array). - The $(GNAME VectorElementType) is the unqualified element type of the + $(P The type argument to $(D __vector) must be a $(DDSUBLINK spec/arrays, static-arrays, Static Array). + The element type is the unqualified element type of the static array. The dimension of the static array is the number of elements in the vector. @@ -28,7 +28,7 @@ $(HEADERNAV_TOC) algorithm than relying on emulation.) $(BEST_PRACTICE Use the declarations in $(CORE_SIMD) instead of - the language $(GLINK2 type, Vector) grammar. + the language $(D __vector) keyword. ) $(H2 $(LNAME2 core_simd, $(D core.simd))) @@ -98,7 +98,7 @@ $(H3 $(LNAME2 conversions, Conversions)) $(P Vector types of the same size (number_of_elements * size_of_element) can be implicitly converted among each other, this is done as a reinterpret cast (a type paint). - Vector types can be cast to their $(GLINK2 type, VectorBaseType).) + Vector types can be cast to their underyling array type.) $(P Integers and floating point values can be implicitly converted to their vector equivalents:) diff --git a/spec/template.dd b/spec/template.dd index 811a23795a..d0358888ca 100644 --- a/spec/template.dd +++ b/spec/template.dd @@ -508,7 +508,7 @@ $(H3 $(LNAME2 template_value_parameter, Value Parameters)) $(GRAMMAR $(GNAME TemplateValueParameter): - $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator) $(GLINK TemplateValueParameterSpecialization)$(OPT) $(GLINK TemplateValueParameterDefault)$(OPT) + $(GLINK2 type, Type) $(GLINK_LEX, Identifier) $(GLINK TemplateValueParameterSpecialization)$(OPT) $(GLINK TemplateValueParameterDefault)$(OPT) $(GNAME TemplateValueParameterSpecialization): $(D :) $(GLINK2 expression, ConditionalExpression) @@ -573,8 +573,7 @@ $(H3 $(LNAME2 aliasparameters, Alias Parameters)) $(GRAMMAR $(GNAME TemplateAliasParameter): - $(D alias) $(GLINK_LEX Identifier) $(GLINK TemplateAliasParameterSpecialization)$(OPT) $(GLINK TemplateAliasParameterDefault)$(OPT) - $(D alias) $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator) $(GLINK TemplateAliasParameterSpecialization)$(OPT) $(GLINK TemplateAliasParameterDefault)$(OPT) + $(D alias) $(GLINK2 type, Type)$(OPT) $(GLINK_LEX Identifier) $(GLINK TemplateAliasParameterSpecialization)$(OPT) $(GLINK TemplateAliasParameterDefault)$(OPT) $(GNAME TemplateAliasParameterSpecialization): $(D :) $(GLINK2 type, Type) @@ -1187,13 +1186,11 @@ $(H2 $(LNAME2 aggregate_templates, Aggregate Type Templates)) $(GRAMMAR $(GNAME ClassTemplateDeclaration): $(D class) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(D ;) - $(D class) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK Constraint)$(OPT) $(GLINK2 class, BaseClassList)$(OPT) $(GLINK2 struct, AggregateBody) - $(D class) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK2 class, BaseClassList)$(OPT) $(GLINK Constraint)$(OPT) $(GLINK2 struct, AggregateBody) + $(D class) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK2 class, SupertypeList)$(OPT) $(GLINK Constraint)$(OPT) $(GLINK2 struct, AggregateBody) $(GNAME InterfaceTemplateDeclaration): $(D interface) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(D ;) - $(D interface) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK Constraint)$(OPT) $(GLINK2 interface, BaseInterfaceList)$(OPT) $(GLINK2 struct, AggregateBody) - $(D interface) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK2 interface, BaseInterfaceList) $(GLINK Constraint) $(GLINK2 struct, AggregateBody) + $(D interface) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(GLINK2 class, SupertypeList)$(OPT) $(GLINK Constraint)$(OPT) $(GLINK2 struct, AggregateBody) $(GNAME StructTemplateDeclaration): $(D struct) $(GLINK_LEX Identifier) $(GLINK TemplateParameters) $(D ;) diff --git a/spec/type.dd b/spec/type.dd index 113d21f441..578b3f69bb 100644 --- a/spec/type.dd +++ b/spec/type.dd @@ -12,7 +12,7 @@ $(H2 $(LNAME2 grammar, Grammar)) $(GRAMMAR $(GNAME Type): - $(GLINK TypeCtors)$(OPT) $(GLINK BasicType) $(GLINK TypeSuffixes)$(OPT) + $(GLINK TypeCtors)$(OPT) $(GLINK PrimaryType) $(GLINK TypeSuffixes)$(OPT) $(GNAME TypeCtors): $(GLINK TypeCtor) @@ -24,23 +24,20 @@ $(GNAME TypeCtor): $(D inout) $(D shared) +$(GNAME PrimaryType): + $(GLINK BasicType) + $(D __vector) $(D $(LPAREN)) $(GLINK Type) $(D $(RPAREN)) + $(GLINK TypeCtor) $(D $(LPAREN)) $(GLINK Type) $(D $(RPAREN)) + $(GNAME BasicType): $(GLINK FundamentalType) $(D .) $(GLINK QualifiedIdentifier) $(GLINK QualifiedIdentifier) $(GLINK Typeof) $(GLINK Typeof) $(D .) $(GLINK QualifiedIdentifier) - $(GLINK TypeCtor) $(D $(LPAREN)) $(GLINK Type) $(D $(RPAREN)) - $(GLINK Vector) $(GLINK2 traits, TraitsExpression) $(GLINK MixinType) -$(GNAME Vector): - $(D __vector) $(D $(LPAREN)) $(GLINK VectorBaseType) $(D $(RPAREN)) - -$(GNAME VectorBaseType): - $(GLINK Type) - $(GNAME FundamentalType): $(MULTICOLS 5, $(D bool) @@ -836,7 +833,7 @@ $(H3 $(LNAME2 size_t, $(D size_t))) all addressable memory.) $(H3 $(LNAME2 ptrdiff_t, $(D ptrdiff_t))) - $(P $(D ptrdiff_t) is an alias to the signed integral basic type the same size as $(D size_t).) + $(P $(D ptrdiff_t) is an alias to the signed integral type the same size as $(D size_t).) $(H3 $(LNAME2 string, $(D string)))