Skip to content

Commit d02b7ca

Browse files
committed
Fixes for parse clashes with projections.
1 parent 38cbcc3 commit d02b7ca

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

semantics/cpp/language/common/dynamic.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ module CPP-SCOPE-SYNTAX
202202

203203
syntax NamespaceScope ::= namespaceScope(Namespace)
204204

205-
syntax ClassScope ::= classScope(Class, isInBody: Bool)
205+
syntax ClassScope ::= classScope(Class, inBody: Bool)
206206

207207
syntax BlockScope ::= blockScope(QualId, SymBase, Int) [klabel(blockScopeCpp)]
208208

semantics/cpp/language/translation/decl/declarator.k

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR
342342
=> defineLocalStaticObject(X, bnew(!I:Int, T, Set, static(Tu)), T, Init, Type, Set)
343343
~> Declare.potentiallyInvokeDestructor(T)
344344
...</k>
345-
345+
346346
<curr-tr-scope> S::Scope </curr-tr-scope>
347347
<curr-template-context> noTemplate </curr-template-context>
348348
<curr-tr-tu> Tu::String </curr-tr-tu>
@@ -622,7 +622,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR
622622
<curr-tr-program-loc> Loc::CabsLoc </curr-tr-program-loc>
623623
<external-decls-loc> DeclsLoc::Map => addOdrDecl(DeclsLoc, CName, Loc) </external-decls-loc>
624624
625-
syntax KItem ::= newExternalType(cname: CId, type: CPPType)
625+
syntax NewExternalType ::= newExternalType(cname: CId, type: CPPType)
626626
627627
rule <k> newExternalType(CName::CId, T::CPPType) => .K ...</k>
628628
<external-types> ET::Map => addOdrDecl(ET, CName, convertTypeToC(T)) </external-types>

semantics/cpp/language/translation/decl/enum.k

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module CPP-TRANSLATION-DECL-ENUM
128128
<enum-type> cppEnumType #as E2::CPPType </enum-type>
129129
requires E1 =/=K E2
130130

131-
syntax KItem ::= declareEnumerators(CPPType, min: Int, max: Int, next: Int, prevType: CPPSimpleType, enums: List, fixed: Bool, first: Bool)
131+
syntax DeclareEnumerators ::= declareEnumerators(CPPType, min: Int, max: Int, next: Int, prevType: CPPSimpleType, enums: List, fixed: Bool, first: Bool)
132132

133133
rule (.K => C) ~> declareEnumerators(... enums: ListItem(DeclLoc(C::CabsLoc, D::Decl) => D) _)
134134

@@ -272,7 +272,7 @@ module CPP-TRANSLATION-DECL-ENUM
272272
rule firstSuitableType(_, _, (ListItem(_) => .List) _) [owise]
273273

274274

275-
syntax KItem ::= calculateEnumValues(CPPType, min: Int, max: Int)
275+
syntax CalculateEnumValues ::= calculateEnumValues(CPPType, min: Int, max: Int)
276276

277277
syntax Int ::= calculateMaxEnumValue(emin: Int, emax: Int) [function]
278278

@@ -295,12 +295,12 @@ module CPP-TRANSLATION-DECL-ENUM
295295

296296
rule calculateEnumValues(T::CPPType, Min::Int, Max::Int) => computeEnumUt(T, calculateMinEnumValue(Min, Max), calculateMaxEnumValue(Min, Max))
297297

298-
syntax KItem ::= computeEnumUt(CPPType, min: Int, max: Int)
298+
syntax ComputeEnumUt ::= computeEnumUt(CPPType, min: Int, max: Int)
299299

300300
// TODO(h0nzZik): packed enums
301301
rule computeEnumUt(T::CPPType, Min::Int, Max::Int) => setEnumMinMaxUt(T, Min, Max, type(firstSuitableType(Min, Max, integralTypesGreaterThanInt)))
302302

303-
syntax KItem ::= setEnumMinMaxUt(CPPType, min: Int, max: Int, ut: CPPType)
303+
syntax SetEnumMinMaxUt ::= setEnumMinMaxUt(CPPType, min: Int, max: Int, ut: CPPType)
304304

305305
rule <k> setEnumMinMaxUt(t(_, _, unscopedEnum(_ :: Enum(X::CId) #as E::Enum, _, Fixed:Bool)) #as T::CPPType, Min::Int, Max::Int, cppIntegerType #as UT::CPPType)
306306
=> addEnumToEnv(X, t(noQuals, .Set, unscopedEnum(E, UT, Fixed))) ... </k>

semantics/cpp/language/translation/decl/initializer.k

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ module CPP-TRANSLATION-DECL-INITIALIZER-SYNTAX
77
imports CPP-TYPING-SORTS
88

99
// The 'duration' parameter is only passed to `bindReference`
10-
syntax Expr ::= figureInit(base: Expr, destT: CPPType, init: Init, type: InitType, duration: Duration)
11-
| figureConstructorInit(base: Expr, destT: CPPType, init: Init, constructorType: Bool)
10+
syntax Expr ::= figureConstructorInit(base: Expr, destT: CPPType, init: Init, constructorType: Bool)
11+
12+
syntax Expr ::= FigureInit
13+
syntax FigureInit ::= figureInit(base: Expr, destT: CPPType, init: Init, type: InitType, duration: Duration)
1214

1315
syntax Expr ::= valueInit(base: Expr, CPPType)
1416
| defaultConstructorInit(base: Expr, CPPType, constructorType: Bool)
@@ -55,9 +57,11 @@ module CPP-TRANSLATION-DECL-INITIALIZER
5557
syntax Expr ::= #figureInit0(base: Expr, destT: CPPType, type: InitType, init: Init, ConstructorType, Duration)
5658
| #figureInit(base: Expr, destT: CPPType, type: InitType, init: Init, srcT: K, srcCat: K, ConstructorType, Duration)
5759
| constructorInit(LVal, InitType, Class, List, ConstructorType)
58-
| zeroInit(base: Expr, type: CPPType)
5960
| InitStyle "(" Expr "," CPPType "," ConstructorType ")"
6061

62+
syntax Expr ::= ZeroInit
63+
syntax ZeroInit ::= zeroInit(base: Expr, type: CPPType)
64+
6165
syntax InitStyle ::= "defaultInit" | "#valueInit" | "#zeroInit"
6266

6367
rule valueInit(Base::Expr, T::CPPType) => #valueInit(Base, T, NoConstructorInit)
@@ -260,8 +264,8 @@ module CPP-TRANSLATION-DECL-INITIALIZER
260264

261265
syntax KItem ::= listInit(LVal, CPPType, InitType, List, ConstructorType, Duration)
262266
| aggInit(LVal, CPPType, List, ConstructorType, Duration)
263-
| arrayInit(base: LVal, type: CPPType, current: Int, initList: List, result: MaybeExpr, ctype: ConstructorType, duration: Duration)
264267
| strInit(LVal, CPPType, CharKind, String, Int, MaybeExpr)
268+
syntax ArrayInit ::= arrayInit(base: LVal, type: CPPType, current: Int, initList: List, result: MaybeExpr, ctype: ConstructorType, duration: Duration)
265269

266270
// @ref n4296 8.5.4:3.1 (aggregate init)
267271
rule listInit(Base::LVal, T::CPPType, _, L::List, CT::ConstructorType, D::Duration)

semantics/cpp/language/translation/temporary.k

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ module CPP-TRANSLATION-TEMPORARY-SYNTAX
44
imports CPP-SORTS
55
imports CPP-TYPING-SORTS
66

7-
syntax Expr ::= createTemporary(temporary: Expr, type: CPPType, init: KItem) [strict(3)]
7+
syntax Expr ::= CreateTemporary
8+
syntax CreateTemporary ::= createTemporary(temporary: Expr, type: CPPType, init: KItem) [strict(3)]
89
endmodule
910

1011
module CPP-TRANSLATION-TEMPORARY

0 commit comments

Comments
 (0)