Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Commit

Permalink
Fixed some typos in parseUsage (#142)
Browse files Browse the repository at this point in the history
* Fixed some typos

* Update parseUsage.js
  • Loading branch information
kyranet authored and CyberiumShadow committed Feb 9, 2017
1 parent 5e9d830 commit 21033e0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions functions/parseUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const parseTag = (tag, count) => {
const result = /^([a-z0-9]+)(?::([a-z0-9]+)(?:{(?:(\d+(?:\.\d+)?))?(?:,(\d+(?:\.\d+)?))?})?)?$/i.exec(e);
// I require to modify the regex if we wan't to handle invalid types instead of defaulting them

if (!result) { throw new Error(`at tag #${count} at bound #${i + 1}: Invalid syntax, non spesific`); }
if (!result) { throw new Error(`at tag #${count} at bound #${i + 1}: Invalid syntax, non specific`); }

const fill = {
name: result[1],
Expand All @@ -22,7 +22,7 @@ const parseTag = (tag, count) => {

if (result[3]) {
if (fill.type === "literal") {
throw new Error(`at tag #${count} at bound #${i + 1} at the type length definition (min): you canno't set a length for a literal type`);
throw new Error(`at tag #${count} at bound #${i + 1} at the type length definition (min): you cannot set a length for a literal type`);
}

const temp = parseFloat(result[3]);
Expand All @@ -36,7 +36,7 @@ const parseTag = (tag, count) => {

if (result[4]) {
if (fill.type === "literal") {
throw new Error(`at tag #${count} at bound #${i + 1} at the type length definition (max): you canno't set a length for a literal type`);
throw new Error(`at tag #${count} at bound #${i + 1} at the type length definition (max): you cannot set a length for a literal type`);
}

const temp = parseFloat(result[4]);
Expand All @@ -45,15 +45,15 @@ const parseTag = (tag, count) => {
}

if (fill.type === "literal") {
if (literals.includes(fill.name)) { throw new Error(`at tag #${count} at bound #${i + 1}: there can't be two literals with the same text.`); }
if (literals.includes(fill.name)) { throw new Error(`at tag #${count} at bound #${i + 1}: there cannot be two literals with the same text.`); }

literals.push(fill.name);
} else if (members.length > 1) {
if (fill.type === "string" && members.length - 1 !== i) {
throw new Error(`at tag #${count} at bound #${i + 1}: the String type is vague, you must specify it at the last bound`);
}
if (types.includes(fill.type)) {
throw new Error(`at tag #${count} at bound #${i + 1}: there can't be two bounds with the same type (${fill.type})`);
throw new Error(`at tag #${count} at bound #${i + 1}: there cannot be two bounds with the same type (${fill.type})`);
}
types.push(fill.type);
}
Expand All @@ -73,15 +73,15 @@ module.exports = (command) => {
const cmd = command.split("");
cmd.forEach((c, i) => {
if (last && c !== " ") {
throw new Error(`at char #${i + 1} '${c}': there can't be anything else after the repeat tag.`);
throw new Error(`at char #${i + 1} '${c}': there cannot be anything else after the repeat tag.`);
}

if (c === "<") {
if (opened) {
throw new Error(`at char #${i + 1} '<': you might not open a tag inside another tag.`);
}
if (current) {
throw new Error(`from char #${(i + 1) - current.length} to #${i + 1} '${current}': there can't be a literal outside a tag`);
throw new Error(`from char #${(i + 1) - current.length} to #${i + 1} '${current}': there cannot be a literal outside a tag`);
}
opened++;
openReq = true;
Expand All @@ -105,7 +105,7 @@ module.exports = (command) => {
throw new Error(`at char #${i + 1} '[': you might not open a tag inside another tag.`);
}
if (current) {
throw new Error(`from char #${(i + 1) - current.length} to #${i + 1} '${current}': there can't be a literal outside a tag`);
throw new Error(`from char #${(i + 1) - current.length} to #${i + 1} '${current}': there cannot be a literal outside a tag`);
}
opened++;
openReq = false;
Expand All @@ -117,7 +117,7 @@ module.exports = (command) => {
opened--;
if (current === "...") {
if (tags.length < 1) {
throw new Error(`from char #${i - 3} to #${i} '[...]': there can't be a loop at teh begining`);
throw new Error(`from char #${i - 3} to #${i} '[...]': there cannot be a loop at the begining`);
}
tags.push({ type: "repeat" });
last = true;
Expand All @@ -132,7 +132,7 @@ module.exports = (command) => {
} else if (c === " ") {
if (opened) { throw new Error(`at char #${i + 1}: spaces aren't allowed inside a tag`); }
if (current) {
throw new Error(`from char #${(i + 1) - current.length} to char #${i} '${current}': there can't be a literal outside a tag.`);
throw new Error(`from char #${(i + 1) - current.length} to char #${i} '${current}': there cannot be a literal outside a tag.`);
}
} else current += c;
});
Expand Down

0 comments on commit 21033e0

Please sign in to comment.