story-gen 0.1.2 → 0.1.3
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.
- data/NEWS +3 -0
- data/lib/story/compile.rb +17 -14
- metadata +1 -1
data/NEWS
CHANGED
data/lib/story/compile.rb
CHANGED
|
@@ -63,7 +63,7 @@ class Story
|
|
|
63
63
|
relation_ids_code << "\n"<<
|
|
64
64
|
"end\n"<<
|
|
65
65
|
"protected\n"<<
|
|
66
|
-
"def write0(
|
|
66
|
+
"def write0()\n"<<
|
|
67
67
|
init_var_arg_valuesss_vars << "\n"<<
|
|
68
68
|
c << "\n"<<
|
|
69
69
|
"end\n"<<
|
|
@@ -171,7 +171,7 @@ class Story
|
|
|
171
171
|
def to_code
|
|
172
172
|
code << "(begin\n" <<
|
|
173
173
|
parts.map do |part|
|
|
174
|
-
code << "
|
|
174
|
+
code << "tell(" <<
|
|
175
175
|
case part
|
|
176
176
|
when String then part.to_rb
|
|
177
177
|
when Var then at(part.pos) { part.name }
|
|
@@ -775,20 +775,23 @@ class Story
|
|
|
775
775
|
args = []
|
|
776
776
|
negated = false
|
|
777
777
|
#
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
778
|
+
_{
|
|
779
|
+
many {
|
|
780
|
+
_{ s = (_{dash} or _{other_char} or _{comma}) and act { relation_id << s } } or
|
|
781
|
+
_{ a = asterisk and act { args << a; relation_id << :* } } or
|
|
782
|
+
_{ _not_ and act { negated = !negated } } or
|
|
783
|
+
_{ v = (_{value} or _{var} or _{above_var}) and act { args << v; relation_id << :* } } or
|
|
784
|
+
_{
|
|
785
|
+
w = (
|
|
786
|
+
_{ word } or
|
|
787
|
+
_{ _for_ and not_follows {all} } or
|
|
788
|
+
_{ all }
|
|
789
|
+
) and
|
|
790
|
+
act { relation_id << w.ru_downcase }
|
|
791
|
+
}
|
|
790
792
|
}
|
|
791
793
|
} and
|
|
794
|
+
not relation_id.empty? and
|
|
792
795
|
act { relation_id.chomp!(",") } and
|
|
793
796
|
if not negated and relation_id.all? { |p| p == :* } then
|
|
794
797
|
_(Statement::Tell[args])
|