Comparing version 1.1.0 to 1.2.0
## Changelog | ||
### 1.1.0 ~ _26 Feb 2018_ | ||
### 1.2.0 ~ _08 Mar 2018_ | ||
- Support for local variables and parameters | ||
#### 1.1.0 ~ _26 Feb 2018_ | ||
- Fixed types and keywords matching inside constants | ||
@@ -5,0 +8,0 @@ - Support for optional types and keywords casing |
24
index.js
@@ -51,2 +51,3 @@ 'use strict'; | ||
delimitedIdentifiers: { mode: 'dim', fg: 'yellow' }, | ||
variables: { mode: 'dim', fg: 'magenta' }, | ||
dataTypes: { mode: 'dim', fg: 'green', casing: 'uppercase' }, | ||
@@ -121,2 +122,8 @@ standardKeywords: { mode: 'dim', fg: 'cyan', casing: 'uppercase' }, | ||
// Extract local variables so no subsequent operations alter them. Mark their positions for reinsertion. | ||
let __variables = output.match(/(\B@[@#$_\w]*)/g); | ||
if (__variables && __variables.length) { | ||
output = output.replace(/(\B@[@#$_\w]*)/g, '↪※↩'); | ||
} | ||
if (runestone.dataTypes && runestone.dataTypes.sequence) { | ||
@@ -169,2 +176,13 @@ let regex = new RegExp('\\b' + '(' + dataTypes.join('|') + ')' + '\\b' + '(?![\'"\\]])', 'gi'); | ||
// If local variables were found and extracted, reinsert them on the marked positions. | ||
if (__variables && __variables.length) { | ||
for (let i of __variables) { | ||
// If local variables were to be formatted, apply the provided style. | ||
if (runestone.variables && runestone.variables.sequence) | ||
output = output.replace('↪※↩', runestone.variables.sequence + i + ANSIModes.reset); | ||
else | ||
output = output.replace('↪※↩', i); | ||
} | ||
} | ||
// If constants were found and extracted, reinsert them on the marked positions. | ||
@@ -242,2 +260,6 @@ if (__constants && __constants.length) { | ||
if (runestone.variables) { | ||
runestone.variables.sequence = forgeANSISequence(runestone.variables); | ||
} | ||
if (runestone.dataTypes) { | ||
@@ -294,2 +316,2 @@ if (Array.isArray(runestone.dataTypes.types)) | ||
module.exports = igniculus; | ||
module.exports.log = illumine; | ||
module.exports.log = illumine; |
{ | ||
"name": "igniculus", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "SQL Syntax Highlighter and Logger. Unadorned and customizable.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -89,6 +89,7 @@ # Igniculus | ||
- options.**constants** - Values surrounded by single quotes. _E.g:_ `'static'` | ||
- options.**constants** - Values surrounded by single quotes. _E.g:_ `'static'` | ||
- options.**numbers** - Numeric values. _E.g:_ `2.5` | ||
- options.**operators** - Arithmetic, Bitwise and Comparison operators. _E.g:_ `+` or `>=` | ||
- options.**delimitedIdentifiers** - Text between brackets or double quotes. _E.g:_ `[Employee]` or `"salary"` | ||
- options.**operators** - Arithmetic, Bitwise and Comparison operators. _E.g:_ `+` or `>=` | ||
- options.**variables** - Local variables and parameters. _E.g:_ `@name` or `@@IDENTITY` | ||
- options.**delimitedIdentifiers** - Text between brackets or double quotes. _E.g:_ `[Employee]` or `"salary"` | ||
- options.**dataTypes** - One of the included data types. _E.g:_ `INTEGER` or `VARCHAR` | ||
@@ -173,6 +174,7 @@ - dataTypes.**types** - Array of custom data types. Replaces the ones by default. _E.g:_ `['SERIAL', 'TIMESTAMP']` | ||
constants: { mode: 'dim', fg: 'red' }, | ||
delimitedIdentifiers: { mode: 'dim', fg: 'yellow', casing: 'uppercase' }, | ||
delimitedIdentifiers: { mode: 'dim', fg: 'yellow' }, | ||
variables: { mode: 'dim', fg: 'magenta' }, | ||
dataTypes: { mode: 'dim', fg: 'green', casing: 'uppercase' }, | ||
standardKeywords: { mode: 'dim', fg: 'cyan', casing: 'uppercase' }, | ||
lesserKeywords: { mode: 'bold', fg: 'black' }, | ||
lesserKeywords: { mode: 'bold', fg: 'black', casing: 'uppercase' }, | ||
prefix: { replace: /.*?: / } | ||
@@ -267,3 +269,3 @@ }; | ||
}, | ||
postfix: { text:'\r\n' } | ||
postfix: { text: '\r\n' } | ||
} | ||
@@ -292,3 +294,3 @@ ); | ||
### Future Upgrades | ||
Planned support for variables and custom rules. | ||
Planned support for custom rules. | ||
@@ -295,0 +297,0 @@ ## Maintainers |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27115
27695
259
299