Skip to content

Commit

Permalink
more restructuring, struggling to conform to own recipe
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@616 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed May 1, 2009
1 parent 5acd4a9 commit 8bed498
Show file tree
Hide file tree
Showing 10 changed files with 1,117 additions and 950 deletions.
16 changes: 9 additions & 7 deletions topics/java/lci/java.lcf
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<perform>rename-doc2</perform>
</namematching>
<refactoring>
<perform>generalizeModifiers</perform>
<perform>generalizeModifiers-doc2</perform>
<perform>generalizeNames</perform>
<perform>deyaccifyStatements</perform>
<perform>refactorTypes-doc2</perform>
Expand Down Expand Up @@ -185,20 +185,22 @@
<perform>rename-doc3</perform>
</namematching>
<refactoring>
<perform>generalizeModifiers</perform>
<perform>generalizeNames</perform>
<perform>deyaccifyStatements</perform>
<perform>refactorTypes-doc3</perform>
<perform>inlineForStatement</perform>
<perform>inlineStatements</perform>
<perform>generalizeStatements</perform>
<perform>refactorStatements-doc3</perform>
<perform>refactorClasses-doc3</perform>
<perform>refactorInterfaces-doc3</perform>
<perform>refactorEnums</perform>
<perform>refactorDeclarations-doc3</perform>
</refactoring>
<relaxation>
<perform>generalizeModifiers-doc3</perform>
<perform>relaxClasses-doc3</perform>
<perform>generalizeNames</perform>
<perform>refactorTypes-doc3</perform>
<perform>generalizeStatements</perform>
<perform>refactorInterfaces-doc3</perform>

<perform>refactorDeclarations-doc3</perform>
<perform>relaxExpressions-doc3</perform>
<perform>editExpressions-doc3</perform>
<perform>edit-doc3</perform>
Expand Down
2 changes: 1 addition & 1 deletion topics/java/lci/xbgf/edit-doc3.xbgf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</bgf:production>
</vertical>
</xbgf:add>

<!-- finishing touches -->
<xbgf:eliminate>FormalParameterList</xbgf:eliminate>
<xbgf:eliminate>LastFormalParameter</xbgf:eliminate>
Expand Down
136 changes: 136 additions & 0 deletions topics/java/lci/xbgf/generalizeModifiers-doc3.xbgf
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<xbgf:sequence
xmlns:bgf="http://planet-sl.org/bgf"
xmlns:xbgf="http://planet-sl.org/xbgf">

<!--
Unified modifiers should look like this:

ModifiersOpt:
{ Modifier }
ClassBodyDeclaration is defined as:
";"
[ "static" ] Block
ModifiersOpt MemberDecl
InterfaceBodyDeclaration is defined as:
";"
ModifiersOpt InterfaceMemberDecl
ClassOrInterfaceDeclaration is defined as:
ModifiersOpt ( ClassDeclaration | InterfaceDeclaration )

Non-unified modifiers take this form:

InterfaceDeclaration is defined as:
[ InterfaceModifiers ] "interface" Identifier [ ExtendsInterfaces ] InterfaceBody
AbstractMethodModifiers is defined as:
AbstractMethodModifier
AbstractMethodModifiers AbstractMethodModifier
ConstantDeclaration is defined as:
[ ConstantModifiers ] Type VariableDeclarators
InterfaceModifiers is defined as:
InterfaceModifier
InterfaceModifiers InterfaceModifier
FieldDeclaration is defined as:
[ FieldModifiers ] Type VariableDeclarators ";"
MethodModifiers is defined as:
MethodModifier
MethodModifiers MethodModifier
AbstractMethodDeclaration is defined as:
[ AbstractMethodModifiers ] ResultType MethodDeclarator [ Throws ] ";"
ClassDeclaration is defined as:
[ ClassModifiers ] "class" Identifier [ Super ] [ Interfaces ] ClassBody
FieldModifiers is defined as:
FieldModifier
FieldModifiers FieldModifier
ConstructorModifiers is defined as:
ConstructorModifier
ConstructorModifiers ConstructorModifier
ClassModifiers is defined as:
ClassModifier
ClassModifiers ClassModifier
MethodHeader is defined as:
[ MethodModifiers ] ResultType MethodDeclarator [ Throws ]
ConstantModifiers is defined as:
ConstantModifier
ConstantModifiers ConstantModifer
-->

<!-- First the deyaccification -->
<xbgf:deyaccify>Modifiers</xbgf:deyaccify>
<xbgf:deyaccify>AbstractMethodModifiers</xbgf:deyaccify>
<xbgf:deyaccify>InterfaceModifiers</xbgf:deyaccify>
<xbgf:deyaccify>MethodModifiers</xbgf:deyaccify>
<xbgf:deyaccify>FieldModifiers</xbgf:deyaccify>
<xbgf:deyaccify>ConstructorModifiers</xbgf:deyaccify>
<xbgf:deyaccify>ConstantModifiers</xbgf:deyaccify>

<!-- ISSUE PERMISSIVENESS
Now unification of singulars-->
<xbgf:unite>
<add>InterfaceModifier</add>
<to>Modifier</to>
</xbgf:unite>
<xbgf:unite>
<add>MethodModifier</add>
<to>Modifier</to>
</xbgf:unite>
<xbgf:unite>
<add>FieldModifier</add>
<to>Modifier</to>
</xbgf:unite>
<xbgf:unite>
<add>ConstructorModifier</add>
<to>Modifier</to>
</xbgf:unite>
<xbgf:unite>
<add>AbstractMethodModifier</add>
<to>Modifier</to>
</xbgf:unite>
<xbgf:unite>
<add>ConstantModifier</add>
<to>Modifier</to>
</xbgf:unite>

<!-- Getting rid of plurals altogether -->
<xbgf:eliminate>Modifiers</xbgf:eliminate>
<xbgf:inline>AbstractMethodModifiers</xbgf:inline>
<xbgf:inline>InterfaceModifiers</xbgf:inline>
<xbgf:inline>MethodModifiers</xbgf:inline>
<xbgf:inline>FieldModifiers</xbgf:inline>
<xbgf:inline>ConstructorModifiers</xbgf:inline>
<xbgf:inline>ConstantModifiers</xbgf:inline>
<xbgf:massage>
<bgf:expression>
<optional>
<bgf:expression>
<plus>
<bgf:expression>
<nonterminal>Modifier</nonterminal>
</bgf:expression>
</plus>
</bgf:expression>
</optional>
</bgf:expression>
<bgf:expression>
<star>
<bgf:expression>
<nonterminal>Modifier</nonterminal>
</bgf:expression>
</star>
</bgf:expression>
</xbgf:massage>

<!-- Making new nonterminal -->
<xbgf:extract>
<bgf:production>
<nonterminal>ModifiersOpt</nonterminal>
<bgf:expression>
<star>
<bgf:expression>
<nonterminal>Modifier</nonterminal>
</bgf:expression>
</star>
</bgf:expression>
</bgf:production>
</xbgf:extract>

</xbgf:sequence>
Loading

0 comments on commit 8bed498

Please sign in to comment.