Commit 48ea4f8f authored by baueko's avatar baueko
Browse files

added more missing files, deleted obsolete file

parent 929daa1f
package de.in.tum.www2.cup.analysis;
public class JavaVariableVisitor extends Visitor<Object> {
}
......@@ -2,7 +2,7 @@ package de.in.tum.www2.cup.ast;
//=========================================================================
//
// This skeleton was generated by Mouse 1.7 at 2016-11-09 10:49:44 GMT
// This skeleton was generated by Mouse 1.7 at 2016-11-10 09:01:55 GMT
// from grammar
// 'C:\workspace\mouse-with-syntaxtree\examples\example11\Java.1.8.peg'.
//
......@@ -34,6 +34,40 @@ class JavaSemantics extends mouse.runtime.SemanticsBase implements JavaSemantics
else lhs().put(new XMLElement.NonTerminal("Compilation",0,elems.toArray(new XMLElement[0])));
}
//=====================================================================
// StartClassBody = Spacing ClassBodyDeclaration* SUB? EOT ;
//=====================================================================
void $TREE$StartClassBody(){
LinkedList<XMLElement> elems = new LinkedList<>();
for (int i=0;i<rhsSize();i++) {
if (rhs(i).get()==null) continue;
if (rhs(i).isTerm()){
Phrase p= rhs(i);
elems.add(new XMLElement.Terminal(new Location(p.getStartLine(),p.getStartColumn(),p.getStartPos()),"terminal",rhs(i).text(),new Location(p.getEndLine(),p.getEndColumn(),p.getEndPos())));
}
else
elems.add((XMLElement)rhs(i).get());
}
if (elems.size()==0) lhs().put(new XMLElement.Terminal(new Location(lhs().getStartLine(),lhs().getStartColumn(),lhs().getStartPos()),"StartClassBody",lhs().text(),new Location(lhs().getStartLine(),lhs().getStartColumn(),lhs().getStartPos())));
else lhs().put(new XMLElement.NonTerminal("StartClassBody",0,elems.toArray(new XMLElement[0])));
}
//=====================================================================
// StartMethodBody = Spacing BlockStatements SUB? EOT ;
//=====================================================================
void $TREE$StartMethodBody(){
LinkedList<XMLElement> elems = new LinkedList<>();
for (int i=0;i<rhsSize();i++) {
if (rhs(i).get()==null) continue;
if (rhs(i).isTerm()){
Phrase p= rhs(i);
elems.add(new XMLElement.Terminal(new Location(p.getStartLine(),p.getStartColumn(),p.getStartPos()),"terminal",rhs(i).text(),new Location(p.getEndLine(),p.getEndColumn(),p.getEndPos())));
}
else
elems.add((XMLElement)rhs(i).get());
}
if (elems.size()==0) lhs().put(new XMLElement.Terminal(new Location(lhs().getStartLine(),lhs().getStartColumn(),lhs().getStartPos()),"StartMethodBody",lhs().text(),new Location(lhs().getStartLine(),lhs().getStartColumn(),lhs().getStartPos())));
else lhs().put(new XMLElement.NonTerminal("StartMethodBody",0,elems.toArray(new XMLElement[0])));
}
//=====================================================================
// SUB = "\u001a" ;
//=====================================================================
void $TREE$SUB(){
......@@ -2674,8 +2708,7 @@ class JavaSemantics extends mouse.runtime.SemanticsBase implements JavaSemantics
else lhs().put(new XMLElement.NonTerminal("ImportDeclaration",0,elems.toArray(new XMLElement[0])));
}
//=====================================================================
// TypeDeclaration = InterfaceDeclaration / ClassBodyDeclaration /
// MethodBody / SEMI ;
// TypeDeclaration = ClassDeclaration / InterfaceDeclaration / SEMI ;
//=====================================================================
void $TREE$TypeDeclaration(){
LinkedList<XMLElement> elems = new LinkedList<>();
......
package de.in.tum.www2.cup.ast;
import java_cup.runtime.ComplexSymbolFactory.Location;
import java.util.LinkedList;
import java.util.List;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java_cup.runtime.XMLElement;
import java_cup.runtime.XMLElement.Terminal;
import mouse.runtime.Phrase;
public interface JavaSemanticsUsercode {
Phrase lhs();
Phrase rhs(int i);
//-------------------------------------------------------------------
// Identifier = !Keyword Letter LetterOrDigit* Spacing
//-------------------------------------------------------------------
default void Identifier()
{
XMLElement x = (XMLElement)lhs().get();
lhs().put(new XMLElement.Terminal(new Location(lhs().getStartLine(),lhs().getStartColumn(),lhs().getStartPos()),"Identifier",lhs().text().trim(),new Location(lhs().getEndLine(),lhs().getEndColumn(),lhs().getEndPos())));
}
//-------------------------------------------------------------------
// CLASS = "class" !LetterOrDigit Spacing
// INTERFACE = "interface" !LetterOrDigit Spacing
// LPAR = "(" Spacing
// RPAR = ")" Spacing
// LWING = "{" Spacing
// RWING = "}" Spacing
// SEMI = ";" Spacing
// Spacing = ([ \t\r\n\f]+ / "/*" _*+ "*/" / "//" _*+ [\r\n])*
//-------------------------------------------------------------------
default void Suppress()
{
lhs().put(null);
}
Phrase lhs();
Phrase rhs(int i);
// -------------------------------------------------------------------
// Identifier = !Keyword Letter LetterOrDigit* Spacing
// -------------------------------------------------------------------
default void Identifier() {
XMLElement x = (XMLElement) lhs().get();
lhs().put(new XMLElement.Terminal(
new Location(lhs().getStartLine(), lhs().getStartColumn(), lhs().getStartPos()), "Identifier",
lhs().text().trim(), new Location(lhs().getEndLine(), lhs().getEndColumn(), lhs().getEndPos())));
// System.out.println("\n TEST: " + x);
}
// -------------------------------------------------------------------
// CLASS = "class" !LetterOrDigit Spacing
// INTERFACE = "interface" !LetterOrDigit Spacing
// LPAR = "(" Spacing
// RPAR = ")" Spacing
// LWING = "{" Spacing
// RWING = "}" Spacing
// SEMI = ";" Spacing
// Spacing = ([ \t\r\n\f]+ / "/*" _*+ "*/" / "//" _*+ [\r\n])*
// -------------------------------------------------------------------
default void Suppress() {
lhs().put(null);
}
default void VariableDeclaratorId() {
XMLElement x = (XMLElement) lhs().get();
List<String> tokenList = new LinkedList<>();
lhs().put(new TerminalWithTokenList(
new Location(lhs().getStartLine(), lhs().getStartColumn(), lhs().getStartPos()), "VariableDeclaratorId",
lhs().text().trim(), new Location(lhs().getEndLine(), lhs().getEndColumn(), lhs().getEndPos()),
tokenList));
}
}
class TerminalWithTokenList extends Terminal {
List<String> tokenlist;
public TerminalWithTokenList(Location l, String symbolname, Location r, List<String> tokenList) {
this(l, symbolname, null, r, tokenList);
}
public TerminalWithTokenList(Location l, String symbolname, Object i, Location r, List<String> tokenList) {
super(l, symbolname, i, r);
this.tokenlist = tokenList;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment