Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pascal-compiler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
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
Lior Spach
pascal-compiler
Commits
11afea5d
Commit
11afea5d
authored
9 years ago
by
Lior Spach
Browse files
Options
Downloads
Patches
Plain Diff
Arrumado atribuição
parent
4ed96d8b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/other/Parser.scala
+17
-1
17 additions, 1 deletion
src/main/scala/other/Parser.scala
with
17 additions
and
1 deletion
src/main/scala/other/Parser.scala
+
17
−
1
View file @
11afea5d
...
...
@@ -99,7 +99,22 @@ class Arith extends JavaTokenParsers {
def
verificaTipoAtrib
(
idAtrib
:
String
)
{
val
e
=
TabelaSimb
.
getById
(
idAtrib
).
get
val
tipoExpr
=
stackbooltipo
.
pop
()
val
boolDistinct
=
stackbooltipo
.
distinct
if
(
boolDistinct
.
size
!=
1
&&
!(
boolDistinct
.
size
==
2
&&
boolDistinct
.
contains
(
"integer"
))
)
{
println
(
"Erro de tipagem na expressão da atribuição"
)
sys
.
exit
(
1
)
}
val
tipoExpr
=
boolDistinct
.
size
match
{
case
1
=>
boolDistinct
.
pop
()
case
2
=>
boolDistinct
.
top
match
{
case
"integer"
=>
boolDistinct
.
pop
();
boolDistinct
.
pop
()
case
_
=>
boolDistinct
.
pop
()
}
}
boolDistinct
.
clear
()
val
tipoAtrib
=
e
match
{
case
v
:
Var
=>
v
.
tipo
case
p
:
Param
=>
p
.
tipo
...
...
@@ -175,6 +190,7 @@ class Arith extends JavaTokenParsers {
if
(
distinct
.
size
==
1
||
(
distinct
.
size
==
2
&&
distinct
.
contains
(
"integer"
))
)
{
//fine
stackbooltipo
.
clear
()
}
else
{
println
(
"Erro de tipo: dois lados da expressão booleana com tipos diferentes"
)
...
...
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