ucd 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ucd/parser.rb +8 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bded63756cb059b1bf533324437fce70480ef263
|
4
|
+
data.tar.gz: 3d501486676a8d08b794ee646990935dc7b323fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff41f9774f80876e95ffc19b66d2cda5f3048da368c678ba0f8aa6a19404a4b2c12f5938220369faee913a6672a1cdcf38fef1c369c03a700d104463d325c3c
|
7
|
+
data.tar.gz: 2f04d70df43b8f5be60acb6098f44b2b78576d0a8e20a6daac7974fd6daa41afb430d5cadac3e3ee4ec5989749ceaa3ba5eb61c92656b82a59736eb9217ca63f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/ucd/parser.rb
CHANGED
@@ -34,7 +34,10 @@ module UCD
|
|
34
34
|
rule(:whitespace) { (match("\s") | match("\n") | str(";")).repeat(1) }
|
35
35
|
rule(:whitespace?) { whitespace.maybe }
|
36
36
|
|
37
|
-
rule(:name) { match[
|
37
|
+
rule(:name) { match['a-zA-Z0-9_-'].repeat(1) }
|
38
|
+
|
39
|
+
rule(:class_name_chars) { match('(?:[a-zA-Z0-9_-]|\:|\.)').repeat(1) }
|
40
|
+
rule(:class_name) { class_name_chars >> (str("(") >> class_name_chars >> str(")")).maybe }
|
38
41
|
|
39
42
|
# -- Field/Method
|
40
43
|
|
@@ -44,7 +47,7 @@ module UCD
|
|
44
47
|
rule(:member_access) { (kw_access_modifier.as(:access) >> spaces).maybe }
|
45
48
|
|
46
49
|
rule(:method_abstract) { (kw_abstract.as(:abstract) >> spaces).maybe }
|
47
|
-
rule(:member_type) { (spaces >> str(":") >> spaces >>
|
50
|
+
rule(:member_type) { (spaces >> str(":") >> spaces >> class_name.as(:type)).maybe }
|
48
51
|
|
49
52
|
rule(:field_keyword) { kw_field >> spaces }
|
50
53
|
rule(:field_name) { name.as(:name) }
|
@@ -65,7 +68,7 @@ module UCD
|
|
65
68
|
rule(:kw_class_relationship_type) { kw_generalizes | kw_realizes }
|
66
69
|
|
67
70
|
rule(:class_relationship_type) { kw_class_relationship_type.as(:type) >> spaces }
|
68
|
-
rule(:class_relationship_definition) { (class_relationship_type >>
|
71
|
+
rule(:class_relationship_definition) { (class_relationship_type >> class_name.as(:name)).as(:class_relationship) }
|
69
72
|
|
70
73
|
# -- Relationship
|
71
74
|
|
@@ -76,7 +79,7 @@ module UCD
|
|
76
79
|
rule(:relationship_type) { kw_relationship_type.as(:type) >> spaces }
|
77
80
|
rule(:relationship_from) { (spaces >> (name.as(:name) | str("*").repeat(1)).as(:from)).maybe }
|
78
81
|
rule(:relationship_to) { (spaces >> (name.as(:name) | str("*").repeat(1)).as(:to)).maybe }
|
79
|
-
rule(:relationship_definition) { (relationship_directionality >> relationship_type >>
|
82
|
+
rule(:relationship_definition) { (relationship_directionality >> relationship_type >> class_name.as(:name) >> relationship_from >> relationship_to).as(:relationship) }
|
80
83
|
|
81
84
|
# -- Class
|
82
85
|
|
@@ -89,7 +92,7 @@ module UCD
|
|
89
92
|
rule(:class_body) { spaces? >> str("{") >> whitespace? >> class_inner_definition.repeat.as(:members) >> str("}") }
|
90
93
|
rule(:class_body?) { class_body.maybe }
|
91
94
|
|
92
|
-
rule(:class_definition) { class_modifier >> class_keyword >>
|
95
|
+
rule(:class_definition) { class_modifier >> class_keyword >> class_name.as(:name) >> class_body? }
|
93
96
|
|
94
97
|
# -- Document
|
95
98
|
|