bel_parser 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +1 -1
- data/VERSION +1 -1
- data/lib/bel_parser/ast_generator.rb +14 -13
- metadata +10 -10
- data/lib/bel_parser/mixin/line_continuator.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 513eae8d0ebb67c8ec75d95fb0ee13eee0054fce
|
4
|
+
data.tar.gz: 0a0f0c71191a88b2e62877432e5ba3c2d32145ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33575d0f1331c413be12086f273ad7e8d3c36a036b920efe241a0aa4f9daefb1a606ad5b23c1b833c26c51744a7567b9cdbe60c2f25ba05de57aae2f8fdba8f6
|
7
|
+
data.tar.gz: 28fd953bce3403c2b49104c177bc178cb64af60da1f2894afc94e4b2484725fad6f4ed7324dc3d60882474b4d7438f51d7f10fdf7aa8c653e6201b6218b82bf6
|
data/.gemspec
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -2,14 +2,12 @@ require_relative 'parsers/common'
|
|
2
2
|
require_relative 'parsers/expression'
|
3
3
|
require_relative 'parsers/bel_script'
|
4
4
|
require_relative 'mixin/line_mapping'
|
5
|
-
require_relative 'mixin/line_continuator'
|
6
5
|
|
7
6
|
module BELParser
|
8
7
|
# ASTGenerator yields AST results for each line in some {IO}.
|
9
8
|
# See #{ASTGenerator#each}.
|
10
9
|
class ASTGenerator
|
11
10
|
include LineMapping
|
12
|
-
include LineContinuator
|
13
11
|
|
14
12
|
map_const = ->(x) { x.constants.map { |c| x.const_get(c) } }
|
15
13
|
PARSERS = [
|
@@ -17,6 +15,7 @@ module BELParser
|
|
17
15
|
map_const.call(BELParser::Parsers::Expression),
|
18
16
|
map_const.call(BELParser::Parsers::BELScript)
|
19
17
|
].flatten!
|
18
|
+
LINE_CONTINUATOR = "\\\n".freeze
|
20
19
|
|
21
20
|
def initialize(io)
|
22
21
|
@io = io
|
@@ -48,21 +47,23 @@ module BELParser
|
|
48
47
|
# {Enumerator#each}
|
49
48
|
def each # rubocop:disable MethodLength
|
50
49
|
if block_given?
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
line_number = 1
|
51
|
+
expanded_line = nil
|
52
|
+
map_lines(@io.each_line.lazy).each do |line|
|
53
|
+
if line.end_with?(LINE_CONTINUATOR)
|
54
|
+
expanded_line = "#{expanded_line}#{line.chomp(LINE_CONTINUATOR)}"
|
55
|
+
else
|
56
|
+
expanded_line = "#{expanded_line}#{line}"
|
57
57
|
|
58
58
|
ast_results = []
|
59
59
|
PARSERS.map do |parser|
|
60
|
-
parser.parse(
|
60
|
+
parser.parse(expanded_line) { |ast| ast_results << ast }
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
|
+
yield [line_number, expanded_line, ast_results]
|
64
|
+
|
63
65
|
line_number += 1
|
64
|
-
|
65
|
-
return
|
66
|
+
expanded_line = nil
|
66
67
|
end
|
67
68
|
end
|
68
69
|
else
|
@@ -77,7 +78,7 @@ if __FILE__ == $PROGRAM_NAME
|
|
77
78
|
line_number, line, ast_results = line_results
|
78
79
|
puts "#{line_number}: #{line}"
|
79
80
|
ast_results.each do |ast|
|
80
|
-
puts ast.to_s
|
81
|
+
puts ast.to_s
|
81
82
|
end
|
82
83
|
end
|
83
84
|
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.
|
4
|
+
version: 1.0.5
|
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-
|
12
|
+
date: 2016-06-17 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
|
- - "~>"
|
@@ -294,7 +294,6 @@ files:
|
|
294
294
|
- lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb
|
295
295
|
- lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb
|
296
296
|
- lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb
|
297
|
-
- lib/bel_parser/mixin/line_continuator.rb
|
298
297
|
- lib/bel_parser/mixin/line_mapping.rb
|
299
298
|
- lib/bel_parser/parsers/ast/node.rb
|
300
299
|
- lib/bel_parser/parsers/ast/sexp.rb
|
@@ -392,7 +391,7 @@ homepage: https://github.com/OpenBEL/bel_parser
|
|
392
391
|
licenses:
|
393
392
|
- Apache-2.0
|
394
393
|
metadata: {}
|
395
|
-
post_install_message:
|
394
|
+
post_install_message:
|
396
395
|
rdoc_options: []
|
397
396
|
require_paths:
|
398
397
|
- lib
|
@@ -407,9 +406,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
406
|
- !ruby/object:Gem::Version
|
408
407
|
version: '0'
|
409
408
|
requirements: []
|
410
|
-
rubyforge_project:
|
411
|
-
rubygems_version: 2.
|
412
|
-
signing_key:
|
409
|
+
rubyforge_project:
|
410
|
+
rubygems_version: 2.5.1
|
411
|
+
signing_key:
|
413
412
|
specification_version: 4
|
414
413
|
summary: Parser for Biolgical Expression Language.
|
415
414
|
test_files: []
|
415
|
+
has_rdoc:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module BELParser
|
2
|
-
# LineContinuator is a mixin for line expansions for BEL Script.
|
3
|
-
module LineContinuator
|
4
|
-
LINE_CONTINUATOR = "\\\n".freeze
|
5
|
-
|
6
|
-
def expand_line_continuator(line_enumerator)
|
7
|
-
line = line_enumerator.next
|
8
|
-
while line.end_with?(LINE_CONTINUATOR)
|
9
|
-
line.chomp!(LINE_CONTINUATOR)
|
10
|
-
line += line_enumerator.next
|
11
|
-
end
|
12
|
-
line
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|