Skip to content

Commit

Permalink
fixed a bug in a bugfix
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@329 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Oct 8, 2008
1 parent 029322c commit 23c9a2c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
12 changes: 8 additions & 4 deletions topics/extraction/html2bgf/html2bgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def addSpaces(line,symb):
return line.replace(symb,' '+symb+' ')

def preprocess(line):
l2 = addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(line.strip(),'}'),'{'),'['),']'),')'),'('),';'),':')
l2 = addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(addSpaces(line.strip(),'}'),'{'),'['),']'),')'),'('),';')
l2 = l2.replace(' :',' $COLON$').replace(':',' $$$$$').replace('$COLON$',':')
return l2.replace('&gt ; ','>').replace('&lt ; ','<').replace('&amp ; ','&')

def parseLine(line):
Expand Down Expand Up @@ -299,7 +300,7 @@ def readGrammar(fn):
a,b=parseLine(line)
if a:
# non-empty line
if len(a)==2 and a[-1]==':' and oldline[0]!=' ' and oldline[0]!='\t':
if len(a)==2 and a[-1]=='$$$$$':
# new definition
if choices:
# flush the current one
Expand All @@ -311,7 +312,7 @@ def readGrammar(fn):
emph[0] = True
print 'Enforcing BNF mode (<em>) when new definition of',name,'starts.'
pessimistic[2] += 1
elif len(a)==4 and a[0]==a[2] and a[1]==':' and a[-1]==':':
elif len(a)==4 and a[0]==a[2] and a[1]=='$$$$$' and a[-1]=='$$$$$':
# new mingled definition
if choices:
# flush the current one
Expand All @@ -321,7 +322,7 @@ def readGrammar(fn):
oneof = False
print name,'double-declared, fixed'
pessimistic[2] += 1
elif len(a)==4 and a[1]==':' and a[2]=='one' and a[3]=='of':
elif len(a)==4 and a[1]=='$$$$$' and a[2]=='one' and a[3]=='of':
# new "one-of" definition
if choices:
addProduction(name,choices,oneof)
Expand Down Expand Up @@ -382,6 +383,9 @@ def automatedImprove():
if not bs[i]:
i+=1
continue
if bs[i]=='"$$$$$"':
# production-separation hack
bs[i]='":"'
if bs[i]=='?????':
# Change to classic EBNF
if i>0:
Expand Down
1 change: 1 addition & 0 deletions topics/java/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Versions of Java programming language are:
3) "Java 2" = "J2SE 1.2" = "Playground" - 1998, standardised by The Java Language Specification Second Edition
see http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html
see http://java.sun.com/docs/books/jls/download/langspec-2.0.pdf
see http://java.sun.com/docs/books/jls/clarifications-2-2nd-ed.html
see jls2 directory for a grammar extractor from §18 of JLS2

4) "Java 3" = "J2SE 1.3" = "Kestrel", 2000, not standardised due to few language changes
Expand Down
11 changes: 7 additions & 4 deletions topics/java/lci/java.lcf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
</grammar>
</source>


<target>
<name>one</name>
<branch>
Expand Down Expand Up @@ -125,6 +126,7 @@
<perform>breakSemantics2doc</perform>
</branch>
</target>


<target>
<name>three</name>
Expand All @@ -144,10 +146,11 @@
<perform>inlineStatements2doc</perform>
<perform>inlineExpressions2doc</perform>
<perform>refactorClassDeclarations3</perform>
<perform>breakSemantics3doc</perform>
</branch>
</target>

<!--<target>
<target>
<name>onetwo</name>
<branch>
<input>one</input>
Expand Down Expand Up @@ -179,7 +182,7 @@
<input>doc</input>
</branch>
</target>
-->

<target>
<name>doc</name>
<branch>
Expand All @@ -201,7 +204,7 @@
<perform>fixErrors3doc</perform>
</branch>
</target>
<!--

<target>
<name>formal</name>
<branch>
Expand All @@ -213,6 +216,6 @@
<branch>
<input>jls3app</input>
</branch>
</target-->
</target>

</lcf:configuration>
3 changes: 3 additions & 0 deletions topics/java/lci/xbgf/addFeatures2to3doc.xbgf
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@
</bgf:production>
</xbgf:define>
<xbgf:horizontal>SwitchLabel</xbgf:horizontal>
<xbgf:distribute>
<nonterminal>SwitchLabel</nonterminal>
</xbgf:distribute>

<!--
- Fail: ImportDeclaration.
Expand Down
1 change: 1 addition & 0 deletions topics/java/lci/xbgf/refactorClassDeclarations3.xbgf
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@
- [], ,([t(<), n(TypeParameterList), t(>)])
-->
<xbgf:deyaccify>TypeParameterList</xbgf:deyaccify>
<xbgf:inline>TypeParameterList</xbgf:inline>

<!--
- Fail: TypeParameter.
Expand Down

0 comments on commit 23c9a2c

Please sign in to comment.