tla2dot 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -19
- data/lib/tla2dot/parser.tab.rb +182 -117
- data/lib/tla2dot/parser.y +27 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f80765c73e0fc6c509bb821af1e2424e0a9b8eb6
|
4
|
+
data.tar.gz: e740a7b2d7ebb1dde475f58166d7916ef6498d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d5f77428dae12807d0a005c6baac6e4c46d66ec4d48f5509a20d1a2768fa2f7637ca91bf54cf4b03c07ddb9d6ffdb409f5ec8c8ab3830bce781b3ca3ce9f05d
|
7
|
+
data.tar.gz: f4ca627377c9dda54e69f32c3e8a4486b501f0bf417451386394abeddd19762eff19722b94584b2061ef0f5558248114fda4bc8caf6683690e529a0a8e84d6ce
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[Up](../index.php) [Readme](README.html) [Releases](RELEASES.html) [Todo](TODO.html)
|
3
3
|
|
4
4
|
|
5
|
-
# tladot - Utility to convert tlc/tlaplus state space to graphviz - $Release:0.0.
|
5
|
+
# tladot - Utility to convert tlc/tlaplus state space to graphviz - $Release:0.0.6$
|
6
6
|
|
7
7
|
A utility to convert state space dump created by
|
8
8
|
[patched](https://github.com/jarjuk/tla2dot/blob/master/tla2dot.patch)
|
@@ -14,28 +14,36 @@ to [graphviz](http://www.graphviz.org) dot format.
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
+
|
17
18
|
## Obtain the patched TLC version
|
18
19
|
|
19
20
|
Clone github model
|
20
21
|
|
21
22
|
|
22
|
-
https://github.com/jarjuk/tla2dot
|
23
|
+
git clone https://github.com/jarjuk/tla2dot
|
23
24
|
|
24
25
|
and change the working directory
|
25
26
|
|
26
|
-
|
27
|
+
cd tla2dot
|
28
|
+
|
29
|
+
### Run Ruby bundler
|
30
|
+
|
31
|
+
The tool uses Ruby 2, and to have the required Gems installed run
|
32
|
+
|
33
|
+
bundle install
|
34
|
+
|
27
35
|
|
28
36
|
### Running the patced TLC version to create state dump
|
29
37
|
|
30
|
-
|
31
|
-
`DieHard.cfg
|
38
|
+
The example below uses TLA model in files `DieHard.tla`, and
|
39
|
+
`DieHard.cfg` under directory `model`.
|
32
40
|
|
33
|
-
Set up environment variable CP to poinnt the patched
|
34
|
-
in directory `java`
|
41
|
+
Set up an environment variable `CP` to poinnt the patched
|
42
|
+
`tla2tools.jar` found in directory `java`
|
35
43
|
|
36
44
|
export CP=$(pwd)/java/org.lamport.tlatools-1.0.1-SNAPSHOT.jar
|
37
45
|
|
38
|
-
Run
|
46
|
+
Run TLA model, and generate a dump file
|
39
47
|
`../examples/DieHard-patched.dump` using the command
|
40
48
|
|
41
49
|
(cd model; java -cp $CP tlc2.TLC -dump ../examples/DieHard-patched.dump DieHard)
|
@@ -49,7 +57,7 @@ file. For example, to show the difference of
|
|
49
57
|
|
50
58
|
diff examples/DieHard-orig.dump examples/DieHard-patched.dump
|
51
59
|
|
52
|
-
and observe diff starting
|
60
|
+
and observe diff output starting
|
53
61
|
|
54
62
|
```
|
55
63
|
1c1
|
@@ -81,36 +89,41 @@ and observe diff starting
|
|
81
89
|
To create a dot file for a patched state-dump in
|
82
90
|
`examples/customer1-patched.dump`, run
|
83
91
|
|
84
|
-
bin/tla2dot.rb graph examples/DieHard-patched.dump
|
92
|
+
bin/tla2dot.rb graph examples/DieHard-patched.dump >tmp/dump.dot
|
85
93
|
|
86
|
-
and to convert it to a svg
|
94
|
+
and to convert it to a svg picture, run
|
87
95
|
|
88
96
|
dot -T svg tmp/dump.dot >tmp/dump.svg
|
89
97
|
|
90
|
-
Command `graph` accepts optionally a list of variables to
|
91
|
-
state nodes. For example, to show variables `big,small` in the
|
92
|
-
use the command
|
98
|
+
Command `graph` accepts optionally a list of variables to show in
|
99
|
+
state nodes. For example, to show model variables `big,small` in the
|
100
|
+
DieHard example, use the command
|
93
101
|
|
94
|
-
bin/tla2dot.rb graph examples/DieHard-patched.dump big,small
|
102
|
+
bin/tla2dot.rb graph examples/DieHard-patched.dump big,small >tmp/dump.dot
|
95
103
|
|
96
|
-
State identity
|
104
|
+
State identity may be included a pseudo variable `ID`:
|
97
105
|
|
98
106
|
bin/tla2dot.rb graph examples/DieHard-patched.dump ID,big,small >tmp/dump.dot
|
99
107
|
|
100
108
|
and all variables can be included in the graph using value `TRUE` for
|
101
|
-
variable list
|
109
|
+
the variable list
|
102
110
|
|
103
111
|
bin/tla2dot.rb graph examples/DieHard-patched.dump TRUE >tmp/dump.dot
|
104
112
|
|
105
113
|
|
106
114
|
## <a id="INSTALLATION">Installation</a>
|
107
115
|
|
108
|
-
Add following lines to `Gemfile`
|
116
|
+
Add following the lines to `Gemfile`
|
109
117
|
|
110
118
|
source 'https://rubygems.org'
|
111
119
|
gem 'tla2dot'
|
112
120
|
|
113
|
-
and
|
121
|
+
and run
|
122
|
+
|
123
|
+
bundle install
|
124
|
+
|
125
|
+
To validate that installation was successful, and to get help on using
|
126
|
+
`tla2dot.rb` run
|
114
127
|
|
115
128
|
bundle exec tla2dot.rb help
|
116
129
|
|
data/lib/tla2dot/parser.tab.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
require 'racc/parser.rb'
|
8
8
|
class Tla2DotParser < Racc::Parser
|
9
9
|
|
10
|
-
module_eval(<<'...end parser.y/module_eval...', 'parser.y',
|
10
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 101)
|
11
11
|
|
12
12
|
class Node
|
13
13
|
|
@@ -310,6 +310,20 @@ def scan
|
|
310
310
|
when /\A=/
|
311
311
|
yield [ $&, $& ]
|
312
312
|
str = $'
|
313
|
+
when /\A\(/
|
314
|
+
yield [ $&, $& ]
|
315
|
+
str = $'
|
316
|
+
when /\A\)/
|
317
|
+
# puts $'
|
318
|
+
yield [ $&, $& ]
|
319
|
+
str = $'
|
320
|
+
when /\A:>/
|
321
|
+
yield [ $&, $& ]
|
322
|
+
str = $'
|
323
|
+
when /@@/
|
324
|
+
# puts $'
|
325
|
+
yield [ $&, $& ]
|
326
|
+
str = $'
|
313
327
|
else
|
314
328
|
c = str[0,1]
|
315
329
|
yield [ c, c ]
|
@@ -324,113 +338,125 @@ end
|
|
324
338
|
##### State transition tables begin ###
|
325
339
|
|
326
340
|
racc_action_table = [
|
327
|
-
32,
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
40,
|
341
|
+
32, 67, 41, 50, 34, 59, 60, 47, 33, 39,
|
342
|
+
32, 40, 41, 66, 34, 22, 42, 52, 33, 39,
|
343
|
+
32, 40, 41, 73, 34, 74, 42, 22, 33, 39,
|
344
|
+
32, 40, 41, 43, 34, 19, 42, 58, 33, 39,
|
345
|
+
32, 40, 41, 28, 34, 61, 42, 18, 33, 39,
|
346
|
+
32, 40, 41, 62, 34, 17, 42, 15, 33, 39,
|
347
|
+
32, 40, 41, 15, 34, 50, 42, 57, 33, 39,
|
348
|
+
27, 40, 56, 12, 25, 26, 42, 27, 72, 22,
|
349
|
+
29, 25, 26, 6, 6, 10, 9, 9, 76, 51 ]
|
335
350
|
|
336
351
|
racc_action_check = [
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
28,
|
344
|
-
28,
|
352
|
+
42, 53, 42, 40, 42, 48, 48, 40, 42, 42,
|
353
|
+
61, 42, 61, 53, 61, 57, 42, 42, 61, 61,
|
354
|
+
74, 61, 74, 63, 74, 63, 61, 39, 74, 74,
|
355
|
+
67, 74, 67, 39, 67, 12, 74, 46, 67, 67,
|
356
|
+
58, 67, 58, 21, 58, 50, 67, 10, 58, 58,
|
357
|
+
51, 58, 51, 51, 51, 8, 58, 13, 51, 51,
|
358
|
+
28, 51, 28, 7, 28, 60, 51, 44, 28, 28,
|
359
|
+
17, 28, 44, 6, 17, 17, 28, 23, 62, 15,
|
360
|
+
23, 23, 23, 2, 0, 1, 2, 0, 73, 41 ]
|
345
361
|
|
346
362
|
racc_action_pointer = [
|
347
|
-
|
348
|
-
|
349
|
-
nil,
|
350
|
-
nil, nil, nil, nil, nil, nil, nil, nil,
|
351
|
-
-
|
352
|
-
|
353
|
-
nil, nil,
|
363
|
+
82, 85, 81, nil, nil, nil, 70, 53, 49, nil,
|
364
|
+
47, nil, 31, 47, nil, 71, nil, 66, nil, nil,
|
365
|
+
nil, 32, nil, 73, nil, nil, nil, nil, 56, nil,
|
366
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 19,
|
367
|
+
-9, 83, -4, nil, 58, nil, 18, nil, -11, nil,
|
368
|
+
27, 46, nil, -8, nil, nil, nil, 7, 36, nil,
|
369
|
+
53, 6, 71, 16, nil, nil, nil, 26, nil, nil,
|
370
|
+
nil, nil, nil, 81, 16, nil, nil, nil ]
|
354
371
|
|
355
372
|
racc_action_default = [
|
356
|
-
-
|
357
|
-
-
|
358
|
-
-19, -
|
359
|
-
-14, -20, -22, -23, -24, -25, -26, -27, -
|
360
|
-
-
|
361
|
-
-
|
362
|
-
-
|
373
|
+
-49, -49, -1, -2, -4, -5, -49, -8, -9, -11,
|
374
|
+
-49, -3, -49, -7, -18, -49, -10, -49, 78, -6,
|
375
|
+
-19, -49, -21, -49, -13, -15, -16, -17, -49, -12,
|
376
|
+
-14, -20, -22, -23, -24, -25, -26, -27, -28, -49,
|
377
|
+
-49, -49, -49, -29, -49, -36, -49, -31, -49, -33,
|
378
|
+
-49, -49, -44, -49, -46, -48, -30, -49, -49, -32,
|
379
|
+
-49, -49, -49, -49, -41, -43, -45, -49, -37, -38,
|
380
|
+
-34, -35, -39, -49, -49, -47, -40, -42 ]
|
363
381
|
|
364
382
|
racc_goto_table = [
|
365
|
-
31,
|
366
|
-
30, 20,
|
367
|
-
|
368
|
-
nil, nil, nil, nil, nil,
|
383
|
+
31, 54, 64, 45, 49, 24, 14, 3, 44, 11,
|
384
|
+
2, 30, 20, 21, 48, 23, 16, 63, 13, 53,
|
385
|
+
1, 68, nil, 65, 70, 77, 75, nil, nil, nil,
|
386
|
+
69, nil, nil, 71, nil, nil, nil, nil, nil, nil,
|
387
|
+
nil, nil, nil, nil, nil, nil, 65 ]
|
369
388
|
|
370
389
|
racc_goto_check = [
|
371
|
-
14,
|
372
|
-
11, 12,
|
373
|
-
|
374
|
-
nil, nil, nil, nil, nil,
|
390
|
+
14, 26, 24, 22, 21, 11, 12, 3, 19, 3,
|
391
|
+
2, 11, 12, 13, 20, 10, 9, 23, 7, 25,
|
392
|
+
1, 22, nil, 14, 21, 24, 26, nil, nil, nil,
|
393
|
+
14, nil, nil, 14, nil, nil, nil, nil, nil, nil,
|
394
|
+
nil, nil, nil, nil, nil, nil, 14 ]
|
375
395
|
|
376
396
|
racc_goto_pointer = [
|
377
|
-
nil,
|
378
|
-
-
|
379
|
-
-
|
397
|
+
nil, 20, 10, 7, nil, nil, nil, 11, nil, 8,
|
398
|
+
-2, -12, -1, -2, -28, nil, nil, nil, nil, -31,
|
399
|
+
-26, -36, -36, -34, -49, -23, -41 ]
|
380
400
|
|
381
401
|
racc_goto_default = [
|
382
402
|
nil, nil, nil, nil, 4, 5, 7, nil, 8, nil,
|
383
|
-
nil, nil, nil,
|
384
|
-
nil, nil, nil, nil ]
|
403
|
+
nil, nil, nil, 46, 55, 35, 36, 37, 38, nil,
|
404
|
+
nil, nil, nil, nil, nil, nil, nil ]
|
385
405
|
|
386
406
|
racc_reduce_table = [
|
387
407
|
0, 0, :racc_error,
|
388
|
-
1,
|
389
|
-
1, 20, :_reduce_none,
|
390
|
-
2, 20, :_reduce_none,
|
391
|
-
1, 21, :_reduce_4,
|
392
|
-
1, 21, :_reduce_none,
|
393
|
-
3, 23, :_reduce_6,
|
394
|
-
2, 22, :_reduce_7,
|
395
|
-
1, 22, :_reduce_none,
|
408
|
+
1, 23, :_reduce_1,
|
396
409
|
1, 24, :_reduce_none,
|
397
410
|
2, 24, :_reduce_none,
|
398
|
-
1,
|
399
|
-
|
411
|
+
1, 25, :_reduce_4,
|
412
|
+
1, 25, :_reduce_none,
|
413
|
+
3, 27, :_reduce_6,
|
414
|
+
2, 26, :_reduce_7,
|
415
|
+
1, 26, :_reduce_none,
|
400
416
|
1, 28, :_reduce_none,
|
401
417
|
2, 28, :_reduce_none,
|
402
|
-
1,
|
403
|
-
|
404
|
-
1, 29, :_reduce_none,
|
405
|
-
1, 25, :_reduce_none,
|
406
|
-
2, 25, :_reduce_19,
|
407
|
-
4, 30, :_reduce_20,
|
408
|
-
1, 31, :_reduce_none,
|
409
|
-
1, 32, :_reduce_22,
|
410
|
-
1, 32, :_reduce_none,
|
411
|
-
1, 32, :_reduce_none,
|
412
|
-
1, 32, :_reduce_none,
|
418
|
+
1, 30, :_reduce_11,
|
419
|
+
3, 31, :_reduce_none,
|
413
420
|
1, 32, :_reduce_none,
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
1,
|
418
|
-
|
419
|
-
|
420
|
-
4,
|
421
|
-
|
422
|
-
1,
|
423
|
-
|
424
|
-
1,
|
425
|
-
|
426
|
-
|
427
|
-
1,
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
421
|
+
2, 32, :_reduce_none,
|
422
|
+
1, 33, :_reduce_none,
|
423
|
+
1, 33, :_reduce_none,
|
424
|
+
1, 33, :_reduce_none,
|
425
|
+
1, 29, :_reduce_none,
|
426
|
+
2, 29, :_reduce_19,
|
427
|
+
4, 34, :_reduce_20,
|
428
|
+
1, 35, :_reduce_none,
|
429
|
+
1, 36, :_reduce_22,
|
430
|
+
1, 36, :_reduce_none,
|
431
|
+
1, 36, :_reduce_none,
|
432
|
+
1, 36, :_reduce_none,
|
433
|
+
1, 36, :_reduce_none,
|
434
|
+
1, 36, :_reduce_none,
|
435
|
+
1, 36, :_reduce_none,
|
436
|
+
2, 37, :_reduce_29,
|
437
|
+
3, 37, :_reduce_30,
|
438
|
+
2, 40, :_reduce_31,
|
439
|
+
3, 40, :_reduce_32,
|
440
|
+
1, 42, :_reduce_none,
|
441
|
+
3, 42, :_reduce_34,
|
442
|
+
3, 43, :_reduce_35,
|
443
|
+
1, 41, :_reduce_36,
|
444
|
+
3, 41, :_reduce_37,
|
445
|
+
3, 44, :_reduce_38,
|
446
|
+
4, 39, :_reduce_39,
|
447
|
+
5, 39, :_reduce_40,
|
448
|
+
1, 45, :_reduce_none,
|
449
|
+
3, 45, :_reduce_42,
|
450
|
+
1, 46, :_reduce_43,
|
451
|
+
2, 38, :_reduce_44,
|
452
|
+
3, 38, :_reduce_45,
|
453
|
+
1, 47, :_reduce_none,
|
454
|
+
3, 47, :_reduce_47,
|
455
|
+
1, 48, :_reduce_48 ]
|
456
|
+
|
457
|
+
racc_reduce_n = 49
|
458
|
+
|
459
|
+
racc_shift_n = 78
|
434
460
|
|
435
461
|
racc_token_table = {
|
436
462
|
false => 0,
|
@@ -448,11 +474,15 @@ racc_token_table = {
|
|
448
474
|
:STRING => 12,
|
449
475
|
"[" => 13,
|
450
476
|
"]" => 14,
|
451
|
-
"
|
452
|
-
"
|
453
|
-
"
|
477
|
+
"(" => 15,
|
478
|
+
")" => 16,
|
479
|
+
"@@" => 17,
|
480
|
+
":>" => 18,
|
481
|
+
"|->" => 19,
|
482
|
+
"{" => 20,
|
483
|
+
"}" => 21 }
|
454
484
|
|
455
|
-
racc_nt_base =
|
485
|
+
racc_nt_base = 22
|
456
486
|
|
457
487
|
racc_use_result_var = false
|
458
488
|
|
@@ -488,6 +518,10 @@ Racc_token_to_s_table = [
|
|
488
518
|
"STRING",
|
489
519
|
"\"[\"",
|
490
520
|
"\"]\"",
|
521
|
+
"\"(\"",
|
522
|
+
"\")\"",
|
523
|
+
"\"@@\"",
|
524
|
+
"\":>\"",
|
491
525
|
"\"|->\"",
|
492
526
|
"\"{\"",
|
493
527
|
"\"}\"",
|
@@ -509,7 +543,10 @@ Racc_token_to_s_table = [
|
|
509
543
|
"record",
|
510
544
|
"set",
|
511
545
|
"seq",
|
546
|
+
"func",
|
512
547
|
"rlist",
|
548
|
+
"flist",
|
549
|
+
"fitem",
|
513
550
|
"ritem",
|
514
551
|
"seqlist",
|
515
552
|
"seqitem",
|
@@ -608,84 +645,112 @@ module_eval(<<'.,.,', 'parser.y', 52)
|
|
608
645
|
|
609
646
|
# reduce 27 omitted
|
610
647
|
|
611
|
-
|
612
|
-
def _reduce_28(val, _values)
|
613
|
-
{}
|
614
|
-
end
|
615
|
-
.,.,
|
648
|
+
# reduce 28 omitted
|
616
649
|
|
617
650
|
module_eval(<<'.,.,', 'parser.y', 60)
|
618
651
|
def _reduce_29(val, _values)
|
619
|
-
|
652
|
+
{}
|
620
653
|
end
|
621
654
|
.,.,
|
622
655
|
|
623
|
-
module_eval(<<'.,.,', 'parser.y',
|
656
|
+
module_eval(<<'.,.,', 'parser.y', 61)
|
624
657
|
def _reduce_30(val, _values)
|
625
|
-
val[
|
658
|
+
val[1]
|
626
659
|
end
|
627
660
|
.,.,
|
628
661
|
|
629
662
|
module_eval(<<'.,.,', 'parser.y', 63)
|
630
663
|
def _reduce_31(val, _values)
|
631
|
-
|
664
|
+
{}
|
632
665
|
end
|
633
666
|
.,.,
|
634
667
|
|
635
|
-
module_eval(<<'.,.,', 'parser.y',
|
668
|
+
module_eval(<<'.,.,', 'parser.y', 64)
|
636
669
|
def _reduce_32(val, _values)
|
637
|
-
|
670
|
+
val[1]
|
638
671
|
end
|
639
672
|
.,.,
|
640
673
|
|
674
|
+
# reduce 33 omitted
|
675
|
+
|
641
676
|
module_eval(<<'.,.,', 'parser.y', 68)
|
642
|
-
def
|
677
|
+
def _reduce_34(val, _values)
|
678
|
+
h = val[0].merge(val[2]); h
|
679
|
+
end
|
680
|
+
.,.,
|
681
|
+
|
682
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
683
|
+
def _reduce_35(val, _values)
|
684
|
+
{ val[0] => val[2] }
|
685
|
+
end
|
686
|
+
.,.,
|
687
|
+
|
688
|
+
module_eval(<<'.,.,', 'parser.y', 73)
|
689
|
+
def _reduce_36(val, _values)
|
690
|
+
val[0]
|
691
|
+
end
|
692
|
+
.,.,
|
693
|
+
|
694
|
+
module_eval(<<'.,.,', 'parser.y', 74)
|
695
|
+
def _reduce_37(val, _values)
|
696
|
+
k=val[2].keys.first; val[0][k] = val[2][k]; val[0]
|
697
|
+
end
|
698
|
+
.,.,
|
699
|
+
|
700
|
+
module_eval(<<'.,.,', 'parser.y', 76)
|
701
|
+
def _reduce_38(val, _values)
|
702
|
+
{ val[0] => val[2] }
|
703
|
+
end
|
704
|
+
.,.,
|
705
|
+
|
706
|
+
module_eval(<<'.,.,', 'parser.y', 79)
|
707
|
+
def _reduce_39(val, _values)
|
643
708
|
[]
|
644
709
|
end
|
645
710
|
.,.,
|
646
711
|
|
647
|
-
module_eval(<<'.,.,', 'parser.y',
|
648
|
-
def
|
712
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
713
|
+
def _reduce_40(val, _values)
|
649
714
|
val[2]
|
650
715
|
end
|
651
716
|
.,.,
|
652
717
|
|
653
|
-
# reduce
|
718
|
+
# reduce 41 omitted
|
654
719
|
|
655
|
-
module_eval(<<'.,.,', 'parser.y',
|
656
|
-
def
|
720
|
+
module_eval(<<'.,.,', 'parser.y', 84)
|
721
|
+
def _reduce_42(val, _values)
|
657
722
|
val[0].push( val[2][0] ); val[0]
|
658
723
|
end
|
659
724
|
.,.,
|
660
725
|
|
661
|
-
module_eval(<<'.,.,', 'parser.y',
|
662
|
-
def
|
726
|
+
module_eval(<<'.,.,', 'parser.y', 86)
|
727
|
+
def _reduce_43(val, _values)
|
663
728
|
[ val[0] ]
|
664
729
|
end
|
665
730
|
.,.,
|
666
731
|
|
667
|
-
module_eval(<<'.,.,', 'parser.y',
|
668
|
-
def
|
732
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
733
|
+
def _reduce_44(val, _values)
|
669
734
|
[]
|
670
735
|
end
|
671
736
|
.,.,
|
672
737
|
|
673
|
-
module_eval(<<'.,.,', 'parser.y',
|
674
|
-
def
|
738
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
739
|
+
def _reduce_45(val, _values)
|
675
740
|
val[1]
|
676
741
|
end
|
677
742
|
.,.,
|
678
743
|
|
679
|
-
# reduce
|
744
|
+
# reduce 46 omitted
|
680
745
|
|
681
|
-
module_eval(<<'.,.,', 'parser.y',
|
682
|
-
def
|
746
|
+
module_eval(<<'.,.,', 'parser.y', 93)
|
747
|
+
def _reduce_47(val, _values)
|
683
748
|
val[0].push( val[2][0] ); val[0]
|
684
749
|
end
|
685
750
|
.,.,
|
686
751
|
|
687
|
-
module_eval(<<'.,.,', 'parser.y',
|
688
|
-
def
|
752
|
+
module_eval(<<'.,.,', 'parser.y', 95)
|
753
|
+
def _reduce_48(val, _values)
|
689
754
|
[ val[0] ]
|
690
755
|
end
|
691
756
|
.,.,
|
data/lib/tla2dot/parser.y
CHANGED
@@ -56,10 +56,21 @@ rule
|
|
56
56
|
| record
|
57
57
|
| set
|
58
58
|
| seq
|
59
|
+
| func
|
59
60
|
|
60
61
|
record : '[' ']' { {} }
|
61
62
|
| '[' rlist ']' { val[1] }
|
62
63
|
|
64
|
+
func : '(' ')' { {} }
|
65
|
+
| '(' flist ')' { val[1] }
|
66
|
+
|
67
|
+
|
68
|
+
flist : fitem
|
69
|
+
| flist "@@" fitem { h = val[0].merge(val[2]); h }
|
70
|
+
|
71
|
+
|
72
|
+
fitem : STRING ":>" value { { val[0] => val[2] } }
|
73
|
+
|
63
74
|
rlist : ritem { val[0] }
|
64
75
|
| rlist ',' ritem { k=val[2].keys.first; val[0][k] = val[2][k]; val[0] }
|
65
76
|
|
@@ -69,7 +80,8 @@ rule
|
|
69
80
|
seq : '<' '<' '>' '>' { [] }
|
70
81
|
| '<' '<' seqlist '>' '>' { val[2] }
|
71
82
|
|
72
|
-
|
83
|
+
|
84
|
+
seqlist : seqitem
|
73
85
|
| seqlist ',' seqitem { val[0].push( val[2][0] ); val[0] }
|
74
86
|
|
75
87
|
seqitem : value { [ val[0] ] }
|
@@ -388,6 +400,20 @@ def scan
|
|
388
400
|
when /\A=/
|
389
401
|
yield [ $&, $& ]
|
390
402
|
str = $'
|
403
|
+
when /\A\(/
|
404
|
+
yield [ $&, $& ]
|
405
|
+
str = $'
|
406
|
+
when /\A\)/
|
407
|
+
# puts $'
|
408
|
+
yield [ $&, $& ]
|
409
|
+
str = $'
|
410
|
+
when /\A:>/
|
411
|
+
yield [ $&, $& ]
|
412
|
+
str = $'
|
413
|
+
when /@@/
|
414
|
+
# puts $'
|
415
|
+
yield [ $&, $& ]
|
416
|
+
str = $'
|
391
417
|
else
|
392
418
|
c = str[0,1]
|
393
419
|
yield [ c, c ]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tla2dot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jarjuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mustache
|