forked from pstodulka/swift-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block2Parser.js
42 lines (38 loc) · 1.4 KB
/
block2Parser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Generated by CoffeeScript 1.7.1
(function() {
var XRegExp;
XRegExp = require('xregexp').XRegExp;
module.exports.parse = function(input) {
var match, pattern, result;
result = {};
result.content = input;
result.blockId = 2;
pattern = new XRegExp("O(?<MsgType>\\d{3})(?<InputTime>\\d{4})(?<InputDate>\\d{6})(?<Bic>\\w*?)(?<Session>\\w{4})(?<Sequence>\\w{6})(?<OutputDate>\\d{6})(?<OutputTime>\\d{4})(?<Prio>[SNU])");
match = pattern.xexec(input);
if ((match != null)) {
result.direction = 'O';
result.msgType = match.MsgType;
result.inputTime = match.InputTime;
result.inputDate = match.InputDate;
result.bic = match.Bic;
result.sessionNumber = match.Session;
result.sequenceNumber = match.Sequence;
result.outputDate = match.OutputDate;
result.outputTime = match.OutputTime;
result.prio = match.Prio;
return result;
}
pattern = new XRegExp("I(?<MsgType>\\d{3})(?<Bic>\\w{7,12})(?<Prio>[SNU])(?<MonitoringField>[123])?(?<Obsolescence>\\d{3})?");
match = pattern.xexec(input);
if ((match != null)) {
result.direction = 'I';
result.msgType = match.MsgType;
result.bic = match.Bic;
result.prio = match.Prio;
result.monitoringField = match.MonitoringField;
result.obsolescence = match.Obsolescence;
}
return result;
};
}).call(this);
//# sourceMappingURL=block2Parser.map