bel_parser 1.0.0.alpha.40 → 1.0.0.alpha.41

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,25 +11,25 @@
11
11
  action add_name {
12
12
  trace('SET add_name')
13
13
  key = @buffers.delete(:ident)
14
- @buffers[:set_name] = key
14
+ @buffers[:set_name] = name(key)
15
15
  }
16
16
 
17
17
  action add_ident_value {
18
18
  trace('SET add_ident_value')
19
19
  ident = @buffers.delete(:ident)
20
- @buffers[:set_value] = ident
20
+ @buffers[:set_value] = value(ident)
21
21
  }
22
22
 
23
23
  action add_string_value {
24
24
  trace('SET add_string_value')
25
25
  string = @buffers.delete(:string)
26
- @buffers[:set_value] = string
26
+ @buffers[:set_value] = value(string)
27
27
  }
28
28
 
29
29
  action add_list_value {
30
30
  trace('SET add_list_value')
31
31
  list = @buffers.delete(:list)
32
- @buffers[:set_value] = list
32
+ @buffers[:set_value] = value(list)
33
33
  }
34
34
 
35
35
  action set_end {
@@ -120,6 +120,7 @@
120
120
  @eof(set_node_eof)
121
121
  %set_end
122
122
  %yield_set
123
+ NL
123
124
  ;
124
125
  }%%
125
126
  =end
@@ -19,27 +19,25 @@ module BELParser
19
19
 
20
20
  def self.consume(ast_node, script_context)
21
21
  return nil unless ast_node.is_a?(TARGET_NODE)
22
- name, value = ast_node.children
23
- name_string = name.identifier.string_literal
24
- value_node = ast_node.value.children[0]
22
+ name_node, value_node = ast_node.children
23
+ name_string = name_node.identifier.string_literal
25
24
  case
26
25
  when is_citation?(name_string)
27
26
  handle_citation(value_node, script_context)
28
27
  when is_support?(name_string)
29
28
  handle_support(value_node, script_context)
30
29
  when value_node.is_a?(LIST_NODE)
31
- value_node
30
+ value.node
32
31
  .list_items.map { |li| li.children[0].string_literal }
33
32
  .each do |string|
34
33
  handle_annotation(name_string, string, script_context)
35
34
  end
36
35
  else
37
- value_string = value_node.string_literal
38
36
  case name_string
39
37
  when /\ASTATEMENT_GROUP\Z/
40
- handle_statement_group(value_string, script_context)
38
+ handle_statement_group(value_node, script_context)
41
39
  else
42
- handle_annotation(name_string, value_string, script_context)
40
+ handle_annotation(name_string, value_node, script_context)
43
41
  end
44
42
  end
45
43
  end
@@ -57,18 +55,18 @@ module BELParser
57
55
  end
58
56
 
59
57
  def self.handle_support(value_node, script_context)
60
- script_context[:support] = value_node.string_literal
58
+ script_context[:support] = value_node.children[0].string_literal
61
59
  end
62
60
 
63
- def self.handle_annotation(name, value, script_context)
61
+ def self.handle_annotation(name_string, value_node, script_context)
64
62
  # add to annotation state
65
- script_context[:annotations] ||= Concurrent::Hash.new
66
- script_context[:annotations][name] = value
63
+ script_context[:annotations] ||= Concurrent::Hash.new
64
+ script_context[:annotations][name_string] = value_node.children[0].string_literal
67
65
  end
68
66
  private_class_method :handle_annotation
69
67
 
70
- def self.handle_statement_group(value, script_context)
71
- script_context[:statement_group] = value
68
+ def self.handle_statement_group(value_node, script_context)
69
+ script_context[:statement_group] = value_node.children[0].string_literal
72
70
 
73
71
  # clear annotation state
74
72
  script_context[:annotations] ||= Concurrent::Hash.new
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bel_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.40
4
+ version: 1.0.0.alpha.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Bargnesi
8
8
  - Nick Bargnesi
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-20 00:00:00.000000000 Z
12
+ date: 2016-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: sparql-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
19
  version: 2.0.0
21
- type: :runtime
20
+ name: sparql-client
22
21
  prerelease: false
22
+ type: :runtime
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
@@ -379,7 +379,7 @@ homepage: https://github.com/OpenBEL/bel_parser
379
379
  licenses:
380
380
  - Apache-2.0
381
381
  metadata: {}
382
- post_install_message:
382
+ post_install_message:
383
383
  rdoc_options: []
384
384
  require_paths:
385
385
  - lib
@@ -394,10 +394,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
394
  - !ruby/object:Gem::Version
395
395
  version: 1.3.1
396
396
  requirements: []
397
- rubyforge_project:
398
- rubygems_version: 2.5.1
399
- signing_key:
397
+ rubyforge_project:
398
+ rubygems_version: 2.6.4
399
+ signing_key:
400
400
  specification_version: 4
401
401
  summary: Parser for Biolgical Expression Language.
402
402
  test_files: []
403
- has_rdoc: