Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 29, 2025
2 parents e6ffebb + 888a1e8 commit 6bdbc16
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/main/resources/grammars/Java8ReducedParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ normalInterfaceDeclaration
;

normalClassDeclaration
: (inheritanceModifier SPACE)? ('strictfp' SPACE)? 'class' SPACE /* $jsmith-unique */ Identifier classBody
: (inheritanceModifier SPACE)? ('strictfp' SPACE)? 'class' SPACE /* $jsmith-unique */ /* $jsmith-var-decl */ Identifier classBody
;

interfaceModifier
Expand All @@ -281,8 +281,34 @@ inheritanceModifier
| 'abstract'
;

/**
* @todo #15:30min Classes are generated with only one constructor.
* Currently, generating multiple constructors can cause a problem
* where a constructor with the same signature is generated several times.
* We need to make sure that only unique constructors with different numbers of parameters are generated.
*/

classBody /* $jsmith-scope */
: '{' classBodyDeclaration+ '}' NL
: '{' (constructorDeclaration)? classBodyDeclaration+'}' NL
;

constructorDeclaration
: NL constructorModifiers SPACE /* $jsmith-var-target */ Identifier SPACE '(' constructorParams ')' SPACE constructorBody
;

constructorParams
: (vardef (',' SPACE vardef)*)?
;

constructorBody
: methodBlock
;


constructorModifiers
: 'public'
| 'private'
| 'protected'
;

interfaceBody
Expand Down

1 comment on commit 6bdbc16

@0pdd
Copy link

@0pdd 0pdd commented on 6bdbc16 Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 15-38d67ab3 discovered in src/main/resources/grammars/Java8ReducedParser.g4) and submitted as #124. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.