Skip to content

Replace BasicType by PrimaryType #3917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 7 additions & 17 deletions spec/class.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand Down Expand Up @@ -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)
)
Expand Down
12 changes: 6 additions & 6 deletions spec/declaration.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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.)
Expand Down
10 changes: 5 additions & 5 deletions spec/expression.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions spec/function.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 2 additions & 5 deletions spec/interface.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
10 changes: 5 additions & 5 deletions spec/simd.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)))
Expand Down Expand Up @@ -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:)
Expand Down
11 changes: 4 additions & 7 deletions spec/template.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ;)
Expand Down
17 changes: 7 additions & 10 deletions spec/type.dd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)))

Expand Down