spec/zenlish/parser/zparser_spec.rb in zenlish-0.1.09 vs spec/zenlish/parser/zparser_spec.rb in zenlish-0.1.10
- old
+ new
@@ -34,18 +34,21 @@
literal2var('above', 'above')
literal2var('alive', 'alive')
literal2var('all', 'all')
literal2var('another', 'another')
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
+ literal2var('because', 'because')
literal2var('big', 'big')
literal2var('big', 'bigger')
literal2var('as', 'as')
literal2var('of', 'of')
- literal2var('do', 'does')
+ def does ; Lex::Literal.new('does', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
+ def does_aux ; Lex::Literal.new('does', get_lexeme('do', WClasses::AuxiliaryDo), 0) ; end
literal2var('false', 'false', '_')
literal2var('far', 'far')
literal2var('from', 'from')
+ literal2var('happen', 'happens')
literal2var('have', 'has')
literal2var('have', 'have')
literal2var('hear', 'hears')
literal2var('if', 'if', '_')
literal2var('in', 'in', '_')
@@ -92,10 +95,11 @@
literal2var('touch', 'touching')
literal2var('true', 'true', '_')
literal2var('two', 'two')
literal2var('very', 'very')
literal2var('what', 'what')
+ literal2var('with', 'with')
literal2var('word', 'words')
def colon ; Lex::Literal.new(':', get_lexeme(':'), 0) ; end
def comma ; Lex::Literal.new(',', get_lexeme(','), 0) ; end
def dot ; Lex::Literal.new('.', get_lexeme('.'), 0) ; end
@@ -192,11 +196,11 @@
# Sentence 1-11: "Lisa is not inside this thing."
literals = [lisa, is, not_, inside, this, thing, dot]
expect { subject.parse(literals) }.not_to raise_error
# Sentence: "Lisa does not see people inside the other thing."
- literals = [lisa, does, not_, see, people, inside, the, other, thing, dot]
+ literals = [lisa, does_aux, not_, see, people, inside, the, other, thing, dot]
expect { subject.parse(literals) }.not_to raise_error
end
it 'should parse sample sentences from lesson 1-D' do
# Sentence 1-12a: "Some of these people are inside this thing."
@@ -439,26 +443,66 @@
# Sentence 2-02b: "Tony has another thing."
literals = [tony, has, another, thing, dot]
expect { subject.parse(literals) }.not_to raise_error
# Sentence 2-02c: "Lisa does not have the same kind of thing as Tony has."
- literals = [lisa, does, not_, have, the, same, kind, of, thing, as, tony, has, dot]
+ literals = [lisa, does_aux, not_, have, the, same, kind, of, thing, as, tony, has, dot]
expect { subject.parse(literals) }.not_to raise_error
# Sentence 2-03a: "Lisa is touching part of this thing."
literals = [lisa, is_aux, touching, part, of, this, thing, dot]
expect { subject.parse(literals) }.not_to raise_error
-
+
# Sentence 2-03b: "Tony is touching the other part."
literals = [tony, is_aux, touching, the, other, part, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-04a: "Lisa does something."
+ literals = [lisa, does, something, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-04b: "Lisa does something with this thing."
+ literals = [lisa, does, something, with, this, thing, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-04c: "Lisa does something to Tony."
+ literals = [lisa, does, something, to, tony, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-04d: "Lisa does something to Tony with this thing."
+ literals = [lisa, does, something, to, tony, with, this, thing, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-05a: "Something happens."
+ literals = [something, happens, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-05b: "Something happens to Lisa."
+ literals = [something, happens, to, lisa, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-06a: "Tony does something."
+ literals = [tony, does, something, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-06b: "Something happens to Lisa because of this."
+ literals = [something, happens, to, lisa, because, of, this_as_pronoun, dot]
+ expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-06c: "Something happens to Lisa because Tony does this."
+ literals = [something, happens, to, lisa, because, tony, does, this_as_pronoun, dot]
expect { subject.parse(literals) }.not_to raise_error
+
+ # Sentence 2-06: "Something happens to this living thing."
+ literals = [something, happens, to, this, living, thing, dot]
+ expect { subject.parse(literals) }.not_to raise_error
end
=begin
TODO
Lesson 2.A
Xtra:
What Tony has is like what Lisa has.
-=end
+=end
end # context
end # describe
end # module
end # module