Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c23abd0
spec/iasm.dd: Add definition for Opcode
CyberShadow Jun 9, 2021
570e911
spec/lex.dd: Describe Delimiter/MatchingDelimiter in grammar
CyberShadow Jun 9, 2021
6602e70
spec/lex.dd: Describe the nesting aspect of DelimitedString in grammar
CyberShadow Jun 25, 2021
b163441
spec: Merge ClassInvariant and StructInvariant
CyberShadow Jun 11, 2021
f29bef4
spec: Remove definitions redundant with MissingFunctionBody
CyberShadow Jun 11, 2021
3d22d05
spec/lex.dd: Describe TokenString within the grammar
CyberShadow Jun 11, 2021
f450a9e
spec/class.dd: Merge SuperClass with Interface
CyberShadow Jun 11, 2021
3c740ea
spec/statement.dd: Remove PSSEMI from LabeledStatement
CyberShadow Jun 11, 2021
2b237c3
spec/function.dd: Fix FunctionLiteralBody
CyberShadow Jun 11, 2021
20e39f1
spec: Add EmptyDeclaration and EmptyStatement
CyberShadow Jun 12, 2021
174a70b
spec/lex.dd: Describe the source file layout within the grammar
CyberShadow Jun 12, 2021
3da2481
spec/module.dd: Specify that Module may contain zero DeclDefs
CyberShadow Jun 19, 2021
648cd83
spec/function.dd: Add AtAttribute to FunctionAttribute
CyberShadow Jun 19, 2021
67387ff
spec/declaration.dd: Add AtAttribute to StorageClass
CyberShadow Jun 20, 2021
bf33510
spec/function.dd: Make VariadicArgumentsAttributes optional in Parame…
CyberShadow Jun 20, 2021
6669058
spec/statement.dd: Specify that case/default statements may lack a body
CyberShadow Jun 20, 2021
a3c9e1e
spec/attribute.dd: Specify possible trailing comma in LinkageAttribute
CyberShadow Jun 20, 2021
60322fc
spec/function.dd: Add scope to MemberFunctionAttribute
CyberShadow Jun 20, 2021
2811154
spec/function.dd: Add default values for anonymous parameters
CyberShadow Jun 20, 2021
04616ac
spec/function.dd: Remove "ref" from "return ref"
CyberShadow Jun 20, 2021
327c07e
spec/lex.dd: Allow __LINE__ in #line SpecialTokenSequence
CyberShadow Jun 25, 2021
08dcff2
Revert "spec/function.dd: Fix FunctionLiteralBody"
CyberShadow Jun 25, 2021
913c12d
spec/iasm.dd: Expand definition of Register and Register64
CyberShadow Jun 26, 2021
437680d
spec/expression.dd: Move `( Type ) . Identifier` to PrimaryExpression
CyberShadow Jun 26, 2021
1b1391e
spec/function.dd: Allow trailing comma in ParameterList
CyberShadow Jun 26, 2021
947e149
spec/declaration.dd: Update grammar syntax in AliasAssign / AliasReas…
CyberShadow Jul 4, 2021
403bdbc
spec/function.dd: Document optional contracts for ShortenedFunctionBody
CyberShadow Jul 4, 2021
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 spec/attribute.dd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ $(H2 $(LNAME2 linkage, Linkage Attribute))
$(GRAMMAR
$(GNAME LinkageAttribute):
$(D extern) $(D $(LPAREN)) $(GLINK LinkageType) $(D $(RPAREN))
$(D extern) $(D $(LPAREN)) $(D C++) $(D ,) $(D $(RPAREN))
$(D extern) $(D $(LPAREN)) $(D C++) $(D ,) $(GLINK2 type, QualifiedIdentifier) $(D $(RPAREN))
$(D extern) $(D $(LPAREN)) $(D C++) $(D ,) $(GLINK NamespaceList) $(D $(RPAREN))

Expand Down
25 changes: 10 additions & 15 deletions spec/class.dd
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ $(GNAME ClassDeclaration):
$(GLINK2 template, ClassTemplateDeclaration)

$(GNAME BaseClassList):
$(D :) $(GLINK SuperClass)
$(D :) $(GLINK SuperClass) $(D ,) $(GLINK Interfaces)
$(D :) $(GLINK Interfaces)
$(D :) $(GLINK SuperClassOrInterface)
$(D :) $(GLINK SuperClassOrInterface) $(D ,) $(GLINK Interfaces)

$(GNAME SuperClass):
$(GNAME SuperClassOrInterface):
$(GLINK2 type, BasicType)

$(GNAME Interfaces):
Expand Down Expand Up @@ -315,7 +314,6 @@ $(H2 $(LNAME2 constructors, Constructors))

$(GRAMMAR
$(GNAME Constructor):
$(D this) $(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT) $(D ;)
$(D this) $(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT) $(GLINK2 function, FunctionBody)
$(GLINK2 template, ConstructorTemplate)
)
Expand Down Expand Up @@ -678,7 +676,6 @@ $(H2 $(LNAME2 destructors, Destructors))

$(GRAMMAR
$(GNAME Destructor):
$(D ~ this ( )) $(GLINK2 function, MemberFunctionAttributes)$(OPT) $(D ;)
$(D ~ this ( )) $(GLINK2 function, MemberFunctionAttributes)$(OPT) $(GLINK2 function, FunctionBody)
)

Expand Down Expand Up @@ -905,13 +902,13 @@ $(GNAME SharedStaticDestructor):
$(H2 $(LNAME2 invariants, Class Invariants))

$(GRAMMAR
$(GNAME ClassInvariant):
$(GNAME Invariant):
$(D invariant $(LPAREN) $(RPAREN)) $(GLINK2 statement, BlockStatement)
$(D invariant) $(GLINK2 statement, BlockStatement)
$(D invariant $(LPAREN)) $(GLINK2 expression, AssertArguments) $(D $(RPAREN) ;)
)

$(P $(I ClassInvariant) specify the relationships among the members of a class instance.
$(P Class $(I Invariant)s specify the relationships among the members of a class instance.
Those relationships must hold for any interactions with the instance from its
public interface.
)
Expand All @@ -927,10 +924,10 @@ $(GNAME ClassInvariant):

$(P There may be multiple invariants in a class. They are applied in lexical order.)

$(P $(I ClassInvariant)s must hold at the exit of the class constructor (if any),
$(P Class $(I Invariant)s must hold at the exit of the class constructor (if any),
at the entry of the class destructor (if any).)

$(P $(I ClassInvariant)s must hold
$(P Class $(I Invariant)s must hold
at the entry and exit of all public or exported non-static member functions.
The order of application of invariants is:
$(OL
Expand Down Expand Up @@ -986,7 +983,7 @@ $(GNAME ClassInvariant):

$(IMPLEMENTATION_DEFINED
$(OL
$(LI Whether the $(I Class Invariant) is executed at runtime or not. This is typically
$(LI Whether the class $(I Invariant) is executed at runtime or not. This is typically
controlled with a compiler switch.)
$(LI The behavior when the invariant does not hold is typically the same as
for when $(GLINK2 expression, AssertExpression)s fail.)
Expand All @@ -1009,7 +1006,6 @@ $(H2 $(LNAME2 allocators, Class Allocators))
$(B Note): Class allocators are deprecated in D2.
$(GRAMMAR
$(GNAME Allocator):
$(D new) $(GLINK2 function, Parameters) $(D ;)
$(D new) $(GLINK2 function, Parameters) $(GLINK2 function, FunctionBody)
)

Expand Down Expand Up @@ -1089,7 +1085,6 @@ assert(foo.x == int.init); // object is still accessible

$(GRAMMAR
$(GNAME Deallocator):
$(D delete) $(GLINK2 function, Parameters) $(D ;)
$(D delete) $(GLINK2 function, Parameters) $(GLINK2 function, FunctionBody)
)

Expand Down Expand Up @@ -1534,7 +1529,7 @@ $(H3 $(LNAME2 anonymous, Anonymous Nested Classes))

$(GRAMMAR
$(GNAME NewAnonClassExpression):
$(D new) $(GLINK2 expression, AllocatorArguments)$(OPT) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK SuperClass)$(OPT) $(GLINK Interfaces)$(OPT) $(GLINK2 struct, AggregateBody)
$(D new) $(GLINK2 expression, AllocatorArguments)$(OPT) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK SuperClassOrInterface)$(OPT) $(GLINK Interfaces)$(OPT) $(GLINK2 struct, AggregateBody)

$(GNAME ConstructorArgs):
$(D $(LPAREN)) $(GLINK2 expression, ArgumentList)$(OPT) $(D $(RPAREN))
Expand All @@ -1543,7 +1538,7 @@ $(GNAME ConstructorArgs):
which is equivalent to:

$(GRAMMAR_INFORMATIVE
$(D class) $(GLINK_LEX Identifier) $(D :) $(I SuperClass) $(I Interfaces) $(I AggregateBody)
$(D class) $(GLINK_LEX Identifier) $(D :) $(I SuperClassOrInterface) $(I Interfaces) $(I AggregateBody)
// ...
$(D new) $(I AllocatorArguments) $(I Identifier) $(I ConstructorArgs)
)
Expand Down
2 changes: 1 addition & 1 deletion spec/contracts.dd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $(H2 $(LNAME2 pre_post_contracts, Pre and Post Contracts))

$(H2 $(LNAME2 Invariants, Invariants))

$(P See $(DDSUBLINK struct, StructInvariant, Struct Invariants) and $(DDSUBLINK class, invariants, Class Invariants).)
$(P See $(DDSUBLINK struct, Invariant, Struct Invariants) and $(DDSUBLINK class, invariants, Class Invariants).)


$(H2 $(LNAME2 references, References))
Expand Down
15 changes: 8 additions & 7 deletions spec/declaration.dd
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ $(GNAME StorageClasses):
$(GNAME StorageClass):
$(MULTICOLS 5, $(GLINK2 attribute, LinkageAttribute)
$(GLINK2 attribute, AlignAttribute)
$(GLINK2 attribute, AtAttribute)
$(D deprecated)
$(D enum)
$(D static)
Expand Down Expand Up @@ -434,7 +435,7 @@ $(H2 $(LNAME2 AliasAssign, Alias Assign))

$(GRAMMAR
$(GNAME AliasAssign):
$(I Identifier) $(D =) $(GLINK Type)
$(GLINK_LEX Identifier) $(D =) $(GLINK2 type, Type)
)

$(P An $(GLINK AliasDeclaration) can have a new value assigned to it with an
Expand Down Expand Up @@ -501,12 +502,12 @@ pragma(msg, TK); // prints tuple(3, (const(uint)), (int))

$(H2 $(LNAME2 alias-reassignment, Alias Reassignment))

$(GRAMMAR
$(GNAME AliasReassignment):
$(GLINK_LEX Identifier) $(D =) $(GLINK StorageClasses)$(OPT) $(GLINK Type)
$(GLINK_LEX Identifier) $(D =) $(GLINK2 expression, FunctionLiteral)
$(GLINK_LEX Identifier) $(D =) $(GLINK StorageClasses)$(OPT) $(GLINK BasicType) $(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT)
)
$(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)
)

$(P An alias declaration inside a template can be reassigned a new value.)

Expand Down
8 changes: 4 additions & 4 deletions spec/expression.dd
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,6 @@ $(GNAME UnaryExpression):
$(D +) $(GSELF UnaryExpression)
$(D !) $(GSELF UnaryExpression)
$(GLINK ComplementExpression)
$(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN) .) $(IDENTIFIER)
$(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN) .) $(GLINK2 template, TemplateInstance)
$(GLINK DeleteExpression)
$(GLINK CastExpression)
$(GLINK PowExpression)
Expand Down Expand Up @@ -1372,6 +1370,8 @@ $(GNAME PrimaryExpression):
$(GLINK ImportExpression)
$(GLINK NewExpression)
$(GLINK2 type, FundamentalType) $(D .) $(IDENTIFIER)
$(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN) .) $(IDENTIFIER)
$(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN) .) $(GLINK2 template, TemplateInstance)
$(GLINK2 type, FundamentalType) $(D $(LPAREN)) $(GLINK ArgumentList)$(OPT) $(D $(RPAREN))
$(GLINK2 type, TypeCtor) $(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN)) $(D .) $(IDENTIFIER)
$(GLINK2 type, TypeCtor) $(D $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN)) $(D $(LPAREN)) $(GLINK ArgumentList)$(OPT) $(D $(RPAREN))
Expand Down Expand Up @@ -1933,11 +1933,11 @@ $(GNAME AssertArguments):
)

$(P If the first $(I AssignExpression) is a reference to a class instance for
which a $(DDSUBLINK spec/class, invariants, Class Invariant) exists, the $(I Class Invariant) must hold.
which a $(DDSUBLINK spec/class, invariants, class Invariant) exists, the class $(I Invariant) must hold.
)

$(P If the first $(I AssignExpression) is a pointer to a struct instance for
which a $(I Struct Invariant) exists, the $(I Struct Invariant) must hold.
which a struct $(I Invariant) exists, the struct $(I Invariant) must hold.
)

$(P The type of an $(I AssertExpression) is $(D void).
Expand Down
9 changes: 7 additions & 2 deletions spec/function.dd
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ $(GNAME Parameters):

$(GNAME ParameterList):
$(GLINK Parameter)
$(GLINK Parameter) $(D ,)
$(GLINK Parameter) $(D ,) $(GSELF ParameterList)
$(GLINK VariadicArgumentsAttributes) $(D ...)
$(GLINK VariadicArgumentsAttributes)$(OPT) $(D ...)

$(GNAME Parameter):
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator)
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator) $(D ...)
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, BasicType) $(GLINK2 declaration, Declarator) $(D =) $(ASSIGNEXPRESSION)
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, Type)
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, Type) $(D ...)
$(GLINK ParameterAttributes)$(OPT) $(GLINK2 type, Type) $(D =) $(ASSIGNEXPRESSION)

$(GNAME ParameterAttributes):
$(GLINK InOut)
Expand All @@ -56,7 +58,7 @@ $(GNAME InOut):
$(D lazy)
$(D out)
$(D ref)
$(RELATIVE_LINK2 return-ref-parameters, $(D return ref))
$(RELATIVE_LINK2 return-ref-parameters, $(D return))
$(D scope)

$(GNAME VariadicArgumentsAttributes):
Expand All @@ -81,6 +83,7 @@ $(GNAME FunctionAttributes):
$(GNAME FunctionAttribute):
$(GLINK2 attribute, FunctionAttributeKwd)
$(GLINK2 attribute, Property)
$(GLINK2 attribute, AtAttribute)

$(GNAME MemberFunctionAttributes):
$(GLINK MemberFunctionAttribute)
Expand All @@ -91,6 +94,7 @@ $(GNAME MemberFunctionAttribute):
$(D immutable)
$(D inout)
$(D return)
$(D scope)
$(D shared)
$(GLINK FunctionAttribute)
)
Expand Down Expand Up @@ -118,6 +122,7 @@ $(GNAME MissingFunctionBody):

$(GNAME ShortenedFunctionBody):
$(D =>) $(GLINK2 expression, AssignExpression) $(D ;)
$(GLINK FunctionContracts)$(OPT) $(GLINK InOutContractExpression) $(D =>) $(GLINK2 expression, AssignExpression) $(D ;)
)

$(P Examples:)
Expand Down
Loading