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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/bel_parser/ast_filter.rb +6 -2
  4. data/lib/bel_parser/parsers/ast/node.rb +113 -58
  5. data/lib/bel_parser/parsers/bel_script/define_annotation.rb +4175 -3097
  6. data/lib/bel_parser/parsers/bel_script/define_annotation.rl +142 -49
  7. data/lib/bel_parser/parsers/bel_script/define_namespace.rb +980 -461
  8. data/lib/bel_parser/parsers/bel_script/define_namespace.rl +79 -39
  9. data/lib/bel_parser/parsers/bel_script/set.rb +4878 -2743
  10. data/lib/bel_parser/parsers/bel_script/set.rl +114 -32
  11. data/lib/bel_parser/parsers/bel_script/set_document.rb +5839 -5292
  12. data/lib/bel_parser/parsers/bel_script/set_document.rl +130 -27
  13. data/lib/bel_parser/parsers/bel_script/unset.rb +321 -234
  14. data/lib/bel_parser/parsers/bel_script/unset.rl +49 -21
  15. data/lib/bel_parser/parsers/common/blank_line.rb +12 -11
  16. data/lib/bel_parser/parsers/common/blank_line.rl +12 -12
  17. data/lib/bel_parser/parsers/common/comment_line.rb +65 -40
  18. data/lib/bel_parser/parsers/common/comment_line.rl +26 -26
  19. data/lib/bel_parser/parsers/common/common.rl +60 -0
  20. data/lib/bel_parser/parsers/common/function.rb +319 -0
  21. data/lib/bel_parser/parsers/common/function.rl +149 -0
  22. data/lib/bel_parser/parsers/common/identifier.rb +72 -68
  23. data/lib/bel_parser/parsers/common/identifier.rl +73 -29
  24. data/lib/bel_parser/parsers/common/list.rb +1617 -1243
  25. data/lib/bel_parser/parsers/common/list.rl +120 -60
  26. data/lib/bel_parser/parsers/common/string.rb +114 -41
  27. data/lib/bel_parser/parsers/common/string.rl +91 -28
  28. data/lib/bel_parser/parsers/common.rb +1 -0
  29. data/lib/bel_parser/parsers/expression/comment.rb +70 -38
  30. data/lib/bel_parser/parsers/expression/comment.rl +37 -20
  31. data/lib/bel_parser/parsers/expression/nested_statement.rb +63116 -13958
  32. data/lib/bel_parser/parsers/expression/nested_statement.rl +53 -23
  33. data/lib/bel_parser/parsers/expression/observed_term.rb +32497 -5188
  34. data/lib/bel_parser/parsers/expression/observed_term.rl +25 -20
  35. data/lib/bel_parser/parsers/expression/parameter.rb +2861 -847
  36. data/lib/bel_parser/parsers/expression/parameter.rl +178 -21
  37. data/lib/bel_parser/parsers/expression/relationship.rb +73 -55
  38. data/lib/bel_parser/parsers/expression/relationship.rl +41 -23
  39. data/lib/bel_parser/parsers/expression/simple_statement.rb +42895 -7846
  40. data/lib/bel_parser/parsers/expression/simple_statement.rl +41 -24
  41. data/lib/bel_parser/parsers/expression/term.rb +16498 -2602
  42. data/lib/bel_parser/parsers/expression/term.rl +52 -35
  43. data/lib/bel_parser/parsers/line_parser.rb +1 -0
  44. data/lib/bel_parser/parsers/mixin/buffer.rb +4 -0
  45. data/lib/bel_parser/parsers/tracer.rb +19 -0
  46. data/lib/bel_parser/script/state/namespace_definition.rb +1 -0
  47. metadata +10 -7
@@ -8,39 +8,53 @@
8
8
  include 'comment.rl';
9
9
 
10
10
  action statement_subject {
11
+ trace('SIMPLE_STATEMENT statement_subject')
11
12
  @buffers[:subject] = subject(
12
13
  @buffers[:term_stack][-1])
13
14
  @buffers[:term_stack] = nil
14
15
  }
15
16
 
16
17
  action statement_object {
17
- @buffers[:object] = object(
18
- @buffers[:term_stack][-1])
18
+ trace('SIMPLE_STATEMENT statement_object')
19
+ term = @buffers[:term_stack][-1]
20
+ @buffers[:object] = object(term)
19
21
  @buffers[:term_stack] = nil
22
+ sub = @buffers[:subject]
23
+ rel = @buffers[:relationship]
24
+ obj = @buffers[:object]
25
+ stmt = statement(sub, rel, obj)
26
+ simple_stmt = simple_statement(stmt)
27
+ simple_stmt.complete = true
28
+ @buffers[:simple_statement] = simple_stmt
29
+ }
30
+
31
+ action simple_statement_comment {
32
+ trace('SIMPLE_STATEMENT simple_statement_comment')
33
+ comment = @buffers[:comment]
34
+ @buffers[:simple_statement] =
35
+ simple_statement(
36
+ @buffers[:simple_statement].statement << comment)
20
37
  }
21
38
 
22
39
  action yield_simple_statement {
23
- @buffers[:comment] ||= comment(nil)
24
- yield simple_statement(
25
- statement(
26
- @buffers[:subject],
27
- @buffers[:relationship],
28
- @buffers[:object],
29
- @buffers[:comment]))
40
+ trace('YIELD_SIMPLE_STATEMENT')
41
+ simple_stmt = @buffers.delete(:simple_statement)
42
+ yield simple_stmt
30
43
  }
31
44
 
32
45
  STATEMENT_SIMPLE =
33
46
  outer_term %statement_subject
34
47
  SP+
35
- RELATIONSHIP
48
+ relationship %relationship_end
36
49
  SP+
37
- outer_term %statement_object;
50
+ outer_term
51
+ %statement_object;
38
52
 
39
53
  simple_statement :=
40
54
  STATEMENT_SIMPLE
41
55
  SP*
42
- COMMENT? %yield_simple_statement
43
- NL;
56
+ comment? %simple_statement_comment %yield_simple_statement
57
+ NL?;
44
58
  }%%
45
59
  =end
46
60
  # end: ragel
@@ -48,6 +62,7 @@
48
62
  require_relative '../ast/node'
49
63
  require_relative '../mixin/buffer'
50
64
  require_relative '../nonblocking_io_wrapper'
65
+ require_relative '../tracer'
51
66
 
52
67
  module BELParser
53
68
  module Parsers
@@ -73,26 +88,28 @@ module BELParser
73
88
  include Enumerable
74
89
  include BELParser::Parsers::Buffer
75
90
  include BELParser::Parsers::AST::Sexp
91
+ include BELParser::Parsers::Tracer
76
92
 
77
93
  def initialize(content)
78
94
  @content = content
79
- # begin: ragel
95
+ # begin: ragel
80
96
  %% write data;
81
- # end: ragel
97
+ # end: ragel
82
98
  end
83
99
 
84
100
  def each
85
- @buffers = {}
86
- stack = []
87
- data = @content.unpack('C*')
88
- p = 0
89
- pe = data.length
90
- eof = data.length
91
-
92
- # begin: ragel
101
+ @buffers = {}
102
+ @incomplete = {}
103
+ stack = []
104
+ data = @content.unpack('C*')
105
+ p = 0
106
+ pe = data.length
107
+ eof = data.length
108
+
109
+ # begin: ragel
93
110
  %% write init;
94
111
  %% write exec;
95
- # end: ragel
112
+ # end: ragel
96
113
  end
97
114
  end
98
115
  end