Grammalecte  Check-in [4de2209cf9]

Overview
Comment:[core][js] gc_engine initialization
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | webext2
Files: files | file ages | folders
SHA3-256: 4de2209cf961d0381cb9e05810fba48fb937bbe02112d1249b39b074628a5c0e
User & Date: olr on 2017-08-03 11:06:49
Other Links: branch diff | manifest | tags
Context
2017-08-03
11:41
[core][js] tests initialization check-in: af95395956 user: olr tags: core, webext2
11:06
[core][js] gc_engine initialization check-in: 4de2209cf9 user: olr tags: core, webext2
10:12
[core][js] don’t use const for modules as objects: const don’t allow to be “redefined” even in a condition which wouldn’t allow redefinition check-in: dfc3a68fbf user: olr tags: core, warning, webext2
Changes

Modified gc_core/js/lang_core/gc_engine.js from [b8c30b3776] to [85c1383912].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Grammar checker engine

${string}
${regex}
${map}


if (typeof(require) !== 'undefined') {
    var IBDAWG = require("resource://grammalecte/ibdawg.js").IBDAWG;
    var helpers = require("resource://grammalecte/helpers.js");
    var gc_options = require("resource://grammalecte/${lang}/gc_options.js");
    var gc_rules = require("resource://grammalecte/${lang}/gc_rules.js");
    var cregex = require("resource://grammalecte/${lang}/cregex.js");
    var text = require("resource://grammalecte/text.js");
    var echo = require("resource://grammalecte/helpers.js").echo;
}


function capitalizeArray (aArray) {
    // can’t map on user defined function??
    let aNew = [];
    for (let i = 0; i < aArray.length; i = i + 1) {








|
|




<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// Grammar checker engine

${string}
${regex}
${map}


if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/helpers.js");
    var echo = require("resource://grammalecte/helpers.js").echo;
    var gc_options = require("resource://grammalecte/${lang}/gc_options.js");
    var gc_rules = require("resource://grammalecte/${lang}/gc_rules.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) {
308
309
310
311
312
313
314




315

316
317
318
319
320
321
322
        return gc_rules.lParagraphRules;
    },

    //// Initialization

    load: function (sContext="JavaScript") {
        try {




            _oDict = new IBDAWG("${dic_name}.json");

            _sAppContext = sContext;
            _dOptions = gc_options.getOptions(sContext).gl_shallowCopy();     // duplication necessary, to be able to reset to default
        }
        catch (e) {
            helpers.logerror(e);
        }
    },







>
>
>
>
|
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
        return gc_rules.lParagraphRules;
    },

    //// Initialization

    load: function (sContext="JavaScript") {
        try {
            if (typeof(require) !== 'undefined') {
                var ibdawg = require("resource://grammalecte/ibdawg.js");
                _oDict = new ibdawg.IBDAWG("${dic_name}.json");
            } else {
                _oDict = new IBDAWG("${dic_name}.json");
            }
            _sAppContext = sContext;
            _dOptions = gc_options.getOptions(sContext).gl_shallowCopy();     // duplication necessary, to be able to reset to default
        }
        catch (e) {
            helpers.logerror(e);
        }
    },

Modified gc_lang/fr/webext/gce_worker.js from [ac8c2849c5] to [1c20e4bba6].

29
30
31
32
33
34
35





36
37
38
39
40
41
42
helpers.echo(mfsp.getMasForm("pointilleuse", false));

helpers.echo(phonet.getSimil("est"));

let oDict = new IBDAWG("French.json");
helpers.echo(oDict.getMorph("merde"));








let oTokenizer = null;
let oLxg = null;

function loadGrammarChecker (sGCOptions="", sContext="JavaScript") {
    if (gce === null) {







>
>
>
>
>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
helpers.echo(mfsp.getMasForm("pointilleuse", false));

helpers.echo(phonet.getSimil("est"));

let oDict = new IBDAWG("French.json");
helpers.echo(oDict.getMorph("merde"));

gc_engine.load("JavaScript");
let aRes = gc_engine.parse("Je suit...");
for (let oErr of aRes) {
    helpers.echo(text.getReadableError(oErr));
}


let oTokenizer = null;
let oLxg = null;

function loadGrammarChecker (sGCOptions="", sContext="JavaScript") {
    if (gce === null) {

Modified gc_lang/fr/webext/manifest.json from [500a80f533] to [b861237771].

35
36
37
38
39
40
41




42
43
44
45

46
47
48
49
50
51
52
      "grammalecte/str_transform.js",
      "grammalecte/ibdawg.js",
      "grammalecte/text.js",
      "grammalecte/tokenizer.js",
      "grammalecte/fr/conj.js",
      "grammalecte/fr/mfsp.js",
      "grammalecte/fr/phonet.js",




      "gce_worker.js"
    ]
  },
  "web_accessible_resources": [

    "grammalecte/fr/conj_data.json",
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json"
  ],
  "permissions": [
    "activeTab"







>
>
>
>




>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
      "grammalecte/str_transform.js",
      "grammalecte/ibdawg.js",
      "grammalecte/text.js",
      "grammalecte/tokenizer.js",
      "grammalecte/fr/conj.js",
      "grammalecte/fr/mfsp.js",
      "grammalecte/fr/phonet.js",
      "grammalecte/fr/cregex.js",
      "grammalecte/fr/gc_options.js",
      "grammalecte/fr/gc_rules.js",
      "grammalecte/fr/gc_engine.js",
      "gce_worker.js"
    ]
  },
  "web_accessible_resources": [
    "grammalecte/_dictionaries/French.json",
    "grammalecte/fr/conj_data.json",
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json"
  ],
  "permissions": [
    "activeTab"