calabash-android 0.4.0.pre4 → 0.4.0.pre5

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.
@@ -5,9 +5,7 @@ def calabash_console(app_path = nil)
5
5
  ENV["TEST_SERVER_PORT"] = "34777"
6
6
  end
7
7
 
8
- unless ENV["IRBRC"]
9
- ENV["IRBRC"] = File.join(File.dirname(__FILE__), '..', 'irbrc')
10
- end
8
+ ENV["IRBRC"] = File.join(File.dirname(__FILE__), '..', 'irbrc')
11
9
 
12
10
  unless ENV["PACKAGE_NAME"]
13
11
  ENV["PACKAGE_NAME"] = package_name(app_path)
@@ -116,6 +116,7 @@ def fingerprint_from_apk(app_path)
116
116
  end
117
117
 
118
118
  def extract_md5_fingerprint(fingerprints)
119
+ fingerprints = fingerprints.gsub("\xA0", "")
119
120
  m = fingerprints.scan(/MD5\s*:\s*((?:\h\h:){15}\h\h)/).flatten
120
121
  raise "No MD5 fingerprint found:\n #{fingerprints}" if m.empty?
121
122
  m.first
@@ -23,7 +23,7 @@ module Operations
23
23
  end
24
24
 
25
25
  def macro(txt)
26
- if self.respond_to?:step
26
+ if self.respond_to?(:step)
27
27
  step(txt)
28
28
  else
29
29
  Then(txt)
@@ -57,7 +57,7 @@ module Operations
57
57
  default_device.clear_app_data
58
58
  end
59
59
 
60
- def start_test_server_in_background
60
+ def start_test_server_in_background(options={})
61
61
  default_device.start_test_server_in_background()
62
62
  end
63
63
 
@@ -86,7 +86,7 @@ module Operations
86
86
  value = nil
87
87
  begin
88
88
  Timeout::timeout(timeout) do
89
- until value = block.call
89
+ until (value = block.call)
90
90
  sleep 0.3
91
91
  end
92
92
  end
@@ -313,14 +313,30 @@ module Operations
313
313
  raise "Could not clear data" unless system(cmd)
314
314
  end
315
315
 
316
- def start_test_server_in_background
316
+ def start_test_server_in_background(options={})
317
317
  raise "Will not start test server because of previous failures." if Cucumber.wants_to_quit
318
318
 
319
319
  if keyguard_enabled?
320
320
  wake_up
321
321
  end
322
322
 
323
- cmd = "#{adb_command} shell am instrument -e target_package #{ENV["PACKAGE_NAME"]} -e main_activity #{ENV["MAIN_ACTIVITY"]} -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
323
+ env_options = {:target_package => options[:target_package] || ENV["PACKAGE_NAME"],
324
+ :main_activity => options[:main_activity] || ENV["MAIN_ACTIVITY"],
325
+ :debug => options[:debug] || false,
326
+ :class => options[:class] || "sh.calaba.instrumentationbackend.InstrumentationBackend"}
327
+
328
+ cmd_arr = [adb_command, "shell am instrument"]
329
+
330
+ env_options.each_pair do |key, val|
331
+ cmd_arr << "-e"
332
+ cmd_arr << key.to_s
333
+ cmd_arr << val.to_s
334
+ end
335
+
336
+ cmd_arr << "sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
337
+
338
+ cmd = cmd_arr.join(" ")
339
+
324
340
  log "Starting test server using:"
325
341
  log cmd
326
342
  raise "Could not execute command to start test server" unless system("#{cmd} 2>&1")
@@ -453,12 +469,16 @@ module Operations
453
469
  ni
454
470
  end
455
471
 
472
+ def element_does_not_exist(uiquery)
473
+ query(uiquery).empty?
474
+ end
475
+
456
476
  def element_exists(uiquery)
457
- !query(uiquery).empty?
477
+ not element_does_not_exist(uiquery)
458
478
  end
459
479
 
460
480
  def view_with_mark_exists(expected_mark)
461
- element_exists( "view marked:'#{expected_mark}'" )
481
+ element_exists( "android.view.View marked:'#{expected_mark}'" )
462
482
  end
463
483
 
464
484
  def check_element_exists( query )
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.0.pre4"
3
+ VERSION = "0.4.0.pre5"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  <uses-sdk android:minSdkVersion="6" />
8
8
 
9
- <application android:label="CalabashTestServer" >
9
+ <application android:label="CalabashTestServer" android:debuggable="true">
10
10
  <uses-library android:name="android.test.runner" />
11
11
  <uses-library android:name="com.google.android.maps" android:required="false" />
12
12
  </application>
@@ -12,6 +12,24 @@ options {
12
12
  package sh.calaba.instrumentationbackend.query.antlr;
13
13
  }
14
14
 
15
+ @members {
16
+ public String getErrorMessage(RecognitionException e, String[] tokenNames)
17
+ {
18
+ List stack = getRuleInvocationStack(e, this.getClass().getName());
19
+ String msg = null;
20
+ if ( e instanceof NoViableAltException ) {
21
+ NoViableAltException nvae = (NoViableAltException)e;
22
+ msg = " no viable alt; token="+e.token+" (decision="+nvae.decisionNumber+" state "+nvae.stateNumber+")"+" decision=<<"+nvae.grammarDecisionDescription+">>";
23
+ }
24
+ else {
25
+ msg = super.getErrorMessage(e, tokenNames);
26
+ }
27
+ return stack+" "+msg;
28
+ }
29
+ public String getTokenErrorDisplay(Token t) {
30
+ return t.toString();
31
+ }
32
+ }
15
33
 
16
34
  query : expr (WHITE! expr)*
17
35
  ;
@@ -43,16 +61,16 @@ NAME : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
43
61
  ;
44
62
 
45
63
  STRING
46
- : '\'' ( ESC_SEQ | ~('\\'|'"') )* '\''
64
+ : '\'' ( ESC_SEQ | ~('\\'|'\'') )* '\''
47
65
  ;
48
66
 
49
- WHITE : ' '* ;
67
+ WHITE : ' '+ ;
50
68
  fragment
51
69
  HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
52
70
 
53
71
  fragment
54
72
  ESC_SEQ
55
- : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
73
+ : '\\' ('b'|'t'|'n'|'f'|'r'|'\''|'\\')
56
74
  | UNICODE_ESC
57
75
  | OCTAL_ESC
58
76
  ;
@@ -90,7 +90,9 @@ public class Query {
90
90
  Set<View> parents = new HashSet<View>(8);
91
91
  for (View v : allVisibleViews())
92
92
  {
93
- parents.add(viewFetcher.getTopParent(v));
93
+ View parent = viewFetcher.getTopParent(v);
94
+ System.out.println(parent);
95
+ parents.add(parent);
94
96
  }
95
97
  List<View> results = new ArrayList<View>();
96
98
  results.addAll(parents);
@@ -1,4 +1,4 @@
1
- // $ANTLR 3.4 antlr/UIQuery.g 2012-12-14 14:03:36
1
+ // $ANTLR 3.4 antlr/UIQuery.g 2012-12-27 13:48:21
2
2
 
3
3
  package sh.calaba.instrumentationbackend.query.antlr;
4
4
 
@@ -44,13 +44,13 @@ public class UIQueryLexer extends Lexer {
44
44
  try {
45
45
  int _type = QUALIFIED_NAME;
46
46
  int _channel = DEFAULT_TOKEN_CHANNEL;
47
- // antlr/UIQuery.g:25:16: ( NAME ( '.' NAME )+ )
48
- // antlr/UIQuery.g:25:18: NAME ( '.' NAME )+
47
+ // antlr/UIQuery.g:43:16: ( NAME ( '.' NAME )+ )
48
+ // antlr/UIQuery.g:43:18: NAME ( '.' NAME )+
49
49
  {
50
50
  mNAME();
51
51
 
52
52
 
53
- // antlr/UIQuery.g:25:23: ( '.' NAME )+
53
+ // antlr/UIQuery.g:43:23: ( '.' NAME )+
54
54
  int cnt1=0;
55
55
  loop1:
56
56
  do {
@@ -64,7 +64,7 @@ public class UIQueryLexer extends Lexer {
64
64
 
65
65
  switch (alt1) {
66
66
  case 1 :
67
- // antlr/UIQuery.g:25:24: '.' NAME
67
+ // antlr/UIQuery.g:43:24: '.' NAME
68
68
  {
69
69
  match('.');
70
70
 
@@ -100,8 +100,8 @@ public class UIQueryLexer extends Lexer {
100
100
  try {
101
101
  int _type = FILTER_COLON;
102
102
  int _channel = DEFAULT_TOKEN_CHANNEL;
103
- // antlr/UIQuery.g:29:15: ( ':' )
104
- // antlr/UIQuery.g:29:17: ':'
103
+ // antlr/UIQuery.g:47:15: ( ':' )
104
+ // antlr/UIQuery.g:47:17: ':'
105
105
  {
106
106
  match(':');
107
107
 
@@ -121,10 +121,10 @@ public class UIQueryLexer extends Lexer {
121
121
  try {
122
122
  int _type = INT;
123
123
  int _channel = DEFAULT_TOKEN_CHANNEL;
124
- // antlr/UIQuery.g:33:5: ( ( '0' .. '9' )+ )
125
- // antlr/UIQuery.g:33:7: ( '0' .. '9' )+
124
+ // antlr/UIQuery.g:51:5: ( ( '0' .. '9' )+ )
125
+ // antlr/UIQuery.g:51:7: ( '0' .. '9' )+
126
126
  {
127
- // antlr/UIQuery.g:33:7: ( '0' .. '9' )+
127
+ // antlr/UIQuery.g:51:7: ( '0' .. '9' )+
128
128
  int cnt2=0;
129
129
  loop2:
130
130
  do {
@@ -179,7 +179,7 @@ public class UIQueryLexer extends Lexer {
179
179
  try {
180
180
  int _type = BOOL;
181
181
  int _channel = DEFAULT_TOKEN_CHANNEL;
182
- // antlr/UIQuery.g:36:6: ( 'true' | 'false' )
182
+ // antlr/UIQuery.g:54:6: ( 'true' | 'false' )
183
183
  int alt3=2;
184
184
  int LA3_0 = input.LA(1);
185
185
 
@@ -198,7 +198,7 @@ public class UIQueryLexer extends Lexer {
198
198
  }
199
199
  switch (alt3) {
200
200
  case 1 :
201
- // antlr/UIQuery.g:36:8: 'true'
201
+ // antlr/UIQuery.g:54:8: 'true'
202
202
  {
203
203
  match("true");
204
204
 
@@ -207,7 +207,7 @@ public class UIQueryLexer extends Lexer {
207
207
  }
208
208
  break;
209
209
  case 2 :
210
- // antlr/UIQuery.g:36:17: 'false'
210
+ // antlr/UIQuery.g:54:17: 'false'
211
211
  {
212
212
  match("false");
213
213
 
@@ -231,7 +231,7 @@ public class UIQueryLexer extends Lexer {
231
231
  try {
232
232
  int _type = NIL;
233
233
  int _channel = DEFAULT_TOKEN_CHANNEL;
234
- // antlr/UIQuery.g:39:5: ( 'nil' | 'null' )
234
+ // antlr/UIQuery.g:57:5: ( 'nil' | 'null' )
235
235
  int alt4=2;
236
236
  int LA4_0 = input.LA(1);
237
237
 
@@ -261,7 +261,7 @@ public class UIQueryLexer extends Lexer {
261
261
  }
262
262
  switch (alt4) {
263
263
  case 1 :
264
- // antlr/UIQuery.g:39:7: 'nil'
264
+ // antlr/UIQuery.g:57:7: 'nil'
265
265
  {
266
266
  match("nil");
267
267
 
@@ -270,7 +270,7 @@ public class UIQueryLexer extends Lexer {
270
270
  }
271
271
  break;
272
272
  case 2 :
273
- // antlr/UIQuery.g:39:15: 'null'
273
+ // antlr/UIQuery.g:57:15: 'null'
274
274
  {
275
275
  match("null");
276
276
 
@@ -294,8 +294,8 @@ public class UIQueryLexer extends Lexer {
294
294
  try {
295
295
  int _type = NAME;
296
296
  int _channel = DEFAULT_TOKEN_CHANNEL;
297
- // antlr/UIQuery.g:42:7: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* )
298
- // antlr/UIQuery.g:42:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*
297
+ // antlr/UIQuery.g:60:7: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* )
298
+ // antlr/UIQuery.g:60:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*
299
299
  {
300
300
  if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
301
301
  input.consume();
@@ -307,7 +307,7 @@ public class UIQueryLexer extends Lexer {
307
307
  }
308
308
 
309
309
 
310
- // antlr/UIQuery.g:42:33: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*
310
+ // antlr/UIQuery.g:60:33: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*
311
311
  loop5:
312
312
  do {
313
313
  int alt5=2;
@@ -357,37 +357,28 @@ public class UIQueryLexer extends Lexer {
357
357
  try {
358
358
  int _type = STRING;
359
359
  int _channel = DEFAULT_TOKEN_CHANNEL;
360
- // antlr/UIQuery.g:46:5: ( '\\'' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\\'' )
361
- // antlr/UIQuery.g:46:8: '\\'' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\\''
360
+ // antlr/UIQuery.g:64:5: ( '\\'' ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )* '\\'' )
361
+ // antlr/UIQuery.g:64:8: '\\'' ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )* '\\''
362
362
  {
363
363
  match('\'');
364
364
 
365
- // antlr/UIQuery.g:46:13: ( ESC_SEQ |~ ( '\\\\' | '\"' ) )*
365
+ // antlr/UIQuery.g:64:13: ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )*
366
366
  loop6:
367
367
  do {
368
368
  int alt6=3;
369
369
  int LA6_0 = input.LA(1);
370
370
 
371
- if ( (LA6_0=='\'') ) {
372
- int LA6_1 = input.LA(2);
373
-
374
- if ( ((LA6_1 >= '\u0000' && LA6_1 <= '!')||(LA6_1 >= '#' && LA6_1 <= '\uFFFF')) ) {
375
- alt6=2;
376
- }
377
-
378
-
379
- }
380
- else if ( (LA6_0=='\\') ) {
371
+ if ( (LA6_0=='\\') ) {
381
372
  alt6=1;
382
373
  }
383
- else if ( ((LA6_0 >= '\u0000' && LA6_0 <= '!')||(LA6_0 >= '#' && LA6_0 <= '&')||(LA6_0 >= '(' && LA6_0 <= '[')||(LA6_0 >= ']' && LA6_0 <= '\uFFFF')) ) {
374
+ else if ( ((LA6_0 >= '\u0000' && LA6_0 <= '&')||(LA6_0 >= '(' && LA6_0 <= '[')||(LA6_0 >= ']' && LA6_0 <= '\uFFFF')) ) {
384
375
  alt6=2;
385
376
  }
386
377
 
387
378
 
388
379
  switch (alt6) {
389
380
  case 1 :
390
- // antlr/UIQuery.g:46:15: ESC_SEQ
381
+ // antlr/UIQuery.g:64:15: ESC_SEQ
391
382
  {
392
383
  mESC_SEQ();
393
384
 
@@ -395,9 +386,9 @@ public class UIQueryLexer extends Lexer {
395
386
  }
396
387
  break;
397
388
  case 2 :
398
- // antlr/UIQuery.g:46:25: ~ ( '\\\\' | '\"' )
389
+ // antlr/UIQuery.g:64:25: ~ ( '\\\\' | '\\'' )
399
390
  {
400
- if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
391
+ if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&')||(input.LA(1) >= '(' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
401
392
  input.consume();
402
393
  }
403
394
  else {
@@ -434,10 +425,11 @@ public class UIQueryLexer extends Lexer {
434
425
  try {
435
426
  int _type = WHITE;
436
427
  int _channel = DEFAULT_TOKEN_CHANNEL;
437
- // antlr/UIQuery.g:49:9: ( ( ' ' )* )
438
- // antlr/UIQuery.g:49:11: ( ' ' )*
428
+ // antlr/UIQuery.g:67:9: ( ( ' ' )+ )
429
+ // antlr/UIQuery.g:67:11: ( ' ' )+
439
430
  {
440
- // antlr/UIQuery.g:49:11: ( ' ' )*
431
+ // antlr/UIQuery.g:67:11: ( ' ' )+
432
+ int cnt7=0;
441
433
  loop7:
442
434
  do {
443
435
  int alt7=2;
@@ -450,7 +442,7 @@ public class UIQueryLexer extends Lexer {
450
442
 
451
443
  switch (alt7) {
452
444
  case 1 :
453
- // antlr/UIQuery.g:49:11: ' '
445
+ // antlr/UIQuery.g:67:11: ' '
454
446
  {
455
447
  match(' ');
456
448
 
@@ -458,8 +450,12 @@ public class UIQueryLexer extends Lexer {
458
450
  break;
459
451
 
460
452
  default :
461
- break loop7;
453
+ if ( cnt7 >= 1 ) break loop7;
454
+ EarlyExitException eee =
455
+ new EarlyExitException(7, input);
456
+ throw eee;
462
457
  }
458
+ cnt7++;
463
459
  } while (true);
464
460
 
465
461
 
@@ -477,7 +473,7 @@ public class UIQueryLexer extends Lexer {
477
473
  // $ANTLR start "HEX_DIGIT"
478
474
  public final void mHEX_DIGIT() throws RecognitionException {
479
475
  try {
480
- // antlr/UIQuery.g:52:11: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
476
+ // antlr/UIQuery.g:70:11: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
481
477
  // antlr/UIQuery.g:
482
478
  {
483
479
  if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
@@ -503,13 +499,12 @@ public class UIQueryLexer extends Lexer {
503
499
  // $ANTLR start "ESC_SEQ"
504
500
  public final void mESC_SEQ() throws RecognitionException {
505
501
  try {
506
- // antlr/UIQuery.g:56:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UNICODE_ESC | OCTAL_ESC )
502
+ // antlr/UIQuery.g:74:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\'' | '\\\\' ) | UNICODE_ESC | OCTAL_ESC )
507
503
  int alt8=3;
508
504
  int LA8_0 = input.LA(1);
509
505
 
510
506
  if ( (LA8_0=='\\') ) {
511
507
  switch ( input.LA(2) ) {
512
- case '\"':
513
508
  case '\'':
514
509
  case '\\':
515
510
  case 'b':
@@ -556,11 +551,11 @@ public class UIQueryLexer extends Lexer {
556
551
  }
557
552
  switch (alt8) {
558
553
  case 1 :
559
- // antlr/UIQuery.g:56:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
554
+ // antlr/UIQuery.g:74:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\'' | '\\\\' )
560
555
  {
561
556
  match('\\');
562
557
 
563
- if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
558
+ if ( input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
564
559
  input.consume();
565
560
  }
566
561
  else {
@@ -573,7 +568,7 @@ public class UIQueryLexer extends Lexer {
573
568
  }
574
569
  break;
575
570
  case 2 :
576
- // antlr/UIQuery.g:57:9: UNICODE_ESC
571
+ // antlr/UIQuery.g:75:9: UNICODE_ESC
577
572
  {
578
573
  mUNICODE_ESC();
579
574
 
@@ -581,7 +576,7 @@ public class UIQueryLexer extends Lexer {
581
576
  }
582
577
  break;
583
578
  case 3 :
584
- // antlr/UIQuery.g:58:9: OCTAL_ESC
579
+ // antlr/UIQuery.g:76:9: OCTAL_ESC
585
580
  {
586
581
  mOCTAL_ESC();
587
582
 
@@ -601,7 +596,7 @@ public class UIQueryLexer extends Lexer {
601
596
  // $ANTLR start "OCTAL_ESC"
602
597
  public final void mOCTAL_ESC() throws RecognitionException {
603
598
  try {
604
- // antlr/UIQuery.g:63:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
599
+ // antlr/UIQuery.g:81:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
605
600
  int alt9=3;
606
601
  int LA9_0 = input.LA(1);
607
602
 
@@ -652,7 +647,7 @@ public class UIQueryLexer extends Lexer {
652
647
  }
653
648
  switch (alt9) {
654
649
  case 1 :
655
- // antlr/UIQuery.g:63:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
650
+ // antlr/UIQuery.g:81:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
656
651
  {
657
652
  match('\\');
658
653
 
@@ -689,7 +684,7 @@ public class UIQueryLexer extends Lexer {
689
684
  }
690
685
  break;
691
686
  case 2 :
692
- // antlr/UIQuery.g:64:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
687
+ // antlr/UIQuery.g:82:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
693
688
  {
694
689
  match('\\');
695
690
 
@@ -716,7 +711,7 @@ public class UIQueryLexer extends Lexer {
716
711
  }
717
712
  break;
718
713
  case 3 :
719
- // antlr/UIQuery.g:65:9: '\\\\' ( '0' .. '7' )
714
+ // antlr/UIQuery.g:83:9: '\\\\' ( '0' .. '7' )
720
715
  {
721
716
  match('\\');
722
717
 
@@ -745,8 +740,8 @@ public class UIQueryLexer extends Lexer {
745
740
  // $ANTLR start "UNICODE_ESC"
746
741
  public final void mUNICODE_ESC() throws RecognitionException {
747
742
  try {
748
- // antlr/UIQuery.g:70:5: ( '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
749
- // antlr/UIQuery.g:70:9: '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
743
+ // antlr/UIQuery.g:88:5: ( '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
744
+ // antlr/UIQuery.g:88:9: '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
750
745
  {
751
746
  match('\\');
752
747
 
@@ -851,12 +846,12 @@ public class UIQueryLexer extends Lexer {
851
846
 
852
847
  protected DFA10 dfa10 = new DFA10(this);
853
848
  static final String DFA10_eotS =
854
- "\1\10\1\13\2\uffff\3\13\2\uffff\2\13\2\uffff\5\13\1\26\1\13\1\30"+
855
- "\1\13\1\uffff\1\26\1\uffff\1\30";
849
+ "\1\uffff\1\13\2\uffff\3\13\2\uffff\2\13\2\uffff\5\13\1\26\1\13\1"+
850
+ "\30\1\13\1\uffff\1\26\1\uffff\1\30";
856
851
  static final String DFA10_eofS =
857
852
  "\32\uffff";
858
853
  static final String DFA10_minS =
859
- "\1\47\1\56\2\uffff\3\56\2\uffff\2\56\2\uffff\11\56\1\uffff\1\56"+
854
+ "\1\40\1\56\2\uffff\3\56\2\uffff\2\56\2\uffff\11\56\1\uffff\1\56"+
860
855
  "\1\uffff\1\56";
861
856
  static final String DFA10_maxS =
862
857
  "\2\172\2\uffff\3\172\2\uffff\2\172\2\uffff\11\172\1\uffff\1\172"+
@@ -867,8 +862,8 @@ public class UIQueryLexer extends Lexer {
867
862
  static final String DFA10_specialS =
868
863
  "\32\uffff}>";
869
864
  static final String[] DFA10_transitionS = {
870
- "\1\7\10\uffff\12\3\1\2\6\uffff\32\6\4\uffff\1\6\1\uffff\5\6"+
871
- "\1\4\7\6\1\5\5\6\1\1\6\6",
865
+ "\1\10\6\uffff\1\7\10\uffff\12\3\1\2\6\uffff\32\6\4\uffff\1\6"+
866
+ "\1\uffff\5\6\1\4\7\6\1\5\5\6\1\1\6\6",
872
867
  "\1\14\1\uffff\12\12\7\uffff\32\12\4\uffff\1\12\1\uffff\21\12"+
873
868
  "\1\11\10\12",
874
869
  "",
@@ -1,4 +1,4 @@
1
- // $ANTLR 3.4 antlr/UIQuery.g 2012-12-14 14:03:36
1
+ // $ANTLR 3.4 antlr/UIQuery.g 2012-12-27 13:48:21
2
2
 
3
3
  package sh.calaba.instrumentationbackend.query.antlr;
4
4
 
@@ -58,6 +58,24 @@ public TreeAdaptor getTreeAdaptor() {
58
58
  public String getGrammarFileName() { return "antlr/UIQuery.g"; }
59
59
 
60
60
 
61
+ public String getErrorMessage(RecognitionException e, String[] tokenNames)
62
+ {
63
+ List stack = getRuleInvocationStack(e, this.getClass().getName());
64
+ String msg = null;
65
+ if ( e instanceof NoViableAltException ) {
66
+ NoViableAltException nvae = (NoViableAltException)e;
67
+ msg = " no viable alt; token="+e.token+" (decision="+nvae.decisionNumber+" state "+nvae.stateNumber+")"+" decision=<<"+nvae.grammarDecisionDescription+">>";
68
+ }
69
+ else {
70
+ msg = super.getErrorMessage(e, tokenNames);
71
+ }
72
+ return stack+" "+msg;
73
+ }
74
+ public String getTokenErrorDisplay(Token t) {
75
+ return t.toString();
76
+ }
77
+
78
+
61
79
  public static class query_return extends ParserRuleReturnScope {
62
80
  CommonTree tree;
63
81
  public Object getTree() { return tree; }
@@ -65,7 +83,7 @@ public TreeAdaptor getTreeAdaptor() {
65
83
 
66
84
 
67
85
  // $ANTLR start "query"
68
- // antlr/UIQuery.g:16:1: query : expr ( WHITE ! expr )* ;
86
+ // antlr/UIQuery.g:34:1: query : expr ( WHITE ! expr )* ;
69
87
  public final UIQueryParser.query_return query() throws RecognitionException {
70
88
  UIQueryParser.query_return retval = new UIQueryParser.query_return();
71
89
  retval.start = input.LT(1);
@@ -82,20 +100,20 @@ public TreeAdaptor getTreeAdaptor() {
82
100
  CommonTree WHITE2_tree=null;
83
101
 
84
102
  try {
85
- // antlr/UIQuery.g:16:7: ( expr ( WHITE ! expr )* )
86
- // antlr/UIQuery.g:16:9: expr ( WHITE ! expr )*
103
+ // antlr/UIQuery.g:34:7: ( expr ( WHITE ! expr )* )
104
+ // antlr/UIQuery.g:34:9: expr ( WHITE ! expr )*
87
105
  {
88
106
  root_0 = (CommonTree)adaptor.nil();
89
107
 
90
108
 
91
- pushFollow(FOLLOW_expr_in_query48);
109
+ pushFollow(FOLLOW_expr_in_query53);
92
110
  expr1=expr();
93
111
 
94
112
  state._fsp--;
95
113
 
96
114
  adaptor.addChild(root_0, expr1.getTree());
97
115
 
98
- // antlr/UIQuery.g:16:14: ( WHITE ! expr )*
116
+ // antlr/UIQuery.g:34:14: ( WHITE ! expr )*
99
117
  loop1:
100
118
  do {
101
119
  int alt1=2;
@@ -108,11 +126,11 @@ public TreeAdaptor getTreeAdaptor() {
108
126
 
109
127
  switch (alt1) {
110
128
  case 1 :
111
- // antlr/UIQuery.g:16:15: WHITE ! expr
129
+ // antlr/UIQuery.g:34:15: WHITE ! expr
112
130
  {
113
- WHITE2=(Token)match(input,WHITE,FOLLOW_WHITE_in_query51);
131
+ WHITE2=(Token)match(input,WHITE,FOLLOW_WHITE_in_query56);
114
132
 
115
- pushFollow(FOLLOW_expr_in_query54);
133
+ pushFollow(FOLLOW_expr_in_query59);
116
134
  expr3=expr();
117
135
 
118
136
  state._fsp--;
@@ -159,7 +177,7 @@ public TreeAdaptor getTreeAdaptor() {
159
177
 
160
178
 
161
179
  // $ANTLR start "expr"
162
- // antlr/UIQuery.g:20:1: expr : ( className | filter ) ;
180
+ // antlr/UIQuery.g:38:1: expr : ( className | filter ) ;
163
181
  public final UIQueryParser.expr_return expr() throws RecognitionException {
164
182
  UIQueryParser.expr_return retval = new UIQueryParser.expr_return();
165
183
  retval.start = input.LT(1);
@@ -174,13 +192,13 @@ public TreeAdaptor getTreeAdaptor() {
174
192
 
175
193
 
176
194
  try {
177
- // antlr/UIQuery.g:20:6: ( ( className | filter ) )
178
- // antlr/UIQuery.g:20:8: ( className | filter )
195
+ // antlr/UIQuery.g:38:6: ( ( className | filter ) )
196
+ // antlr/UIQuery.g:38:8: ( className | filter )
179
197
  {
180
198
  root_0 = (CommonTree)adaptor.nil();
181
199
 
182
200
 
183
- // antlr/UIQuery.g:20:8: ( className | filter )
201
+ // antlr/UIQuery.g:38:8: ( className | filter )
184
202
  int alt2=2;
185
203
  int LA2_0 = input.LA(1);
186
204
 
@@ -213,9 +231,9 @@ public TreeAdaptor getTreeAdaptor() {
213
231
  }
214
232
  switch (alt2) {
215
233
  case 1 :
216
- // antlr/UIQuery.g:20:9: className
234
+ // antlr/UIQuery.g:38:9: className
217
235
  {
218
- pushFollow(FOLLOW_className_in_expr72);
236
+ pushFollow(FOLLOW_className_in_expr77);
219
237
  className4=className();
220
238
 
221
239
  state._fsp--;
@@ -225,9 +243,9 @@ public TreeAdaptor getTreeAdaptor() {
225
243
  }
226
244
  break;
227
245
  case 2 :
228
- // antlr/UIQuery.g:20:21: filter
246
+ // antlr/UIQuery.g:38:21: filter
229
247
  {
230
- pushFollow(FOLLOW_filter_in_expr76);
248
+ pushFollow(FOLLOW_filter_in_expr81);
231
249
  filter5=filter();
232
250
 
233
251
  state._fsp--;
@@ -271,7 +289,7 @@ public TreeAdaptor getTreeAdaptor() {
271
289
 
272
290
 
273
291
  // $ANTLR start "className"
274
- // antlr/UIQuery.g:23:1: className : ( NAME ^| QUALIFIED_NAME ^) ;
292
+ // antlr/UIQuery.g:41:1: className : ( NAME ^| QUALIFIED_NAME ^) ;
275
293
  public final UIQueryParser.className_return className() throws RecognitionException {
276
294
  UIQueryParser.className_return retval = new UIQueryParser.className_return();
277
295
  retval.start = input.LT(1);
@@ -286,13 +304,13 @@ public TreeAdaptor getTreeAdaptor() {
286
304
  CommonTree QUALIFIED_NAME7_tree=null;
287
305
 
288
306
  try {
289
- // antlr/UIQuery.g:23:13: ( ( NAME ^| QUALIFIED_NAME ^) )
290
- // antlr/UIQuery.g:23:17: ( NAME ^| QUALIFIED_NAME ^)
307
+ // antlr/UIQuery.g:41:13: ( ( NAME ^| QUALIFIED_NAME ^) )
308
+ // antlr/UIQuery.g:41:17: ( NAME ^| QUALIFIED_NAME ^)
291
309
  {
292
310
  root_0 = (CommonTree)adaptor.nil();
293
311
 
294
312
 
295
- // antlr/UIQuery.g:23:17: ( NAME ^| QUALIFIED_NAME ^)
313
+ // antlr/UIQuery.g:41:17: ( NAME ^| QUALIFIED_NAME ^)
296
314
  int alt3=2;
297
315
  int LA3_0 = input.LA(1);
298
316
 
@@ -311,9 +329,9 @@ public TreeAdaptor getTreeAdaptor() {
311
329
  }
312
330
  switch (alt3) {
313
331
  case 1 :
314
- // antlr/UIQuery.g:23:18: NAME ^
332
+ // antlr/UIQuery.g:41:18: NAME ^
315
333
  {
316
- NAME6=(Token)match(input,NAME,FOLLOW_NAME_in_className94);
334
+ NAME6=(Token)match(input,NAME,FOLLOW_NAME_in_className99);
317
335
  NAME6_tree =
318
336
  (CommonTree)adaptor.create(NAME6)
319
337
  ;
@@ -323,9 +341,9 @@ public TreeAdaptor getTreeAdaptor() {
323
341
  }
324
342
  break;
325
343
  case 2 :
326
- // antlr/UIQuery.g:23:26: QUALIFIED_NAME ^
344
+ // antlr/UIQuery.g:41:26: QUALIFIED_NAME ^
327
345
  {
328
- QUALIFIED_NAME7=(Token)match(input,QUALIFIED_NAME,FOLLOW_QUALIFIED_NAME_in_className99);
346
+ QUALIFIED_NAME7=(Token)match(input,QUALIFIED_NAME,FOLLOW_QUALIFIED_NAME_in_className104);
329
347
  QUALIFIED_NAME7_tree =
330
348
  (CommonTree)adaptor.create(QUALIFIED_NAME7)
331
349
  ;
@@ -369,7 +387,7 @@ public TreeAdaptor getTreeAdaptor() {
369
387
 
370
388
 
371
389
  // $ANTLR start "filter"
372
- // antlr/UIQuery.g:27:1: filter : NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL ) ;
390
+ // antlr/UIQuery.g:45:1: filter : NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL ) ;
373
391
  public final UIQueryParser.filter_return filter() throws RecognitionException {
374
392
  UIQueryParser.filter_return retval = new UIQueryParser.filter_return();
375
393
  retval.start = input.LT(1);
@@ -386,20 +404,20 @@ public TreeAdaptor getTreeAdaptor() {
386
404
  CommonTree set10_tree=null;
387
405
 
388
406
  try {
389
- // antlr/UIQuery.g:27:8: ( NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL ) )
390
- // antlr/UIQuery.g:27:10: NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL )
407
+ // antlr/UIQuery.g:45:8: ( NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL ) )
408
+ // antlr/UIQuery.g:45:10: NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL )
391
409
  {
392
410
  root_0 = (CommonTree)adaptor.nil();
393
411
 
394
412
 
395
- NAME8=(Token)match(input,NAME,FOLLOW_NAME_in_filter124);
413
+ NAME8=(Token)match(input,NAME,FOLLOW_NAME_in_filter129);
396
414
  NAME8_tree =
397
415
  (CommonTree)adaptor.create(NAME8)
398
416
  ;
399
417
  adaptor.addChild(root_0, NAME8_tree);
400
418
 
401
419
 
402
- FILTER_COLON9=(Token)match(input,FILTER_COLON,FOLLOW_FILTER_COLON_in_filter126);
420
+ FILTER_COLON9=(Token)match(input,FILTER_COLON,FOLLOW_FILTER_COLON_in_filter131);
403
421
  FILTER_COLON9_tree =
404
422
  (CommonTree)adaptor.create(FILTER_COLON9)
405
423
  ;
@@ -449,15 +467,15 @@ public TreeAdaptor getTreeAdaptor() {
449
467
 
450
468
 
451
469
 
452
- public static final BitSet FOLLOW_expr_in_query48 = new BitSet(new long[]{0x0000000000008002L});
453
- public static final BitSet FOLLOW_WHITE_in_query51 = new BitSet(new long[]{0x0000000000001200L});
454
- public static final BitSet FOLLOW_expr_in_query54 = new BitSet(new long[]{0x0000000000008002L});
455
- public static final BitSet FOLLOW_className_in_expr72 = new BitSet(new long[]{0x0000000000000002L});
456
- public static final BitSet FOLLOW_filter_in_expr76 = new BitSet(new long[]{0x0000000000000002L});
457
- public static final BitSet FOLLOW_NAME_in_className94 = new BitSet(new long[]{0x0000000000000002L});
458
- public static final BitSet FOLLOW_QUALIFIED_NAME_in_className99 = new BitSet(new long[]{0x0000000000000002L});
459
- public static final BitSet FOLLOW_NAME_in_filter124 = new BitSet(new long[]{0x0000000000000040L});
460
- public static final BitSet FOLLOW_FILTER_COLON_in_filter126 = new BitSet(new long[]{0x0000000000002510L});
461
- public static final BitSet FOLLOW_set_in_filter129 = new BitSet(new long[]{0x0000000000000002L});
470
+ public static final BitSet FOLLOW_expr_in_query53 = new BitSet(new long[]{0x0000000000008002L});
471
+ public static final BitSet FOLLOW_WHITE_in_query56 = new BitSet(new long[]{0x0000000000001200L});
472
+ public static final BitSet FOLLOW_expr_in_query59 = new BitSet(new long[]{0x0000000000008002L});
473
+ public static final BitSet FOLLOW_className_in_expr77 = new BitSet(new long[]{0x0000000000000002L});
474
+ public static final BitSet FOLLOW_filter_in_expr81 = new BitSet(new long[]{0x0000000000000002L});
475
+ public static final BitSet FOLLOW_NAME_in_className99 = new BitSet(new long[]{0x0000000000000002L});
476
+ public static final BitSet FOLLOW_QUALIFIED_NAME_in_className104 = new BitSet(new long[]{0x0000000000000002L});
477
+ public static final BitSet FOLLOW_NAME_in_filter129 = new BitSet(new long[]{0x0000000000000040L});
478
+ public static final BitSet FOLLOW_FILTER_COLON_in_filter131 = new BitSet(new long[]{0x0000000000002510L});
479
+ public static final BitSet FOLLOW_set_in_filter134 = new BitSet(new long[]{0x0000000000000002L});
462
480
 
463
481
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre4
4
+ version: 0.4.0.pre5
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -374,7 +374,6 @@ files:
374
374
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
375
375
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQuery.tokens
376
376
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ViewMapper.java
377
- - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQuery.tokens
378
377
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryLexer.java
379
378
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryParser.java
380
379
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java
@@ -1,10 +0,0 @@
1
- ESC_SEQ=4
2
- FILTER_COLON=5
3
- HEX_DIGIT=6
4
- INT=7
5
- NAME=8
6
- OCTAL_ESC=9
7
- QUALIFIED_NAME=10
8
- STRING=11
9
- UNICODE_ESC=12
10
- WHITE=13