activefacts 0.8.9 → 0.8.10

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.
Files changed (120) hide show
  1. data/.gemtest +0 -0
  2. data/Manifest.txt +28 -33
  3. data/Rakefile +11 -12
  4. data/bin/cql +90 -46
  5. data/examples/CQL/Blog.cql +2 -1
  6. data/examples/CQL/CompanyDirectorEmployee.cql +2 -2
  7. data/examples/CQL/Death.cql +1 -1
  8. data/examples/CQL/Diplomacy.cql +9 -9
  9. data/examples/CQL/Genealogy.cql +3 -2
  10. data/examples/CQL/Insurance.cql +10 -7
  11. data/examples/CQL/JoinEquality.cql +2 -2
  12. data/examples/CQL/Marriage.cql +1 -1
  13. data/examples/CQL/Metamodel.cql +73 -53
  14. data/examples/CQL/MetamodelNext.cql +89 -67
  15. data/examples/CQL/OneToOnes.cql +2 -2
  16. data/examples/CQL/ServiceDirector.cql +10 -5
  17. data/examples/CQL/Supervision.cql +3 -3
  18. data/examples/CQL/Tests.Test5.Load.cql +1 -1
  19. data/examples/CQL/Warehousing.cql +4 -2
  20. data/lib/activefacts/cql/CQLParser.treetop +26 -60
  21. data/lib/activefacts/cql/Context.treetop +12 -2
  22. data/lib/activefacts/cql/Expressions.treetop +14 -30
  23. data/lib/activefacts/cql/FactTypes.treetop +165 -110
  24. data/lib/activefacts/cql/Language/English.treetop +167 -54
  25. data/lib/activefacts/cql/LexicalRules.treetop +16 -2
  26. data/lib/activefacts/cql/{Concepts.treetop → ObjectTypes.treetop} +36 -37
  27. data/lib/activefacts/cql/Terms.treetop +57 -27
  28. data/lib/activefacts/cql/ValueTypes.treetop +39 -13
  29. data/lib/activefacts/cql/compiler.rb +5 -3
  30. data/lib/activefacts/cql/compiler/{reading.rb → clause.rb} +407 -285
  31. data/lib/activefacts/cql/compiler/constraint.rb +178 -275
  32. data/lib/activefacts/cql/compiler/entity_type.rb +73 -64
  33. data/lib/activefacts/cql/compiler/expression.rb +418 -0
  34. data/lib/activefacts/cql/compiler/fact.rb +146 -145
  35. data/lib/activefacts/cql/compiler/fact_type.rb +197 -80
  36. data/lib/activefacts/cql/compiler/join.rb +159 -0
  37. data/lib/activefacts/cql/compiler/shared.rb +51 -23
  38. data/lib/activefacts/cql/compiler/value_type.rb +56 -2
  39. data/lib/activefacts/cql/parser.rb +15 -4
  40. data/lib/activefacts/generate/absorption.rb +7 -7
  41. data/lib/activefacts/generate/cql.rb +100 -37
  42. data/lib/activefacts/generate/oo.rb +28 -51
  43. data/lib/activefacts/generate/ordered.rb +60 -36
  44. data/lib/activefacts/generate/ruby.rb +6 -6
  45. data/lib/activefacts/generate/sql/server.rb +4 -4
  46. data/lib/activefacts/input/orm.rb +71 -53
  47. data/lib/activefacts/persistence.rb +1 -1
  48. data/lib/activefacts/persistence/columns.rb +27 -23
  49. data/lib/activefacts/persistence/foreignkey.rb +6 -6
  50. data/lib/activefacts/persistence/index.rb +17 -17
  51. data/lib/activefacts/persistence/{concept.rb → object_type.rb} +9 -9
  52. data/lib/activefacts/persistence/reference.rb +61 -36
  53. data/lib/activefacts/persistence/tables.rb +61 -59
  54. data/lib/activefacts/support.rb +54 -29
  55. data/lib/activefacts/version.rb +1 -1
  56. data/lib/activefacts/vocabulary/extensions.rb +99 -54
  57. data/lib/activefacts/vocabulary/metamodel.rb +43 -37
  58. data/lib/activefacts/vocabulary/verbaliser.rb +134 -109
  59. data/spec/absorption_spec.rb +8 -8
  60. data/spec/cql/comparison_spec.rb +91 -0
  61. data/spec/cql/contractions_spec.rb +251 -0
  62. data/spec/cql/entity_type_spec.rb +319 -0
  63. data/spec/cql/expressions_spec.rb +63 -0
  64. data/spec/cql/fact_type_matching_spec.rb +283 -0
  65. data/spec/cql/french_spec.rb +21 -0
  66. data/spec/cql/parser/bad_literals_spec.rb +86 -0
  67. data/spec/cql/parser/constraints_spec.rb +19 -0
  68. data/spec/cql/parser/entity_types_spec.rb +106 -0
  69. data/spec/cql/parser/expressions_spec.rb +179 -0
  70. data/spec/cql/parser/fact_types_spec.rb +41 -0
  71. data/spec/cql/parser/literals_spec.rb +312 -0
  72. data/spec/cql/parser/pragmas_spec.rb +89 -0
  73. data/spec/cql/parser/value_types_spec.rb +42 -0
  74. data/spec/cql/role_matching_spec.rb +147 -0
  75. data/spec/cql/samples_spec.rb +9 -9
  76. data/spec/cql_cql_spec.rb +1 -1
  77. data/spec/cql_dm_spec.rb +116 -0
  78. data/spec/cql_mysql_spec.rb +1 -1
  79. data/spec/cql_ruby_spec.rb +1 -1
  80. data/spec/cql_sql_spec.rb +3 -3
  81. data/spec/cql_symbol_tables_spec.rb +30 -30
  82. data/spec/cqldump_spec.rb +4 -4
  83. data/spec/helpers/array_matcher.rb +32 -27
  84. data/spec/helpers/diff_matcher.rb +6 -26
  85. data/spec/helpers/file_matcher.rb +41 -32
  86. data/spec/helpers/parse_to_ast_matcher.rb +76 -0
  87. data/spec/helpers/string_matcher.rb +32 -31
  88. data/spec/norma_cql_spec.rb +1 -1
  89. data/spec/norma_ruby_spec.rb +1 -1
  90. data/spec/norma_ruby_sql_spec.rb +1 -1
  91. data/spec/norma_sql_spec.rb +3 -1
  92. data/spec/norma_tables_spec.rb +1 -1
  93. data/spec/ruby_api_spec.rb +23 -0
  94. data/spec/spec_helper.rb +5 -4
  95. metadata +66 -66
  96. data/examples/CQL/OrienteeringER.cql +0 -58
  97. data/lib/activefacts/api.rb +0 -44
  98. data/lib/activefacts/api/concept.rb +0 -410
  99. data/lib/activefacts/api/constellation.rb +0 -128
  100. data/lib/activefacts/api/entity.rb +0 -256
  101. data/lib/activefacts/api/instance.rb +0 -60
  102. data/lib/activefacts/api/instance_index.rb +0 -80
  103. data/lib/activefacts/api/numeric.rb +0 -167
  104. data/lib/activefacts/api/role.rb +0 -80
  105. data/lib/activefacts/api/role_proxy.rb +0 -70
  106. data/lib/activefacts/api/role_values.rb +0 -117
  107. data/lib/activefacts/api/standard_types.rb +0 -87
  108. data/lib/activefacts/api/support.rb +0 -65
  109. data/lib/activefacts/api/value.rb +0 -135
  110. data/lib/activefacts/api/vocabulary.rb +0 -82
  111. data/spec/api/autocounter.rb +0 -82
  112. data/spec/api/constellation.rb +0 -130
  113. data/spec/api/entity_type.rb +0 -103
  114. data/spec/api/instance.rb +0 -461
  115. data/spec/api/roles.rb +0 -124
  116. data/spec/api/value_type.rb +0 -112
  117. data/spec/api_spec.rb +0 -13
  118. data/spec/cql/matching_spec.rb +0 -517
  119. data/spec/cql/unit_spec.rb +0 -394
  120. data/spec/spec.opts +0 -1
@@ -0,0 +1,63 @@
1
+ #
2
+ # ActiveFacts CQL Join Expressions
3
+ # Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
4
+ #
5
+
6
+ require 'rspec/expectations'
7
+
8
+ require 'activefacts/support'
9
+ require 'activefacts/api/support'
10
+ require 'activefacts/cql/compiler'
11
+ require 'spec/helpers/compile_helpers'
12
+
13
+ require 'ruby-debug'; Debugger.start
14
+
15
+ describe "When compiling expressions" do
16
+ before :each do
17
+ extend CompileHelpers
18
+
19
+ prefix = %q{
20
+ vocabulary Tests;
21
+ Name is written as String;
22
+ year/years converts to 365.25 day;
23
+ Age is written as Integer year;
24
+ Person is identified by its Name;
25
+ Person is of Age;
26
+
27
+ // Company is identified by its Name;
28
+ // Directorship is where Person directs Company;
29
+ }
30
+ @compiler = ActiveFacts::CQL::Compiler.new('Test')
31
+ @compiler.compile(prefix)
32
+ @constellation = @compiler.vocabulary.constellation
33
+
34
+ baseline
35
+ end
36
+
37
+ describe "expressions" do
38
+
39
+ it "should create appropriate fact types" do
40
+ compile %q{Person is of Age >= 3*(9+11)? }
41
+
42
+ new_fact_types = fact_types
43
+ # new_fact_types.each { |ft| puts "new fact type: #{ft.default_reading}" }
44
+ new_fact_types.size.should == 3
45
+ end
46
+
47
+ it "should create derived fact type and project the roles" do
48
+ compile %q{Person is old where Person is of Age >= 3*(9+11); }
49
+
50
+ new_fact_types = fact_types
51
+ # new_fact_types.each { |ft| puts "new fact type: #{ft.default_reading}" }
52
+ new_fact_types.size.should == 4
53
+
54
+ is_old_ft = new_fact_types.detect{|ft| ft.all_reading.detect{|r| r.text =~ /is old/} }
55
+ (is_old_ft.all_reading.map{ |r| r.expand }*', ').should == "Person is old"
56
+
57
+ comparison_ft = (new_fact_types - [is_old_ft])[0]
58
+ (comparison_ft.all_reading.map{ |r| r.expand }*', ').should == "Age >= product(Integer, sum(Integer, Integer))"
59
+
60
+ # one_join_with_value 60, 'year'
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,283 @@
1
+ #
2
+ # ActiveFacts CQL Fact Type matching tests
3
+ # Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
4
+ #
5
+
6
+ require 'rspec/expectations'
7
+
8
+ require 'activefacts/support'
9
+ require 'activefacts/api/support'
10
+ require 'activefacts/cql/compiler'
11
+ require 'spec/helpers/compile_helpers'
12
+
13
+ require 'ruby-debug'; Debugger.start
14
+
15
+ describe "When matching a reading" do
16
+ before :each do
17
+ extend CompileHelpers
18
+
19
+ prefix = %q{
20
+ vocabulary Tests;
21
+ Boy is written as String;
22
+ Girl is written as Integer;
23
+ }
24
+ @compiler = ActiveFacts::CQL::Compiler.new('Test')
25
+ @compiler.compile(prefix)
26
+ @constellation = @compiler.vocabulary.constellation
27
+
28
+ baseline
29
+ end
30
+
31
+ describe "with no existing fact type" do
32
+ it "should create a simple fact type" do
33
+ compile %q{Girl is going out with at most one Boy; }
34
+ (new_fact_types = fact_types).size.should == 1
35
+ (fact_type = new_fact_types[0]).all_reading.size.should == 1
36
+ (pcs = fact_pcs(fact_type)).size.should == 1
37
+ end
38
+
39
+ it "should create a simple fact type using an explicit adjective" do
40
+ compile %q{Girl is going out with at most one ugly-Boy;}
41
+ (new_fact_types = fact_types).size.should == 1
42
+ (fact_type = new_fact_types[0]).all_reading.size.should == 1
43
+ (pcs = fact_pcs(fact_type)).size.should == 1
44
+ end
45
+ end
46
+
47
+ describe "on an existing fact type" do
48
+ before :each do
49
+ #debug_enable("binding"); debug_enable("matching"); debug_enable("matching_fails"); debug_enable("parse")
50
+ end
51
+ after :each do
52
+ #debug_disable("binding"); debug_disable("matching"); debug_disable("matching_fails"); debug_disable("parse")
53
+ end
54
+
55
+ describe "with no adjectives or role names" do
56
+ before :each do
57
+ compile %q{Girl is going out with at most one Boy;}
58
+ # baseline
59
+ end
60
+
61
+ it "should recognise and add a reading" do
62
+ compile %q{
63
+ Girl is going out with Boy,
64
+ Boy is going out with Girl;
65
+ }
66
+ (new_fact_types = fact_types).size.should == 1
67
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
68
+ (pcs = fact_pcs(fact_type)).size.should == 1
69
+ end
70
+
71
+ it "should remove duplicate new readings" do
72
+ pending("duplicate new clauses cause an error") do
73
+ compile %q{
74
+ Girl is going out with Boy,
75
+ Girl is going out with Boy,
76
+ Boy is going out with Girl,
77
+ Boy is going out with Girl;
78
+ }
79
+ (new_fact_types = fact_types).size.should == 1
80
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
81
+ (pcs = fact_pcs(fact_type)).size.should == 1
82
+ end
83
+ end
84
+
85
+ it "should add new presence constraints" do
86
+ compile %q{
87
+ Girl is going out with Boy,
88
+ Boy is going out with at most one Girl;
89
+ }
90
+ (new_fact_types = fact_types).size.should == 1
91
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
92
+ (pcs = fact_pcs(fact_type)).size.should == 2
93
+ end
94
+
95
+ it "should add a new reading with a hyphenated word" do
96
+ compile %q{
97
+ Girl is going out with Boy,
98
+ Boy is out driving a semi-trailer with Girl;
99
+ }
100
+ (new_fact_types = fact_types).size.should == 1
101
+ (readings = (fact_type = new_fact_types[0]).all_reading.to_a).size.should == 2
102
+ readings.detect{|r| r.text =~ /semi-trailer/}.should be_true
103
+ (pcs = fact_pcs(fact_type)).size.should == 1
104
+ end
105
+
106
+ end
107
+
108
+ describe "with role names" do
109
+ before :each do
110
+ compile %q{Girl (as Girlfriend) is going out with at most one Boy;}
111
+ # baseline
112
+ end
113
+
114
+ it "should match role names" do
115
+ pending("duplicate new clauses cause an error") do
116
+ compile %q{
117
+ Girl (as Girlfriend) is going out with Boy,
118
+ Boy is going out with Girlfriend;
119
+ }
120
+ (new_fact_types = fact_types).size.should == 1
121
+ (fact_type = new_fact_types[0]).all_reading.size.should == 3
122
+ (pcs = fact_pcs(fact_type)).size.should == 2
123
+ end
124
+ end
125
+ end
126
+
127
+ describe "with a leading adjective" do
128
+ before :each do
129
+ compile %q{Girl is going out with at most one ugly-Boy;}
130
+ @fact_type = fact_types[0]
131
+ @initial_reading = fact_readings(@fact_type)[0]
132
+ # baseline
133
+ end
134
+
135
+ it "should not match without the adjective" do
136
+ baseline
137
+ compile %q{
138
+ Girl is going out with at most one Boy,
139
+ Boy is best friend of Girl;
140
+ }
141
+ (new_fact_types = fact_types).size.should == 1
142
+ new_fact_types[0].all_reading.size.should == 2
143
+ fact_pcs(new_fact_types[0]).size.should == 1
144
+ end
145
+
146
+ it "should not match without the adjective and with the new reading first" do
147
+ baseline
148
+ compile %q{
149
+ Boy is best friend of Girl,
150
+ Girl is going out with at most one Boy;
151
+ }
152
+ (new_fact_types = fact_types).size.should == 1
153
+ new_fact_types[0].all_reading.size.should == 2
154
+ fact_pcs(new_fact_types[0]).size.should == 1
155
+ end
156
+
157
+ it "should match using explicit adjective" do
158
+ compile %q{
159
+ Girl is going out with at most one ugly-Boy,
160
+ Boy is best friend of Girl;
161
+ }
162
+ (new_fact_types = fact_types).size.should == 1
163
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
164
+ (pcs = fact_pcs(fact_type)).size.should == 1
165
+ end
166
+
167
+ it "should match using implicit adjective" do
168
+ compile %q{
169
+ Girl is going out with ugly Boy,
170
+ ugly-Boy is best friend of Girl;
171
+ }
172
+ (new_fact_types = fact_types).size.should == 1
173
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
174
+ (pcs = fact_pcs(fact_type)).size.should == 1
175
+ end
176
+
177
+ it "should match using implicit adjective and new explicit trailing adjective" do
178
+ compile %q{
179
+ Girl is going out with ugly Boy-monster,
180
+ Boy monster is going out with Girl;
181
+ }
182
+ (new_fact_types = fact_types).size.should == 1
183
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
184
+ new_reading = (fact_readings(@fact_type) - [@initial_reading])[0]
185
+ new_reading.text.should == "{0} is going out with {1}"
186
+ new_reading.role_sequence.all_role_ref_in_order[0].trailing_adjective.should == "monster"
187
+ (pcs = fact_pcs(fact_type)).size.should == 1
188
+ end
189
+ end
190
+
191
+ describe "with a trailing adjective" do
192
+ before :each do
193
+ compile %q{Girl is going out with at most one Boy-monster;}
194
+ # baseline
195
+ end
196
+
197
+ it "should match using explicit adjective" do
198
+ compile %q{
199
+ Girl is going out with Boy-monster,
200
+ Boy is going out with Girl;
201
+ }
202
+ (new_fact_types = fact_types).size.should == 1
203
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
204
+ (pcs = fact_pcs(fact_type)).size.should == 1
205
+ end
206
+
207
+ it "should match using implicit adjective" do
208
+ compile %q{
209
+ Girl is going out with Boy monster,
210
+ Boy is going out with Girl;
211
+ }
212
+ (new_fact_types = fact_types).size.should == 1
213
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
214
+ (pcs = fact_pcs(fact_type)).size.should == 1
215
+ end
216
+
217
+ it "should match using implicit adjective and new explicit leading adjective" do
218
+ baseline
219
+ compile %q{
220
+ Girl is going out with ugly-Boy monster,
221
+ Boy is going out with Girl;
222
+ }
223
+ (new_fact_types = fact_types).size.should == 1
224
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
225
+ (pcs = fact_pcs(fact_type)).size.should == 1
226
+ end
227
+ end
228
+
229
+ describe "with double adjectives" do
230
+ before :each do
231
+ compile %q{Girl is going out with at most one ugly- bad Boy;}
232
+ # baseline
233
+ end
234
+
235
+ it "should match using explicit adjectives" do
236
+ compile %q{
237
+ Girl is going out with ugly- bad Boy,
238
+ ugly- bad Boy is going out with Girl;
239
+ }
240
+ (new_fact_types = fact_types).size.should == 1
241
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
242
+ (pcs = fact_pcs(fact_type)).size.should == 1
243
+ end
244
+
245
+ it "should match using implicit adjectives" do
246
+ compile %q{
247
+ Girl is going out with ugly bad Boy,
248
+ nasty- ugly bad Boy is going out with Girl;
249
+ }
250
+ (new_fact_types = fact_types).size.should == 1
251
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
252
+ (pcs = fact_pcs(fact_type)).size.should == 1
253
+ end
254
+ end
255
+
256
+ describe "with double trailing adjectives" do
257
+ before :each do
258
+ compile %q{Girl is going out with at most one Boy real -monster;}
259
+ # baseline
260
+ end
261
+
262
+ it "should match using explicit adjectives" do
263
+ compile %q{
264
+ Girl is going out with Boy real -monster,
265
+ Boy is going out with Girl;
266
+ }
267
+ (new_fact_types = fact_types).size.should == 1
268
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
269
+ (pcs = fact_pcs(fact_type)).size.should == 1
270
+ end
271
+
272
+ it "should match using implicit adjectives" do
273
+ compile %q{
274
+ Girl is going out with Boy real monster,
275
+ Boy is going out with Girl;
276
+ }
277
+ (new_fact_types = fact_types).size.should == 1
278
+ (fact_type = new_fact_types[0]).all_reading.size.should == 2
279
+ (pcs = fact_pcs(fact_type)).size.should == 1
280
+ end
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,21 @@
1
+
2
+
3
+ # Examples:
4
+ #
5
+ # Company has at most one postal-Address;
6
+ # CompanyContact is where Company has contact-Person;
7
+ # CompanyContact is the situation where Company has contact-Person;
8
+ # for each Company at least one of the following holds:
9
+ # that Company has some contact-Person,
10
+ # that Company has some mailing-Address and that mailing-Address includes PostCode;
11
+ #
12
+ # Entreprise is a synonym for English:Company;
13
+ # Entreprise est un synonyme pour English:Company;
14
+ # Personne is a synonym for English:Person;
15
+ #
16
+ # Entreprise a au plus une Adresse Postale;
17
+ # EntrepriseContact est quand un(e) Entreprise a Personnes comme -contact;
18
+ # pour chaque Entreprise au moins un des suivants s'applique:
19
+ # que cette Entreprise a certaines Personnes comme -contact,
20
+ # que cette Entreprise a certaines Adresses Postales et que ces Adresses Postales ont un Code Postale;
21
+ #
@@ -0,0 +1,86 @@
1
+ #
2
+ # ActiveFacts tests: Test the CQL parser by looking at its parse trees.
3
+ # Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
4
+ #
5
+
6
+ require 'activefacts/cql'
7
+ require 'activefacts/support'
8
+ require 'activefacts/api/support'
9
+ require 'spec_helper'
10
+ require 'helpers/test_parser'
11
+
12
+ describe "Parsing Invalid Numbers and Strings" do
13
+ it "should fail to parse an octal number containing non-octal digits" do
14
+ "a is written as b(08);".
15
+ should fail_to_parse /Expected (.|\n)* after a is written as b\(0$/
16
+ end
17
+
18
+ it "should fail to parse a hexadecimal number containing non-hexadecimal digits" do
19
+ "a is written as b(0xDice);".
20
+ should fail_to_parse /Expected (.|\n)* after a is written as b\(0$/
21
+ end
22
+
23
+ it "should fail to parse a negative number with an intervening space" do
24
+ "a is written as b(- 1);".
25
+ should fail_to_parse /Expected .* after a is written as b\(/
26
+ end
27
+
28
+ it "should fail to parse an explicit positive number with an intervening space" do
29
+ "a is written as b(+ 1);".
30
+ should fail_to_parse /Expected .* after a is written as b\(/
31
+ end
32
+
33
+ it "should fail to parse a negative octal number" do
34
+ "a is written as b(-077);".
35
+ should fail_to_parse /Expected .* after a is written as b\(/
36
+ end
37
+
38
+ it "should fail to parse a negative hexadecimal number" do
39
+ "a is written as b(-0xFace);".
40
+ should fail_to_parse /Expected .* after a is written as b\(/
41
+ end
42
+
43
+ it "should fail to parse invalid real numbers (no digits before or nonzero after the point)" do
44
+ "a is written as b(.0);".
45
+ should fail_to_parse /Expected .* after a is written as b\(/
46
+ end
47
+
48
+ it "should fail to parse invalid real numbers (no digits after or nonzero before the point)" do
49
+ "a is written as b(0.);".
50
+ should fail_to_parse /Expected .* after a is written as b\(/
51
+ end
52
+
53
+ it "should fail to parse a number with illegal whitespace before the exponent" do
54
+ "inch converts to 1 inch; a is written as b() inch ^2 ; ".
55
+ should fail_to_parse /Expected .* after a is written as b\(\) inch/
56
+ end
57
+
58
+ it "should fail to parse a number with illegal whitespace around the exponent" do
59
+ "inch converts to 1 inch; a is written as b() inch^ 2 ; ".
60
+ should fail_to_parse /Expected .* after a is written as b\(\) inch/
61
+ end
62
+
63
+ it "should fail to parse a string with an illegal octal escape" do
64
+ "a is written as b() restricted to { '\\7a' };".
65
+ should fail_to_parse /Expected .* a is written as b\(\) restricted to \{ '/
66
+ end
67
+
68
+ it "should fail to parse a string with a control character" do
69
+ "a is written as b() restricted to { '\001' };".
70
+ should fail_to_parse /Expected .* a is written as b\(\) restricted to \{ '/
71
+ end
72
+
73
+ it "should fail to parse a string with a control character" do
74
+ "a is written as b() restricted to { '\n' };".
75
+ should fail_to_parse /Expected .* a is written as b\(\) restricted to \{ '/
76
+ end
77
+
78
+ it "should fail to parse a cross-typed range" do
79
+ "a is written as b() restricted to { 0..'A' };".
80
+ should fail_to_parse /Expected .* after a is written as b\(\) restricted to \{ 0\.\./
81
+
82
+ "a is written as b() restricted to { 'a'..27 };".
83
+ should fail_to_parse /Expected .* after a is written as b\(\) restricted to \{ 'a'\.\./
84
+ end
85
+
86
+ end