Skip to content

Commit

Permalink
Roughly implement opaque (rest of files)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnezam committed Jan 30, 2024
1 parent 3c5177c commit f790863
Show file tree
Hide file tree
Showing 11 changed files with 3,246 additions and 3,130 deletions.
2 changes: 2 additions & 0 deletions src/main/antlr4/GobraLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ PROOF : 'proof';
GHOST_EQUALS : '===';
GHOST_NOT_EQUALS : '!==';
WITH : 'with';
OPAQUE : 'opaque';
REVEAL : 'reveal';
12 changes: 7 additions & 5 deletions src/main/antlr4/GobraParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ sqType: (kind=(SEQ | SET | MSET | OPT) L_BRACKET type_ R_BRACKET)

// Specifications

specification returns[boolean trusted = false, boolean pure = false;]:
((specStatement | PURE {$pure = true;} | TRUSTED {$trusted = true;}) eos)*? (PURE {$pure = true;})? // Non-greedily match PURE to avoid missing eos errors.
specification returns[boolean trusted = false, boolean pure = false, boolean opaque = false;]:
((specStatement | OPAQUE {$opaque = true;} | PURE {$pure = true;} | TRUSTED {$trusted = true;}) eos)*? (PURE {$pure = true;})? // Non-greedily match PURE to avoid missing eos errors.
;

specStatement
Expand Down Expand Up @@ -226,11 +226,11 @@ new_: NEW L_PAREN type_ R_PAREN;

// Added specifications and parameter info

specMember: specification (functionDecl[$specification.trusted, $specification.pure] | methodDecl[$specification.trusted, $specification.pure]);
specMember: specification (functionDecl[$specification.trusted, $specification.pure, $specification.opaque] | methodDecl[$specification.trusted, $specification.pure, $specification.opaque]);

functionDecl[boolean trusted, boolean pure]: FUNC IDENTIFIER (signature blockWithBodyParameterInfo?);
functionDecl[boolean trusted, boolean pure, boolean opaque]: FUNC IDENTIFIER (signature blockWithBodyParameterInfo?);

methodDecl[boolean trusted, boolean pure]: FUNC receiver IDENTIFIER (signature blockWithBodyParameterInfo?);
methodDecl[boolean trusted, boolean pure, boolean opaque]: FUNC receiver IDENTIFIER (signature blockWithBodyParameterInfo?);



Expand Down Expand Up @@ -376,7 +376,9 @@ primaryExpr:
| primaryExpr slice_ #slicePrimaryExpr
| primaryExpr seqUpdExp #seqUpdPrimaryExpr
| primaryExpr typeAssertion #typeAssertionPrimaryExpr
// REVEAL? primaryExpr arguments doesn't work due to mutual left recursion
| primaryExpr arguments #invokePrimaryExpr
| REVEAL primaryExpr arguments #revealInvokePrimaryExpr
| primaryExpr arguments AS closureSpecInstance #invokePrimaryExprWithSpec
| primaryExpr predConstructArgs #predConstrPrimaryExpr
| call_op=(
Expand Down
2,277 changes: 1,145 additions & 1,132 deletions src/main/java/viper/gobra/frontend/GobraLexer.java

Large diffs are not rendered by default.

Loading

0 comments on commit f790863

Please sign in to comment.