bel_parser 1.0.4-java → 1.0.5-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/.gemspec-java +1 -1
- data/VERSION +1 -1
- data/lib/bel_parser/ast_generator.rb +14 -13
- metadata +2 -3
- 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: 33897de47554094c0e1080aefe1d110a10b5e8e2
|
4
|
+
data.tar.gz: aa2c6d0b4b11132b8eef14507af0abdc3c29597a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08405ba1235d81e0675fa135717452806fd80719698d8366263ad13796029db8cdf9bb2e34b546a4e765e2c586ff297c1ae0c6b60e30782526ab2b2e1164d569
|
7
|
+
data.tar.gz: 19aecd3a58db40c7a09cbb846fffb0a28c43c61b0fa3ad348c06c7e159e759c3ed4f90c5c2d28e494a63be034dfce0e83addbdb4ad3161cac374299adf3b7c2c
|
data/.gemspec-java
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,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.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Anthony Bargnesi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,7 +308,6 @@ files:
|
|
308
308
|
- lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb
|
309
309
|
- lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb
|
310
310
|
- lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb
|
311
|
-
- lib/bel_parser/mixin/line_continuator.rb
|
312
311
|
- lib/bel_parser/mixin/line_mapping.rb
|
313
312
|
- lib/bel_parser/parsers/ast/node.rb
|
314
313
|
- lib/bel_parser/parsers/ast/sexp.rb
|
@@ -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
|