bel_parser 1.0.0.alpha.38-java → 1.0.0.alpha.39-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bel_parser/ast_filter.rb +6 -2
- data/lib/bel_parser/parsers/ast/node.rb +113 -58
- data/lib/bel_parser/parsers/bel_script/define_annotation.rb +4175 -3097
- data/lib/bel_parser/parsers/bel_script/define_annotation.rl +142 -49
- data/lib/bel_parser/parsers/bel_script/define_namespace.rb +980 -461
- data/lib/bel_parser/parsers/bel_script/define_namespace.rl +79 -39
- data/lib/bel_parser/parsers/bel_script/set.rb +4878 -2743
- data/lib/bel_parser/parsers/bel_script/set.rl +114 -32
- data/lib/bel_parser/parsers/bel_script/set_document.rb +5839 -5292
- data/lib/bel_parser/parsers/bel_script/set_document.rl +130 -27
- data/lib/bel_parser/parsers/bel_script/unset.rb +321 -234
- data/lib/bel_parser/parsers/bel_script/unset.rl +49 -21
- data/lib/bel_parser/parsers/common/blank_line.rb +12 -11
- data/lib/bel_parser/parsers/common/blank_line.rl +12 -12
- data/lib/bel_parser/parsers/common/comment_line.rb +65 -40
- data/lib/bel_parser/parsers/common/comment_line.rl +26 -26
- data/lib/bel_parser/parsers/common/common.rl +60 -0
- data/lib/bel_parser/parsers/common/function.rb +319 -0
- data/lib/bel_parser/parsers/common/function.rl +149 -0
- data/lib/bel_parser/parsers/common/identifier.rb +72 -68
- data/lib/bel_parser/parsers/common/identifier.rl +73 -29
- data/lib/bel_parser/parsers/common/list.rb +1617 -1243
- data/lib/bel_parser/parsers/common/list.rl +120 -60
- data/lib/bel_parser/parsers/common/string.rb +114 -41
- data/lib/bel_parser/parsers/common/string.rl +91 -28
- data/lib/bel_parser/parsers/common.rb +1 -0
- data/lib/bel_parser/parsers/expression/comment.rb +70 -38
- data/lib/bel_parser/parsers/expression/comment.rl +37 -20
- data/lib/bel_parser/parsers/expression/nested_statement.rb +63116 -13958
- data/lib/bel_parser/parsers/expression/nested_statement.rl +53 -23
- data/lib/bel_parser/parsers/expression/observed_term.rb +32497 -5188
- data/lib/bel_parser/parsers/expression/observed_term.rl +25 -20
- data/lib/bel_parser/parsers/expression/parameter.rb +2861 -847
- data/lib/bel_parser/parsers/expression/parameter.rl +178 -21
- data/lib/bel_parser/parsers/expression/relationship.rb +73 -55
- data/lib/bel_parser/parsers/expression/relationship.rl +41 -23
- data/lib/bel_parser/parsers/expression/simple_statement.rb +42895 -7846
- data/lib/bel_parser/parsers/expression/simple_statement.rl +41 -24
- data/lib/bel_parser/parsers/expression/term.rb +16498 -2602
- data/lib/bel_parser/parsers/expression/term.rl +52 -35
- data/lib/bel_parser/parsers/line_parser.rb +1 -0
- data/lib/bel_parser/parsers/mixin/buffer.rb +4 -0
- data/lib/bel_parser/parsers/tracer.rb +19 -0
- data/lib/bel_parser/script/state/namespace_definition.rb +1 -0
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7551ea8874262a96c2623bccbc0b78873f9d1f3
|
4
|
+
data.tar.gz: bd52f9cd988e9eb57fcea386da40ec33b71f7b32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d348dbd7674466b52d19a357b1561b9e02e6a7748931da8e0a32cee14c0b58fcdf11df308dce3e5f47360f1f15d079c07e967f3739a8098ed2384387675b64e
|
7
|
+
data.tar.gz: c288f3d3f77eae55d791ce8f272990a3c67b753a3fb7a77a0518cd6048974af9602a21ee01f20d0da79d5a02f85f0bf68f7d9b50b7e1d63a39d070ff93dca88f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.alpha.
|
1
|
+
1.0.0.alpha.39
|
@@ -5,7 +5,7 @@ module BELParser
|
|
5
5
|
class ASTFilter
|
6
6
|
def initialize(ast_enum, *types)
|
7
7
|
@ast_enum = ast_enum
|
8
|
-
@types = types
|
8
|
+
@types = Hash[types.map { |t| [t, true] }]
|
9
9
|
end
|
10
10
|
|
11
11
|
def each(enum = @ast_enum)
|
@@ -21,7 +21,11 @@ module BELParser
|
|
21
21
|
|
22
22
|
def filter(ast_enum)
|
23
23
|
ast_enum.select do |node|
|
24
|
-
|
24
|
+
if node.nil?
|
25
|
+
@types[nil]
|
26
|
+
else
|
27
|
+
@types[node.type]
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -148,6 +148,53 @@ module BELParser
|
|
148
148
|
updated(@children + [element])
|
149
149
|
end
|
150
150
|
|
151
|
+
# Get the child at the specified _index_.
|
152
|
+
#
|
153
|
+
# @param [Fixnum] index the index to get
|
154
|
+
# @return [Node, nil] the child of this node at the indicated index
|
155
|
+
# or nil if not present
|
156
|
+
def child(index)
|
157
|
+
@children[index]
|
158
|
+
end
|
159
|
+
|
160
|
+
# Get the child at index 0.
|
161
|
+
# @see #child
|
162
|
+
def first_child
|
163
|
+
child 0
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get the child at index 1.
|
167
|
+
# @see #child
|
168
|
+
def second_child
|
169
|
+
child 1
|
170
|
+
end
|
171
|
+
|
172
|
+
# Get the child at index 2.
|
173
|
+
# @see #child
|
174
|
+
def third_child
|
175
|
+
child 2
|
176
|
+
end
|
177
|
+
|
178
|
+
# Get the child at index 3.
|
179
|
+
# @see #child
|
180
|
+
def fourth_child
|
181
|
+
child 3
|
182
|
+
end
|
183
|
+
|
184
|
+
# Get the number of children.
|
185
|
+
#
|
186
|
+
# @return [Fixnum] the number of children
|
187
|
+
def num_children
|
188
|
+
@children.size
|
189
|
+
end
|
190
|
+
|
191
|
+
# Get whether this node has children.
|
192
|
+
#
|
193
|
+
# @return [true, false]
|
194
|
+
def children?
|
195
|
+
!@children.empty?
|
196
|
+
end
|
197
|
+
|
151
198
|
alias << append
|
152
199
|
end
|
153
200
|
|
@@ -803,8 +850,12 @@ module BELParser
|
|
803
850
|
end
|
804
851
|
|
805
852
|
# Get what is being unset.
|
853
|
+
#
|
854
|
+
# @return [String, nil] what is being unset
|
806
855
|
def name
|
807
|
-
children
|
856
|
+
return nil unless children?
|
857
|
+
return nil unless first_child.children?
|
858
|
+
first_child.first_child
|
808
859
|
end
|
809
860
|
end
|
810
861
|
|
@@ -862,124 +913,128 @@ module BELParser
|
|
862
913
|
#
|
863
914
|
# @see https://en.wikipedia.org/wiki/S-expression S-expression
|
864
915
|
module Sexp
|
865
|
-
def nested_statement(*children)
|
866
|
-
NestedStatement.new(children)
|
916
|
+
def nested_statement(*children, **props)
|
917
|
+
NestedStatement.new(children, props)
|
867
918
|
end
|
868
919
|
|
869
|
-
def simple_statement(*children)
|
870
|
-
SimpleStatement.new(children)
|
920
|
+
def simple_statement(*children, **props)
|
921
|
+
SimpleStatement.new(children, props)
|
871
922
|
end
|
872
923
|
|
873
|
-
def observed_term(*children)
|
874
|
-
ObservedTerm.new(children)
|
924
|
+
def observed_term(*children, **props)
|
925
|
+
ObservedTerm.new(children, props)
|
875
926
|
end
|
876
927
|
|
877
|
-
def statement(*children)
|
878
|
-
Statement.new(children)
|
928
|
+
def statement(*children, **props)
|
929
|
+
Statement.new(children, props)
|
879
930
|
end
|
880
931
|
|
881
|
-
def subject(*children)
|
882
|
-
Subject.new(children)
|
932
|
+
def subject(*children, **props)
|
933
|
+
Subject.new(children, props)
|
883
934
|
end
|
884
935
|
|
885
|
-
def object(*children)
|
886
|
-
Object.new(children)
|
936
|
+
def object(*children, **props)
|
937
|
+
Object.new(children, props)
|
887
938
|
end
|
888
939
|
|
889
|
-
def relationship(*children)
|
890
|
-
Relationship.new(children)
|
940
|
+
def relationship(*children, **props)
|
941
|
+
Relationship.new(children, props)
|
891
942
|
end
|
892
943
|
|
893
|
-
def term(*children)
|
894
|
-
Term.new(children)
|
944
|
+
def term(*children, **props)
|
945
|
+
Term.new(children, props)
|
895
946
|
end
|
896
947
|
|
897
|
-
def function(*children)
|
898
|
-
Function.new(children)
|
948
|
+
def function(*children, **props)
|
949
|
+
Function.new(children, props)
|
899
950
|
end
|
900
951
|
|
901
|
-
def argument(*children)
|
902
|
-
Argument.new(children)
|
952
|
+
def argument(*children, **props)
|
953
|
+
Argument.new(children, props)
|
903
954
|
end
|
904
955
|
|
905
|
-
def parameter(*children)
|
906
|
-
Parameter.new(children)
|
956
|
+
def parameter(*children, **props)
|
957
|
+
Parameter.new(children, props)
|
907
958
|
end
|
908
959
|
|
909
|
-
def prefix(*children)
|
910
|
-
Prefix.new(children)
|
960
|
+
def prefix(*children, **props)
|
961
|
+
Prefix.new(children, props)
|
911
962
|
end
|
912
963
|
|
913
|
-
def name(*children)
|
914
|
-
Name.new(children)
|
964
|
+
def name(*children, **props)
|
965
|
+
Name.new(children, props)
|
915
966
|
end
|
916
967
|
|
917
|
-
def value(*children)
|
918
|
-
Value.new(children)
|
968
|
+
def value(*children, **props)
|
969
|
+
Value.new(children, props)
|
919
970
|
end
|
920
971
|
|
921
|
-
def identifier(*children)
|
922
|
-
Identifier.new(children)
|
972
|
+
def identifier(*children, **props)
|
973
|
+
Identifier.new(children, props)
|
923
974
|
end
|
924
975
|
|
925
|
-
def string(*children)
|
926
|
-
String.new(children)
|
976
|
+
def string(*children, **props)
|
977
|
+
String.new(children, props)
|
927
978
|
end
|
928
979
|
|
929
|
-
def list(*children)
|
930
|
-
List.new(children)
|
980
|
+
def list(*children, **props)
|
981
|
+
List.new(children, props)
|
931
982
|
end
|
932
983
|
|
933
|
-
def list_item(*children)
|
934
|
-
ListItem.new(children)
|
984
|
+
def list_item(*children, **props)
|
985
|
+
ListItem.new(children, props)
|
935
986
|
end
|
936
987
|
|
937
|
-
def comment(*children)
|
938
|
-
Comment.new(children)
|
988
|
+
def comment(*children, **props)
|
989
|
+
Comment.new(children, props)
|
939
990
|
end
|
940
991
|
|
941
|
-
def comment_line(*children)
|
942
|
-
CommentLine.new(children)
|
992
|
+
def comment_line(*children, **props)
|
993
|
+
CommentLine.new(children, props)
|
943
994
|
end
|
944
995
|
|
945
996
|
def blank_line
|
946
|
-
BlankLine.new
|
997
|
+
BlankLine.new([], complete: true)
|
947
998
|
end
|
948
999
|
|
949
|
-
def set(*children)
|
950
|
-
Set.new(children)
|
1000
|
+
def set(*children, **props)
|
1001
|
+
Set.new(children, props)
|
951
1002
|
end
|
952
1003
|
|
953
1004
|
def unset(*children)
|
954
1005
|
Unset.new(children)
|
955
1006
|
end
|
956
1007
|
|
957
|
-
def document_property(*children)
|
958
|
-
DocumentProperty.new(children)
|
1008
|
+
def document_property(*children, **props)
|
1009
|
+
DocumentProperty.new(children, props)
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
def annotation_definition(*children, **props)
|
1013
|
+
AnnotationDefinition.new(children, props)
|
959
1014
|
end
|
960
1015
|
|
961
|
-
def
|
962
|
-
|
1016
|
+
def namespace_definition(*children, **props)
|
1017
|
+
NamespaceDefinition.new(children, props)
|
963
1018
|
end
|
964
1019
|
|
965
|
-
def
|
966
|
-
|
1020
|
+
def keyword(*children, **props)
|
1021
|
+
Keyword.new(children, props)
|
967
1022
|
end
|
968
1023
|
|
969
|
-
def
|
970
|
-
|
1024
|
+
def domain(*children, **props)
|
1025
|
+
Domain.new(children, props)
|
971
1026
|
end
|
972
1027
|
|
973
|
-
def
|
974
|
-
|
1028
|
+
def url(*children, **props)
|
1029
|
+
Url.new(children, props)
|
975
1030
|
end
|
976
1031
|
|
977
|
-
def
|
978
|
-
|
1032
|
+
def pattern(*children, **props)
|
1033
|
+
Pattern.new(children, props)
|
979
1034
|
end
|
980
1035
|
|
981
|
-
def
|
982
|
-
|
1036
|
+
def unset(*children, **props)
|
1037
|
+
Unset.new(children, props)
|
983
1038
|
end
|
984
1039
|
end
|
985
1040
|
end
|