Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
7d7fd2be
Commit
7d7fd2be
authored
Feb 10, 2015
by
Sven Gestegård Robertz
Browse files
Options
Downloads
Patches
Plain Diff
cleanup and comment
parent
37fb1da8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/java/se/lth/control/labcomm/TypeDefParser.java
+9
-40
9 additions, 40 deletions
lib/java/se/lth/control/labcomm/TypeDefParser.java
lib/java/se/lth/control/labcomm/TypeDefVisitor.java
+3
-5
3 additions, 5 deletions
lib/java/se/lth/control/labcomm/TypeDefVisitor.java
with
12 additions
and
45 deletions
lib/java/se/lth/control/labcomm/TypeDefParser.java
+
9
−
40
View file @
7d7fd2be
...
@@ -15,35 +15,6 @@ import se.lth.control.labcomm.DecoderChannel;
...
@@ -15,35 +15,6 @@ import se.lth.control.labcomm.DecoderChannel;
import
se.lth.control.labcomm.TypeDef
;
import
se.lth.control.labcomm.TypeDef
;
import
se.lth.control.labcomm.TypeBinding
;
import
se.lth.control.labcomm.TypeBinding
;
// for BinaryScanner
// import beaver.Scanner;
// import beaver.Symbol;
// import se.lth.control.labcomm2014.compiler.LabComm;
// import se.lth.control.labcomm2014.compiler.LabCommParser;
//
// import se.lth.control.labcomm2014.compiler.List;
// import se.lth.control.labcomm2014.compiler.Program;
// import se.lth.control.labcomm2014.compiler.Decl;
// import se.lth.control.labcomm2014.compiler.TypeDecl;
// import se.lth.control.labcomm2014.compiler.SampleDecl;
// import se.lth.control.labcomm2014.compiler.Type;
// //import se.lth.control.labcomm2014.compiler.VoidType;
// //import se.lth.control.labcomm2014.compiler.SampleRefType;
// import se.lth.control.labcomm2014.compiler.PrimType;
// import se.lth.control.labcomm2014.compiler.UserType;
// import se.lth.control.labcomm2014.compiler.StructType;
// import se.lth.control.labcomm2014.compiler.Field;
// import se.lth.control.labcomm2014.compiler.ArrayType;
// import se.lth.control.labcomm2014.compiler.VariableArrayType;
// import se.lth.control.labcomm2014.compiler.FixedArrayType;
// import se.lth.control.labcomm2014.compiler.Dim;
// import se.lth.control.labcomm2014.compiler.Exp;
// import se.lth.control.labcomm2014.compiler.IntegerLiteral;
// import se.lth.control.labcomm2014.compiler.VariableSize;
//
////////////
public
class
TypeDefParser
implements
TypeDef
.
Handler
,
TypeBinding
.
Handler
{
public
class
TypeDefParser
implements
TypeDef
.
Handler
,
TypeBinding
.
Handler
{
static
class
SelfBinding
extends
TypeDef
{
static
class
SelfBinding
extends
TypeDef
{
...
@@ -144,13 +115,15 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
...
@@ -144,13 +115,15 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
}
}
}
}
//* temporary testing method */
private
TypeDef
getTypeDefForIndex
(
int
sampleIndex
)
{
public
TypeDef
getTypeDefForIndex
(
int
sampleIndex
)
{
return
typeDefs
.
get
(
typeBindings
.
get
(
sampleIndex
));
return
typeDefs
.
get
(
typeBindings
.
get
(
sampleIndex
));
}
}
/** Factory method
/** Factory method for use by application programs:
* registers a TypeDefParser for handling TypeDef and TypeBinding
* on the Decoder d.
*
* @return a new TypeDefParser registered on d
* @return a new TypeDefParser registered on d
*/
*/
public
static
TypeDefParser
registerTypeDefParser
(
Decoder
d
)
throws
java
.
io
.
IOException
{
public
static
TypeDefParser
registerTypeDefParser
(
Decoder
d
)
throws
java
.
io
.
IOException
{
...
@@ -165,12 +138,6 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
...
@@ -165,12 +138,6 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
///// parsing
///// parsing
//
//
// Sketch of result types "unparsed labcomm-file"
//
//
public
LinkedList
<
ParsedSymbol
>
symbolify
()
{
public
LinkedList
<
ParsedSymbol
>
symbolify
()
{
...
@@ -206,6 +173,9 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
...
@@ -206,6 +173,9 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
return
sb
.
toString
();
return
sb
.
toString
();
}
}
/* An interface for using Visitor pattern to traverse
* ParsedTypeDefs
*/
public
interface
ParsedSymbolVisitor
{
public
interface
ParsedSymbolVisitor
{
void
visit
(
TypeSymbol
s
);
void
visit
(
TypeSymbol
s
);
void
visit
(
SampleSymbol
s
);
void
visit
(
SampleSymbol
s
);
...
@@ -255,7 +225,6 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
...
@@ -255,7 +225,6 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
}
}
public
abstract
class
ParsedType
extends
ParsedSymbol
{
public
abstract
class
ParsedType
extends
ParsedSymbol
{
//public abstract Type makeNode();
}
}
public
class
SampleRefType
extends
ParsedType
{
public
class
SampleRefType
extends
ParsedType
{
...
@@ -338,7 +307,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
...
@@ -338,7 +307,7 @@ public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
}
}
public
String
toString
()
{
public
String
toString
()
{
if
(
isVoid
())
{
//
HERE BE DRAGONS:
void type is empty struct
if
(
isVoid
())
{
//void type is empty struct
return
"void"
;
return
"void"
;
}
else
{
}
else
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
...
...
This diff is collapsed.
Click to expand it.
lib/java/se/lth/control/labcomm/TypeDefVisitor.java
+
3
−
5
View file @
7d7fd2be
...
@@ -13,10 +13,6 @@ import java.io.EOFException;
...
@@ -13,10 +13,6 @@ import java.io.EOFException;
import
se.lth.control.labcomm.TypeDef
;
import
se.lth.control.labcomm.TypeDef
;
import
se.lth.control.labcomm.TypeDefParser
;
import
se.lth.control.labcomm.TypeDefParser
;
// for BinaryScanner
import
beaver.Scanner
;
import
beaver.Symbol
;
import
se.lth.control.labcomm2014.compiler.LabComm
;
import
se.lth.control.labcomm2014.compiler.LabComm
;
import
se.lth.control.labcomm2014.compiler.LabCommParser
;
import
se.lth.control.labcomm2014.compiler.LabCommParser
;
...
@@ -40,8 +36,10 @@ import se.lth.control.labcomm2014.compiler.Exp;
...
@@ -40,8 +36,10 @@ import se.lth.control.labcomm2014.compiler.Exp;
import
se.lth.control.labcomm2014.compiler.IntegerLiteral
;
import
se.lth.control.labcomm2014.compiler.IntegerLiteral
;
import
se.lth.control.labcomm2014.compiler.VariableSize
;
import
se.lth.control.labcomm2014.compiler.VariableSize
;
////////////
/** A class for building a JastAdd AST from the parsed types
* created by a TypeDefParser. This class depends on the LabComm compiler.
*/
public
class
TypeDefVisitor
implements
TypeDefParser
.
ParsedSymbolVisitor
{
public
class
TypeDefVisitor
implements
TypeDefParser
.
ParsedSymbolVisitor
{
///// tree building
///// tree building
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment