Skip to content

Commit

Permalink
* Added a Makefile to LDF->BGF dir, which otherwise is empty
Browse files Browse the repository at this point in the history
  since the sheet is shared/xsl and the script is in shared/tools.
  It has a test target that searches for all LDFs in SLPS,
  extracts BGFs from them and validates the results.
* Added test target to XSD repository that validates all schemata.
* Fixed tiny bug in LDF2BGF sheet that copied language attribute of <bgf:grammar>. I have a feeling that it was more of a a feature andeventually we'll need to change BGF schema to reflect that.
* Upgraded ldf2bgf script so that it can accept one parameter.
  In such a case it produces a file in the directory from which it is run
  with a name of the source and a proper extension.


git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@84 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Jul 29, 2008
1 parent 533c720 commit 7abcef4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
20 changes: 12 additions & 8 deletions shared/tools/ldf2bgf
@@ -1,20 +1,24 @@
#! /bin/sh
#!/bin/sh

# Get our hands on the languedoc basedir
LOCAL=${PWD}
cd `dirname $0`
cd ../..
SLPS=${PWD}
cd ${LOCAL}

if [ $# -ne 2 ]; then
echo "This tool transforms Language Document Format to BNF-like Grammar Format"
echo "Usage: ldf2bgf <input-language-document> <output-grammar>"
exit 1
elif [ ! -r $1 ]; then
if [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
else
elif [ $# -eq 2 ]
then
rm -f $2
xsltproc ${SLPS}/shared/xsl/ldf2bgf.xslt $1 > $2
elif [ $# -eq 1 ]
then
xsltproc ${SLPS}/shared/xsl/ldf2bgf.xslt $1 > ${LOCAL}/`basename $1 .ldf`.bgf
else
echo "This tool transforms Language Document Format to BNF-like Grammar Format"
echo "Usage: ldf2bgf <input-language-document> [<output-grammar>]"
exit 2
fi

12 changes: 8 additions & 4 deletions shared/xsd/Makefile
@@ -1,8 +1,12 @@
validator = ../../download/msv/msv.jar

build:

test:
ls -1 *.xsd | xargs -n1 java -jar ${validator}

clean:
rm -rf bin
rm -rf obj
rm -rf *.user
rm -rf *.suo
rm -rf bin obj
rm -f *.user
rm -f *.suo

4 changes: 3 additions & 1 deletion shared/xsl/Makefile
Expand Up @@ -3,4 +3,6 @@ build:
test:

clean:

rm -rf bin obj
rm -f *.user
rm -f *.suo
2 changes: 1 addition & 1 deletion shared/xsl/ldf2bgf.xslt
Expand Up @@ -11,7 +11,7 @@
</xsl:template>

<xsl:template match="grammar">
<xsl:copy-of select="@*|node()"/>
<xsl:copy-of select="node()"/>
</xsl:template>

<xsl:template match="text"/>
Expand Down
14 changes: 14 additions & 0 deletions topics/extraction/ldf2bgf/Makefile
@@ -0,0 +1,14 @@
ldf2bgf = ../../../shared/tools/ldf2bgf
validator = ../../../download/msv/msv.jar
bgfxsd = ../../../shared/xsd/bgf.xsd

all:
make clean
make test

test:
find ../../.. -name "*.ldf" | xargs -n1 ${ldf2bgf}
ls -1 *.bgf | xargs java -jar ${validator} ${bgfxsd}

clean:
rm -f *.bgf

0 comments on commit 7abcef4

Please sign in to comment.