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
|
${string}
${regex}
${map}
if (typeof(process) !== 'undefined') {
var gc_engine_func = require("./gc_engine_func.js");
var gc_options = require("./gc_options.js");
var gc_rules = require("./gc_rules.js");
var gc_rules_graph = require("./gc_rules_graph.js");
var cregex = require("./cregex.js");
var text = require("../text.js");
}
else if (typeof(require) !== 'undefined') {
var gc_engine_func = require("resource://grammalecte/${lang}/gc_engine_func.js");
var gc_options = require("resource://grammalecte/${lang}/gc_options.js");
var gc_rules = require("resource://grammalecte/${lang}/gc_rules.js");
var gc_rules_graph = require("resource://grammalecte/${lang}/gc_rules_graph.js");
var cregex = require("resource://grammalecte/${lang}/cregex.js");
var text = require("resource://grammalecte/text.js");
}
function capitalizeArray (aArray) {
// can’t map on user defined function??
let aNew = [];
for (let i = 0; i < aArray.length; i = i + 1) {
aNew[i] = aArray[i].slice(0,1).toUpperCase() + aArray[i].slice(1);
|
>
<
<
<
<
<
<
<
<
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
${string}
${regex}
${map}
if (typeof(process) !== 'undefined') {
// NodeJS
var gc_engine_func = require("./gc_engine_func.js");
var gc_options = require("./gc_options.js");
var gc_rules = require("./gc_rules.js");
var gc_rules_graph = require("./gc_rules_graph.js");
var cregex = require("./cregex.js");
var text = require("../text.js");
}
function capitalizeArray (aArray) {
// can’t map on user defined function??
let aNew = [];
for (let i = 0; i < aArray.length; i = i + 1) {
aNew[i] = aArray[i].slice(0,1).toUpperCase() + aArray[i].slice(1);
|
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
|
lSugg = (sSugg) ? sSugg.split("|") : [];
} else if (sSugg == "_") {
lSugg = [];
} else {
lSugg = this._expand(sSugg, nTokenOffset, nLastToken).split("|");
}
if (bCaseSvty && lSugg.length > 0 && this.lToken[iFirstToken]["sValue"].slice(0,1).gl_isUpperCase()) {
lSugg = (this.lToken[iFirstToken]["sValue"].gl_isUpperCase()) ? lSugg.map((s) => s.toUpperCase()) : capitalizeArray(lSugg);
}
// Message
let sMessage = (sMsg.startsWith("=")) ? gc_engine_func[sMsg.slice(1)](this.lToken, nTokenOffset, nLastToken) : this._expand(sMsg, nTokenOffset, nLastToken);
if (bShowRuleId) {
sMessage += " #" + sLineId + " / " + sRuleId;
}
//
|
|
|
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
|
lSugg = (sSugg) ? sSugg.split("|") : [];
} else if (sSugg == "_") {
lSugg = [];
} else {
lSugg = this._expand(sSugg, nTokenOffset, nLastToken).split("|");
}
if (bCaseSvty && lSugg.length > 0 && this.lToken[iFirstToken]["sValue"].slice(0,1).gl_isUpperCase()) {
lSugg = (this.sSentence.slice(nStart, nEnd).gl_isUpperCase()) ? lSugg.map((s) => s.toUpperCase()) : capitalizeArray(lSugg);
}
// Message
let sMessage = (sMsg.startsWith("=")) ? gc_engine_func[sMsg.slice(1)](this.lToken, nTokenOffset, nLastToken) : this._expand(sMsg, nTokenOffset, nLastToken);
if (bShowRuleId) {
sMessage += " #" + sLineId + " / " + sRuleId;
}
//
|