cqm-parsers 4.0.0.0 → 4.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d42976fc653ecb9c5a69de2d4ff1cb23a56880bbfc45f53cc7f159f45e7929a4
4
- data.tar.gz: 4d66c6e37db1a5a4ad9ea4134eda9388817092031ebe0aa7cec9e1c1b69057ac
3
+ metadata.gz: 9b9cd766586a10d7e7c93a71a4e17917306b877da4cba464d080c0d2e734007e
4
+ data.tar.gz: 4b8c2f211f8778d0d076403961946875c4c30808fcff24defca36250b3562477
5
5
  SHA512:
6
- metadata.gz: 33eca35212fcfc098812f2959c1390771bc2fb8453161b1b243cca5c59fdb30398a74ca01e285d4799d5978704012cedf581a3e22e62c226f8881804fac66d75
7
- data.tar.gz: efcfb1116851ac81d5ec7659821f5f4547e8c93ab9e41e28bf8f9895e99bfd3be2e3a00f93cea238776bd3192b94cca6cbe5d759cbed74e52fbe23adfa81b062
6
+ metadata.gz: 7b9649c92450d6aa774ab727d9b68a3ff17ca83ffa856f0d0f8e7c24a5cc3ebb0eeaf7eb7b7327ff4d231fd8da03794d5a8be0e4040de86f8ff81c67bedb5abf
7
+ data.tar.gz: 69751632831b6114194b428c2514ff04cc4129d0878adaa6a4a0a3411d62c90c7053909d821929d5c153b82e5287b27d6581bb6c65031770c973a5134217d0a3
@@ -12,14 +12,17 @@ module Measures
12
12
  # extract library identifier data
13
13
  ret[:identifier][:id] = doc.css("identifier").attr("id").value
14
14
  ret[:identifier][:version] = doc.css("identifier").attr("version").value
15
-
16
- # extracts the fields of type "annotation" and their children.
17
- annotations = doc.css("annotation")
18
- annotations.each do |node|
19
- node, define_name = parse_node(node, localid_to_type_map)
20
- unless define_name.nil?
21
- node[:define_name] = define_name
22
- ret[:statements] << node
15
+ # all the define statements including functions
16
+ definitions = doc.css("statements def")
17
+ definitions&.each do |definition|
18
+ annotation = definition.at("annotation")
19
+ if annotation
20
+ node = parse_node(annotation, localid_to_type_map)
21
+ define_name = definition.attr("name")
22
+ unless define_name.nil?
23
+ node[:define_name] = define_name
24
+ ret[:statements] << node
25
+ end
23
26
  end
24
27
  end
25
28
  ret
@@ -31,7 +34,6 @@ module Measures
31
34
  ret = {
32
35
  children: []
33
36
  }
34
- define_name = nil
35
37
  node.children.each do |child|
36
38
  if child.is_a?(Nokogiri::XML::Text) # leaf node
37
39
  clause_text = child.content.gsub(/\t/, " ")
@@ -40,19 +42,17 @@ module Measures
40
42
  }
41
43
  clause[:ref_id] = child['r'] unless child['r'].nil?
42
44
  ret[:children] << clause
43
- define_name = clause_text.split("\"")[1] if clause_text.strip.starts_with?("define")
44
45
  else
45
46
  node_type = localid_to_type_map[child['r']] unless child['r'].nil?
46
47
  # Parses the current child recursively. child_define_name will bubble up to indicate which
47
48
  # statement is currently being traversed.
48
- node, child_define_name = parse_node(child, localid_to_type_map)
49
+ node = parse_node(child, localid_to_type_map)
49
50
  node[:node_type] = node_type unless node_type.nil?
50
51
  node[:ref_id] = child['r'] unless child['r'].nil?
51
52
  ret[:children] << node
52
- define_name = child_define_name unless child_define_name.nil?
53
53
  end
54
54
  end
55
- return ret, define_name
55
+ return ret
56
56
  end
57
57
 
58
58
  def self.generate_localid_to_type_map(doc)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-parsers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.0
4
+ version: 4.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-19 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: 1.8.5
132
132
  - - "<"
133
133
  - !ruby/object:Gem::Version
134
- version: 1.13.0
134
+ version: 1.14.0
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,7 +141,7 @@ dependencies:
141
141
  version: 1.8.5
142
142
  - - "<"
143
143
  - !ruby/object:Gem::Version
144
- version: 1.13.0
144
+ version: 1.14.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: highline
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  - !ruby/object:Gem::Version
330
330
  version: '0'
331
331
  requirements: []
332
- rubygems_version: 3.0.2
332
+ rubygems_version: 3.1.6
333
333
  signing_key:
334
334
  specification_version: 4
335
335
  summary: A library for parsing HQMF documents.