bel_parser 1.0.0.alpha.56-java → 1.0.0.alpha.57-java

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: 31b7d1faf3439b77b301a8465b6a6302892ca256
4
- data.tar.gz: e25ccf32c170db8fa016617ae6b8294a8bae07cc
3
+ metadata.gz: 60beaba7ec588b49f39e177c3c2ae31cdf9c48c6
4
+ data.tar.gz: 47feab6424d1532624d3841f00ae126fd88cc5ff
5
5
  SHA512:
6
- metadata.gz: 735a3f898e103914def1b14114627329eefe30f6823747142037bc0060de61022cbcdcaae962a18b0bf744c73266b9412dd467f6946a94d83b902a6f473454d2
7
- data.tar.gz: ef2463dd17b179952d8a259c2d80f3063cb5a4ba29da9985848e34e9d7217b0177c96f6f3980fc02af5f5cc718c2e5cae03580a1d14d548f3d7c3ddafd53d75f
6
+ metadata.gz: 258561f22b61be0fdd2d850a2d43b83a4e4248a05ef19a945a755a6826ef72665542ff997ae489bbce2297ee807b529dcbbc2762c57168e586ef5046d93b59bf
7
+ data.tar.gz: 399dfffc0c57a4d1915a8962e78e81ae163ce214308957dff0f2b4f0386061dd910b578857d66af9a5319ba24e102aa2052ddabf490843644a2619f01d7ddef9
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,7 +1,7 @@
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: java
6
6
  authors:
7
7
  - Anthony Bargnesi