File tree 3 files changed +23
-21
lines changed
3 files changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,12 @@ def _check_return_stat(self, statement):
60
60
self ._value_analyzer ().validate (statement .value )
61
61
62
62
def _check_fun_call (self , statement ):
63
- if statement .fun .undef :
64
- self ._error ().signature_not_found (statement .name , statement .args )
65
-
66
63
for arg in statement .args :
67
64
self ._value_analyzer ().validate (arg )
68
65
66
+ if statement .fun .undef :
67
+ self ._error ().signature_not_found (statement .name , statement .args )
68
+
69
69
def _check_if_stat (self , statement ):
70
70
self ._value_analyzer ().validate (statement .condition )
71
71
self .validate (statement .then )
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ value: cast value
56
56
| ' (' value ' )' # parenthesizedValue
57
57
| target=value ' [' index=value ' ]' # indexValue
58
58
| ' not' value # notValue
59
+ | left=value operation=(' /' | ' *' ) right=value # divMultValue
60
+ | left=value operation=(' +' | ' -' ) right=value # sumSubtrValue
59
61
| left=value operation=' and' right=value # andValue
60
62
| left=value operation=' or' right=value # orValue
61
63
| left=value operation=(' ==' | ' !=' | ' >=' | ' <=' | ' >' | ' <' ) right=value # comparisonValue
62
- | left=value operation=(' /' | ' *' ) right=value # divMultValue
63
- | left=value operation=(' +' | ' -' ) right=value # sumSubtrValue
64
64
| ' ^' value # nodeValue
65
65
| source=value arc target=value # arcValue
66
66
| ' [' graphPart? ' ]' # graphValue
Original file line number Diff line number Diff line change 1
- graph g = [
2
- ^1 -> ^2,
3
- ^2 -> ^3,
4
- ^1 -> ^5,
5
- ^3 -> ^6,
6
- ^0 -> ^-3
7
- ]
8
-
9
- node biggest_node(graph g) go
10
- node maxx = ^-9999
11
-
12
- for node n in nodes(g) go
13
- if n > maxx go
14
- maxx = n
1
+ arc max_arc(graph g) go
2
+ num max_weight = -999999
3
+ arc max_arc
4
+ for arc a in arcs(g) go
5
+ if (num) source(a) + (num) target(a) > max_weight go
6
+ max_arc = a
7
+ max_weight = (num) source(a) + (num) target(a)
15
8
end
16
9
end
17
10
18
- return maxx
11
+ return max_arc
19
12
end
20
13
21
- puts(biggest_node(a))
14
+ graph g = [
15
+ ^1 -> ^2,
16
+ ^2 -> ^4,
17
+ ^3 -> ^6,
18
+ ^3 -> ^4,
19
+ ^1 -> ^3,
20
+ ^7 -> ^1
21
+ ]
22
+
23
+ puts(max_arc(g))
You can’t perform that action at this time.
0 commit comments