Grammalecte  Check-in [25be7eb67b]

Overview
Comment:[core][js] try to remove some warnings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | webext2
Files: files | file ages | folders
SHA3-256: 25be7eb67bed0e81ba5234e54a62df914af0cb29e3cb1b2d69b915363776594b
User & Date: olr on 2017-08-04 05:17:06
Other Links: branch diff | manifest | tags
Context
2017-08-04
05:18
[fx] unknown key in manifest check-in: 4151e87ea3 user: olr tags: fx, webext2
05:17
[core][js] try to remove some warnings check-in: 25be7eb67b user: olr tags: core, webext2
2017-08-03
11:41
[core][js] tests initialization check-in: af95395956 user: olr tags: core, webext2
Changes

Modified gc_core/js/lang_core/gc_engine.js from [4d4d4ec095] to [ff4d262785].

     1      1   // Grammar checker engine
     2      2   
            3  +//"use strict";
            4  +
     3      5   ${string}
     4      6   ${regex}
     5      7   ${map}
     6      8   
     7      9   
     8     10   if (typeof(require) !== 'undefined') {
     9     11       var helpers = require("resource://grammalecte/helpers.js");
................................................................................
    82     84   
    83     85           // parse sentence
    84     86           for (let [iStart, iEnd] of this._getSentenceBoundaries(sText)) {
    85     87               if (4 < (iEnd - iStart) < 2000) {
    86     88                   dDA.clear();
    87     89                   //echo(sText.slice(iStart, iEnd));
    88     90                   try {
    89         -                    [_, errs] = this._proofread(sText.slice(iStart, iEnd), sAlt.slice(iStart, iEnd), iStart, false, dDA, dPriority, sCountry, bDebug, bContext);
           91  +                    [sNew, errs] = this._proofread(sText.slice(iStart, iEnd), sAlt.slice(iStart, iEnd), iStart, false, dDA, dPriority, sCountry, bDebug, bContext);
    90     92                       dErrors.gl_update(errs);
    91     93                   }
    92     94                   catch (e) {
    93     95                       helpers.logerror(e);
    94     96                   }
    95     97               }
    96     98           }
................................................................................
   215    217               if (bUppercase && m[iGroup].slice(0,1).gl_isUpperCase()) {
   216    218                   oErr["aSuggestions"] = capitalizeArray(sRepl.gl_expand(m).split("|"));
   217    219               } else {
   218    220                   oErr["aSuggestions"] = sRepl.gl_expand(m).split("|");
   219    221               }
   220    222           }
   221    223           // Message
          224  +        let sMessage = "";
   222    225           if (sMsg[0] === "=") {
   223    226               sMessage = oEvalFunc[sMsg.slice(1)](s, m)
   224    227           } else {
   225    228               sMessage = sMsg.gl_expand(m);
   226    229           }
   227    230           if (bIdRule) {
   228    231               sMessage += " ##" + sLineId + " #" + sRuleId;
................................................................................
   276    279       reactivateRule: function (sRuleId) {
   277    280           _aIgnoredRules.delete(sRuleId);
   278    281       },
   279    282   
   280    283       listRules: function (sFilter=null) {
   281    284           // generator: returns tuple (sOption, sLineId, sRuleId)
   282    285           try {
   283         -            for ([sOption, lRuleGroup] of this._getRules(true)) {
   284         -                for ([_, _, sLineId, sRuleId, _, _] of lRuleGroup) {
          286  +            for (let [sOption, lRuleGroup] of this._getRules(true)) {
          287  +                for (let [x1, x2, sLineId, sRuleId, x3, x4] of lRuleGroup) {
   285    288                       if (!sFilter || sRuleId.test(sFilter)) {
   286    289                           yield [sOption, sLineId, sRuleId];
   287    290                       }
   288    291                   }
   289    292               }
   290         -            for ([sOption, lRuleGroup] of this._getRules(false)) {
   291         -                for ([_, _, sLineId, sRuleId, _, _] of lRuleGroup) {
          293  +            for (let [sOption, lRuleGroup] of this._getRules(false)) {
          294  +                for (let [x1, x2, sLineId, sRuleId, x3, x4] of lRuleGroup) {
   292    295                       if (!sFilter || sRuleId.test(sFilter)) {
   293    296                           yield [sOption, sLineId, sRuleId];
   294    297                       }
   295    298                   }
   296    299               }
   297    300           }
   298    301           catch (e) {

Modified gc_lang/fr/modules-js/gce_suggestions.js from [7f7dced66d] to [5dc3101886].

    15     15       for (let sStem of stem(sFlex)) {
    16     16           let tTags = conj._getTags(sStem);
    17     17           if (tTags) {
    18     18               // we get the tense
    19     19               let aTense = new Set();
    20     20               for (let sMorph of _dAnalyses.gl_get(sFlex, [])) {
    21     21                   let m;
    22         -                let zVerb = new RegExp (sStem+" .*?(:(?:Y|I[pqsf]|S[pq]|K))", "g");
    23         -                while (m = zVerb.exec(sMorph)) {
           22  +                let zVerb = new RegExp (">"+sStem+" .*?(:(?:Y|I[pqsf]|S[pq]|K))", "g");
           23  +                while ((m = zVerb.exec(sMorph)) !== null) {
    24     24                       // stem must be used in regex to prevent confusion between different verbs (e.g. sauras has 2 stems: savoir and saurer)
    25     25                       if (m) {
    26     26                           if (m[1] === ":Y") {
    27     27                               aTense.add(":Ip");
    28     28                               aTense.add(":Iq");
    29     29                               aTense.add(":Is");
    30     30                           } else if (m[1] === ":P") {

Modified gc_lang/fr/modules/gce_suggestions.py from [948c38b1f8] to [e839f7efe5].

    11     11       aSugg = set()
    12     12       for sStem in stem(sFlex):
    13     13           tTags = conj._getTags(sStem)
    14     14           if tTags:
    15     15               # we get the tense
    16     16               aTense = set()
    17     17               for sMorph in _dAnalyses.get(sFlex, []): # we don’t check if word exists in _dAnalyses, for it is assumed it has been done before
    18         -                for m in re.finditer(sStem+" .*?(:(?:Y|I[pqsf]|S[pq]|K|P))", sMorph):
           18  +                for m in re.finditer(">"+sStem+" .*?(:(?:Y|I[pqsf]|S[pq]|K|P))", sMorph):
    19     19                       # stem must be used in regex to prevent confusion between different verbs (e.g. sauras has 2 stems: savoir and saurer)
    20     20                       if m:
    21     21                           if m.group(1) == ":Y":
    22     22                               aTense.add(":Ip")
    23     23                               aTense.add(":Iq")
    24     24                               aTense.add(":Is")
    25     25                           elif m.group(1) == ":P":