Skip to content

Commit

Permalink
XBGF pretty-printer beautification
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@415 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Jan 7, 2009
1 parent de5335b commit 99dd509
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 47 deletions.
17 changes: 12 additions & 5 deletions shared/xsl/xbgf2xbnf.xslt
Expand Up @@ -25,9 +25,8 @@
<xsl:value-of select="$in/nonterminal" />
</xsl:when>
<xsl:when test="$in/label">
<xsl:text> in "</xsl:text>
<xsl:text> in #</xsl:text>
<xsl:value-of select="$in/label" />
<xsl:text>"</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
Expand Down Expand Up @@ -77,7 +76,7 @@
</xsl:text>
</xsl:template>

<xsl:template match="xbgf:designate">
<!--xsl:template match="xbgf:designate">
<xsl:value-of select="local-name()" />
<xsl:text>("</xsl:text>
<xsl:value-of select="./bgf:production/label" />
Expand All @@ -86,7 +85,7 @@
<xsl:apply-templates select="./bgf:production"/>
<xsl:text>);
</xsl:text>
</xsl:template>
</xsl:template-->

<xsl:template match="xbgf:deyaccify|xbgf:eliminate|xbgf:horizontal|xbgf:inline|xbgf:undefine">
<xsl:value-of select="local-name()" />
Expand Down Expand Up @@ -170,7 +169,15 @@
<xsl:value-of select="local-name()" />
<xsl:text>(</xsl:text>
<xsl:choose>
<xsl:when test="label|selector|terminal">
<xsl:when test="label">
<xsl:text>#</xsl:text>
<xsl:value-of select="*/text()" />
</xsl:when>
<xsl:when test="selector">
<xsl:value-of select="*/text()" />
<xsl:text>::</xsl:text>
</xsl:when>
<xsl:when test="terminal">
<xsl:value-of select="local-name(*)" />
<xsl:text>, "</xsl:text>
<xsl:value-of select="*/text()" />
Expand Down
4 changes: 2 additions & 2 deletions topics/java/lci/xbgf/correct-app3.xbgf
Expand Up @@ -26,7 +26,7 @@ Annotation:
- [], ;([*(,([n(InfixOp), n(Expression3)])), ,([n(Expression3), t(instanceof), n(Type)])])
-->
<!-- REVISE -->
<xbgf:replace>
<xbgf:replace tag="revise">
<bgf:expression>
<sequence>
<bgf:expression>
Expand Down Expand Up @@ -78,7 +78,7 @@ Annotation:
vs.
- [], ;([n(Block),
,([t(break), ?(n(Identifier)), t((;))]),
-->
-->
<!-- REVISE -->
<xbgf:replace>
<bgf:expression>
Expand Down
19 changes: 0 additions & 19 deletions topics/java/lci/xbgf/editDeclarations.xbgf
Expand Up @@ -1379,22 +1379,6 @@
vs.
,([?(t(static)), n(Block)]),
-->
<xbgf:designate>
<bgf:production>
<label>target</label>
<nonterminal>ClassBodyDeclaration</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<terminal>static</terminal>
</bgf:expression>
<bgf:expression>
<nonterminal>Block</nonterminal>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:designate>
<xbgf:widen>
<bgf:expression>
<terminal>static</terminal>
Expand All @@ -1410,9 +1394,6 @@
<nonterminal>ClassBodyDeclaration</nonterminal>
</in>
</xbgf:widen>
<xbgf:strip>
<label>target</label>
</xbgf:strip>

<!--
- Fail: ClassBodyDeclaration.
Expand Down
42 changes: 22 additions & 20 deletions topics/java/lci/xbgf/recover-app3.xbgf
Expand Up @@ -10,27 +10,29 @@
vs.
- [], ,([t({), n(BlockStatements), t(})])
-->
<!-- BREFACTOR -->
<xbgf:undefine>Block</xbgf:undefine>
<!-- REVISE -->
<xbgf:define>
<bgf:production>
<nonterminal>Block</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<terminal>{</terminal>
</bgf:expression>
<bgf:expression>
<nonterminal>BlockStatements</nonterminal>
</bgf:expression>
<bgf:expression>
<terminal>}</terminal>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:define>
<xbgf:replace>
<bgf:expression>
<star>
<bgf:expression>
<nonterminal>BlockStatements</nonterminal>
</bgf:expression>
</star>
</bgf:expression>
<bgf:expression>
<sequence>
<bgf:expression>
<terminal>{</terminal>
</bgf:expression>
<bgf:expression>
<nonterminal>BlockStatements</nonterminal>
</bgf:expression>
<bgf:expression>
<terminal>}</terminal>
</bgf:expression>
</sequence>
</bgf:expression>
</xbgf:replace>

<!-- ISSUE EXTRACTERROR
- Fail: AnnotationTypeBody.
Expand Down
2 changes: 1 addition & 1 deletion topics/java/lci/xbgf/refactor-app3.xbgf
Expand Up @@ -130,7 +130,7 @@
<xbgf:inline>InterfaceMethodDeclaratorRest</xbgf:inline>
<xbgf:inline>VoidInterfaceMethodDeclaratorRest</xbgf:inline>
<xbgf:inline>ConstantDeclaratorsRest</xbgf:inline>

<xbgf:inline>FormalParameters</xbgf:inline>
<xbgf:distribute>
<nonterminal>InterfaceBodyDeclaration</nonterminal>
</xbgf:distribute>
Expand Down

0 comments on commit 99dd509

Please sign in to comment.