Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
BoringLang
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Emily Rowlands
BoringLang
Commits
045799c5
Verified
Commit
045799c5
authored
6 years ago
by
Emily Rowlands
Browse files
Options
Downloads
Patches
Plain Diff
Added some VALID_NODES consants
parent
6368aeb0
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
src/jrr1g18/boring/nodes/BinaryOperationNode.java
+15
-1
15 additions, 1 deletion
src/jrr1g18/boring/nodes/BinaryOperationNode.java
src/jrr1g18/boring/nodes/statements/EmptyStatementNode.java
+1
-5
1 addition, 5 deletions
src/jrr1g18/boring/nodes/statements/EmptyStatementNode.java
with
16 additions
and
6 deletions
src/jrr1g18/boring/nodes/BinaryOperationNode.java
+
15
−
1
View file @
045799c5
package
jrr1g18.boring.nodes
;
package
jrr1g18.boring.nodes
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
/**
* A class representing a binary operation on the AST.
* A class representing a binary operation on the AST.
*
*
...
@@ -10,6 +14,16 @@ public class BinaryOperationNode extends ASTNode {
...
@@ -10,6 +14,16 @@ public class BinaryOperationNode extends ASTNode {
private
ASTNode
m_lhs
;
private
ASTNode
m_lhs
;
private
ASTNode
m_rhs
;
private
ASTNode
m_rhs
;
private
static
final
List
<
NodeType
>
VALID_NODES
;
static
{
List
<
NodeType
>
nodes
=
new
ArrayList
<>();
nodes
.
add
(
NodeType
.
ADD
);
nodes
.
add
(
NodeType
.
DIV
);
nodes
.
add
(
NodeType
.
MUL
);
nodes
.
add
(
NodeType
.
SUB
);
VALID_NODES
=
Collections
.
unmodifiableList
(
nodes
);
}
/**
/**
* Create a new BinaryOperationNode
* Create a new BinaryOperationNode
*
*
...
@@ -34,6 +48,6 @@ public class BinaryOperationNode extends ASTNode {
...
@@ -34,6 +48,6 @@ public class BinaryOperationNode extends ASTNode {
@Override
@Override
public
boolean
isValidType
(
NodeType
type
)
{
public
boolean
isValidType
(
NodeType
type
)
{
return
VALID_NODES
.
contains
(
type
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/jrr1g18/boring/nodes/statements/EmptyStatementNode.java
+
1
−
5
View file @
045799c5
/**
*
*/
package
jrr1g18.boring.nodes.statements
;
package
jrr1g18.boring.nodes.statements
;
/**
/**
...
@@ -20,7 +17,6 @@ public class EmptyStatementNode extends StatementNode {
...
@@ -20,7 +17,6 @@ public class EmptyStatementNode extends StatementNode {
@Override
@Override
public
boolean
isValidType
(
NodeType
type
)
{
public
boolean
isValidType
(
NodeType
type
)
{
return
type
==
NodeType
.
EMPTY_STATEMENT
;
return
super
.
isValidType
(
type
);
}
}
}
}
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