Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs444
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Yang
cs444
Commits
cb1b222a
Commit
cb1b222a
authored
5 years ago
by
pycsham
Browse files
Options
Downloads
Patches
Plain Diff
fixed test file and added a check for constructor name against class name
parent
b5da1cb6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Test.py
+4
-4
4 additions, 4 deletions
Test.py
TypeNodes.py
+10
-4
10 additions, 4 deletions
TypeNodes.py
with
14 additions
and
8 deletions
Test.py
+
4
−
4
View file @
cb1b222a
...
...
@@ -94,8 +94,8 @@ def run(testFiles):
print
(
f
)
print
(
"
ERROR in Scanning:
"
+
error
)
print
(
"
**********************************************************
"
)
continue
return
"
ERROR in scanning
"
# s = "All Tokens: "
# for token in tokens:
# if (token.name and token.lex):
...
...
@@ -110,7 +110,7 @@ def run(testFiles):
print
(
"
ERROR in Weeding after Scanning:
"
)
print
(
weeds
)
print
(
"
**********************************************************
"
)
continue
return
"
ERROR in weeding
"
# Parsing
tree
=
None
...
...
@@ -127,7 +127,7 @@ def run(testFiles):
# for n in error.args[1]: # the parse tree
# print(n)
print
(
"
**********************************************************
"
)
continue
return
"
ERROR in parsing
"
parseTrees
.
append
((
f
,
tree
))
...
...
This diff is collapsed.
Click to expand it.
TypeNodes.py
+
10
−
4
View file @
cb1b222a
...
...
@@ -251,10 +251,16 @@ class ClassNode(ClassInterNode):
# overlapping class/interface logic
super
().
checkHierarchy
()
def
getConstructor
(
self
,
argTypes
):
for
c
in
self
.
constructors
:
if
c
.
paramTypes
==
argTypes
:
return
c
def
checkType
(
self
):
super
().
checkType
()
# Checking if constructor's name is the same as class name
for
constructor
in
self
.
constructors
:
if
not
self
.
name
==
constructor
.
name
:
raise
Exception
(
"
ERROR: Constructor {0} doesn
'
t have the same name as class {1}
"
.
format
(
constructor
.
name
,
self
.
name
))
return
#####################################################################
# interface
...
...
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