Module: Mail::Parsers::MessageIdsParser

Defined in:
lib/mail/parsers/message_ids_parser.rb

Defined Under Namespace

Classes: MessageIdsStruct

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._eof_actionsObject

Returns the value of attribute _eof_actions



1168
1169
1170
# File 'lib/mail/parsers/message_ids_parser.rb', line 1168

def _eof_actions
  @_eof_actions
end

._index_offsetsObject

Returns the value of attribute _index_offsets



90
91
92
# File 'lib/mail/parsers/message_ids_parser.rb', line 90

def _index_offsets
  @_index_offsets
end

._indiciesObject

Returns the value of attribute _indicies



113
114
115
# File 'lib/mail/parsers/message_ids_parser.rb', line 113

def _indicies
  @_indicies
end

._key_spansObject

Returns the value of attribute _key_spans



67
68
69
# File 'lib/mail/parsers/message_ids_parser.rb', line 67

def _key_spans
  @_key_spans
end

._trans_actionsObject

Returns the value of attribute _trans_actions



1131
1132
1133
# File 'lib/mail/parsers/message_ids_parser.rb', line 1131

def _trans_actions
  @_trans_actions
end

._trans_keysObject

Returns the value of attribute _trans_keys



14
15
16
# File 'lib/mail/parsers/message_ids_parser.rb', line 14

def _trans_keys
  @_trans_keys
end

._trans_targsObject

Returns the value of attribute _trans_targs



1094
1095
1096
# File 'lib/mail/parsers/message_ids_parser.rb', line 1094

def _trans_targs
  @_trans_targs
end

.en_comment_tailObject

Returns the value of attribute en_comment_tail



1204
1205
1206
# File 'lib/mail/parsers/message_ids_parser.rb', line 1204

def en_comment_tail
  @en_comment_tail
end

.en_mainObject

Returns the value of attribute en_main



1208
1209
1210
# File 'lib/mail/parsers/message_ids_parser.rb', line 1208

def en_main
  @en_main
end

.errorObject

Returns the value of attribute error



1199
1200
1201
# File 'lib/mail/parsers/message_ids_parser.rb', line 1199

def error
  @error
end

.first_finalObject

Returns the value of attribute first_final



1195
1196
1197
# File 'lib/mail/parsers/message_ids_parser.rb', line 1195

def first_final
  @first_final
end

.startObject

Returns the value of attribute start



1191
1192
1193
# File 'lib/mail/parsers/message_ids_parser.rb', line 1191

def start
  @start
end

Class Method Details

.parse(data) ⇒ Object



1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
# File 'lib/mail/parsers/message_ids_parser.rb', line 1214

def self.parse(data)
  raise Mail::Field::ParseError.new(Mail::MessageIdsElement, data, 'nil is invalid') if data.nil?

  # Parser state
  message_ids = MessageIdsStruct.new([])
  msg_id_s = nil

  # 5.1 Variables Used by Ragel
  p = 0
  eof = pe = data.length
  stack = []

  
begin
	p ||= 0
	pe ||= data.length
	cs = start
	top = 0
end

  
begin
	testEof = false
	_slen, _trans, _keys, _inds, _acts, _nacts = nil
	_goto_level = 0
	_resume = 10
	_eof_trans = 15
	_again = 20
	_test_eof = 30
	_out = 40
	while true
	if _goto_level <= 0
	if p == pe
		_goto_level = _test_eof
		next
	end
	if cs == 0
		_goto_level = _out
		next
	end
	end
	if _goto_level <= _resume
	_keys = cs << 1
	_inds = _index_offsets[cs]
	_slen = _key_spans[cs]
	_wide = data[p].ord
	_trans = if (   _slen > 0 && 
			_trans_keys[_keys] <= _wide && 
			_wide <= _trans_keys[_keys + 1] 
  ) then
			_indicies[ _inds + _wide - _trans_keys[_keys] ] 
		 else 
			_indicies[ _inds + _slen ]
		 end
	cs = _trans_targs[_trans]
	if _trans_actions[_trans] != 0
	case _trans_actions[_trans]
	when 2 then
		begin
 msg_id_s = p 		end
	when 30 then
		begin
 message_ids.message_ids << data[msg_id_s..(p-1)].rstrip 		end
	when 3 then
		begin
		end
	when 26 then
		begin
		end
	when 15 then
		begin
		end
	when 13 then
		begin
		end
	when 11 then
		begin
		end
	when 8 then
		begin
		end
	when 6 then
		begin
		end
	when 19 then
		begin
		end
	when 17 then
		begin
		end
	when 23 then
		begin
		end
	when 1 then
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 29 then
		begin
 	begin
		top -= 1
		cs = stack[top]
		_goto_level = _again
		next
	end
 		end
	when 32 then
		begin
 message_ids.message_ids << data[msg_id_s..(p-1)].rstrip 		end
		begin
 msg_id_s = p 		end
	when 31 then
		begin
 message_ids.message_ids << data[msg_id_s..(p-1)].rstrip 		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 5 then
		begin
		end
		begin
 msg_id_s = p 		end
	when 16 then
		begin
		end
		begin
		end
	when 12 then
		begin
		end
		begin
		end
	when 25 then
		begin
		end
		begin
		end
	when 24 then
		begin
		end
		begin
		end
	when 4 then
		begin
		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 27 then
		begin
		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 28 then
		begin
		end
		begin
 	begin
		top -= 1
		cs = stack[top]
		_goto_level = _again
		next
	end
 		end
	when 14 then
		begin
		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 21 then
		begin
		end
		begin
		end
	when 10 then
		begin
		end
		begin
		end
	when 9 then
		begin
		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 7 then
		begin
		end
		begin
 	begin
		stack[top] = cs
		top+= 1
		cs = 112
		_goto_level = _again
		next
	end
 		end
	when 18 then
		begin
		end
		begin
		end
	when 22 then
		begin
		end
		begin
		end
		begin
		end
	when 20 then
		begin
		end
		begin
		end
		begin
		end
	end
	end
	end
	if _goto_level <= _again
	if cs == 0
		_goto_level = _out
		next
	end
	p += 1
	if p != pe
		_goto_level = _resume
		next
	end
	end
	if _goto_level <= _test_eof
	if p == eof
	  case _eof_actions[cs]
	when 30 then
		begin
 message_ids.message_ids << data[msg_id_s..(p-1)].rstrip 		end
	when 3 then
		begin
		end
	  end
	end

	end
	if _goto_level <= _out
		break
	end
end
	end


  if p != eof || cs < 117
    raise Mail::Field::ParseError.new(Mail::MessageIdsElement, data, "Only able to parse up to #{data[0..p]}")
  end

  message_ids
end