bel_parser 1.0.0.alpha.56 → 1.0.0.alpha.57

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
  SHA1:
3
- metadata.gz: 63f744f7f42ef9e4ca74e1b5603582bf856ac6b2
4
- data.tar.gz: a0348eda0d0560bcd6162c0dfcd64cf3c3090c79
3
+ metadata.gz: a20eb6e58c9d1083ddb40267f95ec6bd49c41019
4
+ data.tar.gz: eed51687c5ea0aa8d6f3bf6a1ab442bbcd130344
5
5
  SHA512:
6
- metadata.gz: 32a09cd1d7c5c4d780c1384ce7892a754fd430c58a571554cc4a2815b4200604d09ead6ba10f6edb9cac865242a5c48bb3f8ee1df04849d6da1fca038e1acb65
7
- data.tar.gz: 7e93a4eea5d7780dc5f4afc96b1230fa962ddaac0a51f6f2452414fc44f32372c153612c6ad05fdac1ca06cabb8f5edc9e85c62e1f3b6adfa667c6536085665d
6
+ metadata.gz: 8cb211f34198ea310d4b2fe9fa0972cf5a51b75c6b2b82be05b47d4cf23c0347b0fbb38644b8de2684663373aef1fb9c09fbc3e0b1460b6a3c3771efa3048a70
7
+ data.tar.gz: 13d3ccf6bec4c7f7b485bc97b67c89124a6be2ebaa699de6bab29a1be9af37a2e75ed9cf6ffea821e4f79268b8c69eb268dd6877f771723f1b7359a724c28409
data/.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  'Anthony Bargnesi',
12
12
  'Nick Bargnesi',
13
13
  ]
14
- spec.date = %q{2016-06-01}
14
+ spec.date = %q{2016-06-06}
15
15
  spec.email = %q{abargnesi@selventa.com}
16
16
  spec.files = [
17
17
  Dir.glob('lib/**/*.{rb,rl}'),
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.alpha.56
1
+ 1.0.0.alpha.57
@@ -11,12 +11,18 @@ module BEL::Translator::Plugins
11
11
 
12
12
  def initialize(io, options = {})
13
13
  @io = io
14
+ require 'pry'; binding.pry
15
+
16
+ options = {
17
+ :language => '1.0'
18
+ }.merge(options)
19
+
14
20
  @state = {
15
21
  uri_reader: BELParser::Resource.default_uri_reader,
16
22
  url_reader: BELParser::Resource.default_url_reader,
17
- specification: BELParser::Language.specification('2.0'),
23
+ specification: BELParser::Language.specification(options[:language]),
18
24
  namespace_definitions: {}
19
- }
25
+ }.merge(options)
20
26
  end
21
27
 
22
28
  def each
@@ -12,7 +12,7 @@ module BEL::Translator::Plugins
12
12
  include ::BEL::Translator
13
13
 
14
14
  def read(data, options = {})
15
- Reader.new(data)
15
+ Reader.new(data, options)
16
16
  end
17
17
 
18
18
  def write(objects, writer = StringIO.new, options = {})
@@ -80,7 +80,7 @@ module BELParser
80
80
  end
81
81
 
82
82
  def validation(
83
- spec = BELParser::Language.latest_supported_specification,
83
+ spec = BELParser::Language.default_specification,
84
84
  uri_reader = BELParser::Resource.default_uri_reader,
85
85
  url_reader = BELParser::Resource.default_url_reader)
86
86
 
@@ -153,7 +153,7 @@ module BELParser
153
153
  end
154
154
  return nil if statement.nil?
155
155
 
156
- spec ||= BELParser::Language.latest_supported_specification
156
+ spec ||= BELParser::Language.default_specification
157
157
  comment = statement.comment && statement.comment.children[0]
158
158
 
159
159
  Statement.new(
@@ -52,7 +52,7 @@ module BELParser
52
52
  end
53
53
 
54
54
  def validation(
55
- spec = BELParser::Language.latest_supported_specification,
55
+ spec = BELParser::Language.default_specification,
56
56
  uri_reader = BELParser::Resource.default_uri_reader,
57
57
  url_reader = BELParser::Resource.default_url_reader)
58
58
 
@@ -67,7 +67,7 @@ module BELParser
67
67
  end
68
68
 
69
69
  def valid?(
70
- spec = BELParser::Language.latest_supported_specification,
70
+ spec = BELParser::Language.default_specification,
71
71
  uri_reader = BELParser::Resource.default_uri_reader,
72
72
  url_reader = BELParser::Resource.default_url_reader)
73
73
 
@@ -75,7 +75,7 @@ module BELParser
75
75
  end
76
76
 
77
77
  def invalid?(
78
- spec = BELParser::Language.latest_supported_specification,
78
+ spec = BELParser::Language.default_specification,
79
79
  uri_reader = BELParser::Resource.default_uri_reader,
80
80
  url_reader = BELParser::Resource.default_url_reader)
81
81
 
@@ -117,7 +117,7 @@ module BELParser
117
117
  def ast_to_term(ast, spec, namespaces = {})
118
118
  return nil if ast.nil? ||
119
119
  !ast.is_a?(BELParser::Parsers::AST::Term)
120
- spec ||= BELParser::Language.latest_supported_specification
120
+ spec ||= BELParser::Language.default_specification
121
121
  convert = method(:convert_argument).to_proc.curry[spec][namespaces]
122
122
 
123
123
  Term.new(
@@ -11,7 +11,7 @@ module BELParser
11
11
 
12
12
  def self.parse(
13
13
  input,
14
- spec = BELParser::Language.latest_supported_specification,
14
+ spec = BELParser::Language.default_specification,
15
15
  namespaces = {})
16
16
 
17
17
  parser = Parser.new(input, Expression.filter, spec, namespaces)
@@ -20,7 +20,7 @@ module BELParser
20
20
 
21
21
  def self.parse_parameters(
22
22
  input,
23
- spec = BELParser::Language.latest_supported_specification,
23
+ spec = BELParser::Language.default_specification,
24
24
  namespaces = {})
25
25
 
26
26
  parser = Parser.new(input, Expression.parameter_filter, spec, namespaces)
@@ -29,7 +29,7 @@ module BELParser
29
29
 
30
30
  def self.parse_terms(
31
31
  input,
32
- spec = BELParser::Language.latest_supported_specification,
32
+ spec = BELParser::Language.default_specification,
33
33
  namespaces = {})
34
34
 
35
35
  parser = Parser.new(input, Expression.term_filter, spec, namespaces)
@@ -38,7 +38,7 @@ module BELParser
38
38
 
39
39
  def self.parse_statements(
40
40
  input,
41
- spec = BELParser::Language.latest_supported_specification,
41
+ spec = BELParser::Language.default_specification,
42
42
  namespaces = {})
43
43
 
44
44
  parser = Parser.new(input, Expression.statement_filter, spec, namespaces)
@@ -53,7 +53,7 @@ module BELParser
53
53
  def initialize(
54
54
  input,
55
55
  filter = Expression.filter,
56
- spec = BELParser::Language.latest_supported_specification,
56
+ spec = BELParser::Language.default_specification,
57
57
  namespaces = {})
58
58
 
59
59
  @input = input
@@ -25,6 +25,8 @@ module BELParser
25
25
  LOCK = Mutex.new
26
26
  private_constant :LOCK
27
27
 
28
+ DEFAULT_VERSION = '1.0'
29
+
28
30
  # Indicates if +version+ is a defined BEL specification.
29
31
  #
30
32
  # @param [#to_s] version the BEL version string (e.g. +"2.0"+)
@@ -53,6 +55,14 @@ module BELParser
53
55
  end.sort
54
56
  end
55
57
 
58
+ def self.default_version
59
+ DEFAULT_VERSION
60
+ end
61
+
62
+ def self.default_specification
63
+ specification(DEFAULT_VERSION)
64
+ end
65
+
56
66
  # Returns the latest supported version string according to the
57
67
  # _MAJOR.MINOR_ pattern.
58
68
  #
@@ -45,7 +45,7 @@ class << self
45
45
  end
46
46
  self._bel_trans_keys = [
47
47
  0, 0, 9, 35, 9, 35,
48
- 9, 32, 10, 10, 0,
48
+ 10, 10, 10, 10, 0,
49
49
  0, 0
50
50
  ]
51
51
 
@@ -54,7 +54,7 @@ class << self
54
54
  private :_bel_key_spans, :_bel_key_spans=
55
55
  end
56
56
  self._bel_key_spans = [
57
- 0, 27, 27, 24, 1, 0
57
+ 0, 27, 27, 1, 1, 0
58
58
  ]
59
59
 
60
60
  class << self
@@ -62,7 +62,7 @@ class << self
62
62
  private :_bel_index_offsets, :_bel_index_offsets=
63
63
  end
64
64
  self._bel_index_offsets = [
65
- 0, 0, 28, 56, 81, 83
65
+ 0, 0, 28, 56, 58, 60
66
66
  ]
67
67
 
68
68
  class << self
@@ -77,10 +77,7 @@ self._bel_indicies = [
77
77
  1, 1, 1, 1, 1, 1, 1, 1,
78
78
  1, 1, 1, 1, 1, 1, 1, 1,
79
79
  1, 1, 1, 0, 1, 1, 2, 1,
80
- 5, 6, 4, 4, 4, 4, 4, 4,
81
- 4, 4, 4, 4, 4, 4, 4, 4,
82
- 4, 4, 4, 4, 4, 4, 4, 5,
83
- 4, 3, 7, 1, 0
80
+ 5, 4, 3, 6, 1, 0
84
81
  ]
85
82
 
86
83
  class << self
@@ -88,7 +85,7 @@ class << self
88
85
  private :_bel_trans_targs, :_bel_trans_targs=
89
86
  end
90
87
  self._bel_trans_targs = [
91
- 1, 0, 3, 5, 4, 3, 5, 4
88
+ 1, 0, 3, 5, 4, 5, 4
92
89
  ]
93
90
 
94
91
  class << self
@@ -96,7 +93,7 @@ class << self
96
93
  private :_bel_trans_actions, :_bel_trans_actions=
97
94
  end
98
95
  self._bel_trans_actions = [
99
- 0, 0, 0, 1, 3, 3, 4, 5
96
+ 0, 0, 0, 1, 3, 4, 5
100
97
  ]
101
98
 
102
99
  class << self
@@ -20,7 +20,7 @@
20
20
  yield comment_line(utf8_string(cl), complete: completed)
21
21
  }
22
22
 
23
- comment_start = SP* NUMBER_SIGN SP*;
23
+ comment_start = SP* NUMBER_SIGN;
24
24
  comment = comment_start (any - NL)*
25
25
  >comment_line_start
26
26
  $comment_line_more;
@@ -60,7 +60,7 @@ module BELParser
60
60
  def self.handle_annotation(name_string, value_node, script_context)
61
61
  # add to annotation state
62
62
  script_context[:annotations] ||= Concurrent::Hash.new
63
- script_context[:annotations][name_string] = value_node.children[0].string_literal
63
+ script_context[:annotations][name_string] = value_node.children[0]
64
64
  end
65
65
  private_class_method :handle_annotation
66
66
 
@@ -25,9 +25,7 @@ module BELParser
25
25
  BELParser::Language.specification(value_string)
26
26
  nil
27
27
  rescue ArgumentError
28
- latest_version = BELParser::Language.latest_supported_version
29
- latest_spec = BELParser::Language.specification(latest_version)
30
- script_context[:specification] = latest_spec
28
+ script_context[:specification] = BELParser::Language.default_specification
31
29
  UnsupportedBELVersionWarning.new(ast_node, value_string)
32
30
  end
33
31
  end
@@ -42,13 +40,13 @@ module BELParser
42
40
  def initialize(document_property_node, unsupported_version)
43
41
  super(document_property_node, nil)
44
42
  @unsupported_version = unsupported_version
45
- @latest = BELParser::Language.latest_supported_version
43
+ @default = BELParser::Language.default_version
46
44
  end
47
45
 
48
46
  def msg
49
47
  <<-MSG.gsub(/^ +/, '').delete("\n")
50
48
  Unsupported BEL version "#@unsupported_version".
51
- Setting BEL version to the latest supported version "#@latest".
49
+ Setting BEL version to the default version "#@default".
52
50
  MSG
53
51
  end
54
52
  end
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.56
4
+ version: 1.0.0.alpha.57
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-06-01 00:00:00.000000000 Z
12
+ date: 2016-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: sparql-client
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
20
  version: 2.0.0
20
- name: sparql-client
21
- prerelease: false
22
21
  type: :runtime
22
+ prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
@@ -381,7 +381,7 @@ homepage: https://github.com/OpenBEL/bel_parser
381
381
  licenses:
382
382
  - Apache-2.0
383
383
  metadata: {}
384
- post_install_message:
384
+ post_install_message:
385
385
  rdoc_options: []
386
386
  require_paths:
387
387
  - lib
@@ -396,9 +396,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
396
396
  - !ruby/object:Gem::Version
397
397
  version: 1.3.1
398
398
  requirements: []
399
- rubyforge_project:
400
- rubygems_version: 2.6.4
401
- signing_key:
399
+ rubyforge_project:
400
+ rubygems_version: 2.5.1
401
+ signing_key:
402
402
  specification_version: 4
403
403
  summary: Parser for Biolgical Expression Language.
404
404
  test_files: []
405
+ has_rdoc: