bel_parser 1.0.0.alpha.56-java → 1.0.0.alpha.57-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/VERSION +1 -1
 - data/lib/bel/translator/plugins/bel_script/reader.rb +8 -2
 - data/lib/bel/translator/plugins/bel_script/translator.rb +1 -1
 - data/lib/bel_parser/expression/model/statement.rb +2 -2
 - data/lib/bel_parser/expression/model/term.rb +4 -4
 - data/lib/bel_parser/expression/parser.rb +5 -5
 - data/lib/bel_parser/language.rb +10 -0
 - data/lib/bel_parser/parsers/common/comment_line.rb +6 -9
 - data/lib/bel_parser/parsers/common/comment_line.rl +1 -1
 - data/lib/bel_parser/script/state/set.rb +1 -1
 - data/lib/bel_parser/script/syntax/unsupported_bel_version.rb +3 -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: 60beaba7ec588b49f39e177c3c2ae31cdf9c48c6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 47feab6424d1532624d3841f00ae126fd88cc5ff
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 258561f22b61be0fdd2d850a2d43b83a4e4248a05ef19a945a755a6826ef72665542ff997ae489bbce2297ee807b529dcbbc2762c57168e586ef5046d93b59bf
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 399dfffc0c57a4d1915a8962e78e81ae163ce214308957dff0f2b4f0386061dd910b578857d66af9a5319ba24e102aa2052ddabf490843644a2619f01d7ddef9
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            1.0.0.alpha. 
     | 
| 
      
 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( 
     | 
| 
      
 23 
     | 
    
         
            +
                      specification:         BELParser::Language.specification(options[:language]),
         
     | 
| 
       18 
24 
     | 
    
         
             
                      namespace_definitions: {}
         
     | 
| 
       19 
     | 
    
         
            -
                    }
         
     | 
| 
      
 25 
     | 
    
         
            +
                    }.merge(options)
         
     | 
| 
       20 
26 
     | 
    
         
             
                  end
         
     | 
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         
             
                  def each
         
     | 
| 
         @@ -80,7 +80,7 @@ module BELParser 
     | 
|
| 
       80 
80 
     | 
    
         
             
                    end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
                    def validation(
         
     | 
| 
       83 
     | 
    
         
            -
                      spec       = BELParser::Language. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 56 
     | 
    
         
            +
                    spec       = BELParser::Language.default_specification,
         
     | 
| 
       57 
57 
     | 
    
         
             
                    namespaces = {})
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                    @input      = input
         
     | 
    
        data/lib/bel_parser/language.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
            	 
     | 
| 
      
 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,  
     | 
| 
      
 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,  
     | 
| 
      
 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,  
     | 
| 
       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,  
     | 
| 
      
 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,  
     | 
| 
      
 96 
     | 
    
         
            +
            	0, 0, 0, 1, 3, 4, 5
         
     | 
| 
       100 
97 
     | 
    
         
             
            ]
         
     | 
| 
       101 
98 
     | 
    
         | 
| 
       102 
99 
     | 
    
         
             
            class << self
         
     | 
| 
         @@ -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] 
     | 
| 
      
 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 
     | 
    
         
            -
                         
     | 
| 
       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 
     | 
    
         
            -
                      @ 
     | 
| 
      
 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  
     | 
| 
      
 49 
     | 
    
         
            +
                        Setting BEL version to the default version "#@default".
         
     | 
| 
       52 
50 
     | 
    
         
             
                      MSG
         
     | 
| 
       53 
51 
     | 
    
         
             
                    end
         
     | 
| 
       54 
52 
     | 
    
         
             
                  end
         
     |