Grammalecte  Diff

Differences From Artifact [7ac4ebe558]:

To Artifact [ca8edd4d44]:


575
576
577
578
579
580
581
582

583
584
585
586




587

588
589
590
591
592
593
594
575
576
577
578
579
580
581

582

583
584
585
586
587
588
589

590
591
592
593
594
595
596
597







-
+
-



+
+
+
+
-
+







        dOptions, dOptPriority = prepareOptions(lOpt)
    except:
        traceback.print_exc()
        exit()

    # generating test files
    print("  generating test files...")
    with open("tests/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy, \
    with open("tests/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy:
         open("gc_lang/"+sLang+"/modules-js/tests_data.json", "w", encoding="utf-8", newline="\n") as hDstJS:
        hDstPy.write("# TESTS FOR LANG ["+sLang+"]\n\n")
        for sLine in lTest:
            hDstPy.write(sLine)

    # tests
    print("  list tests...")
    sGCTests = "\n".join(lTest)
        hDstJS.write('{ "aData": ' + json.dumps(lTest, ensure_ascii=False) + " }\n")
    sGCTestsJS = '{ "aData": ' + json.dumps(lTest, ensure_ascii=False) + " }\n"

    # processing
    print("  preparing rules...")
    bParagraph = True
    lParagraphRules = []
    lSentenceRules = []
    lParagraphRulesJS = []
634
635
636
637
638
639
640


641
642
643
644
645
646
647
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652







+
+







        sJSCallables += "    },\n"
    sJSCallables += "}\n"

    displayStats(lParagraphRules, lSentenceRules)

    d = { "callables": sPyCallables,
          "callablesJS": sJSCallables,
          "gctests": sGCTests,
          "gctestsJS": sGCTestsJS,
          "paragraph_rules": mergeRulesByOption(lParagraphRules),
          "sentence_rules": mergeRulesByOption(lSentenceRules),
          "paragraph_rules_JS": writeRulesToJSArray(mergeRulesByOption(lParagraphRulesJS)),
          "sentence_rules_JS": writeRulesToJSArray(mergeRulesByOption(lSentenceRulesJS)) }
    d.update(dOptions)

    return d