-
Notifications
You must be signed in to change notification settings - Fork 0
/
blueprint_parser.js
33 lines (30 loc) · 976 Bytes
/
blueprint_parser.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
"use strict"
var BaseParser = require("./base_parser").BaseParser;
/**
* Parses blueprint materials in the form of...
*
* 1000 x Tritanium
*
* And splits it into an array of two.
*
* e.g. ['1000', 'Tritanium']
*
* This is the data copied from the main blueprint view, showing the
* materials required by the blueprint (show info). It can *not* parse the
* materials from the industry window where you right click and "copy material information"
*
* @constructor
*/
class BlueprintParser extends BaseParser {
constructor()
{
super();
this.name = "BlueprintParser";
// number only at the beginning of the strong
this.itemCount = "^((?:[-]{0,1}(?:\\d+)(?:,\\d)*){1,})";
// any alphabetic string, including optional spaces, at the end
this.itemName = " x ([a-zA-Z\\-]+(?:\\s+[a-zA-Z\\-]+)*).*$";
this.regex = this.itemCount + this.itemName;
}
}
module.exports.BlueprintParser = BlueprintParser;