Grammalecte  Check-in [1b98af1338]

Overview
Comment:[core][py] variable renaming
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 1b98af1338e3ebd3c4ab1fc97bcaff82528b8b63fb59eba6625e5e62a5506bdb
User & Date: olr on 2017-08-01 09:50:47
Other Links: manifest | tags
Context
2017-08-02
07:27
[fr] nr: confusion <patte/pâte> check-in: 5f2069fa38 user: olr tags: trunk, fr
2017-08-01
09:50
[core][py] variable renaming check-in: 1b98af1338 user: olr tags: trunk, core
2017-07-31
07:52
[core][js] text: remove useless functions check-in: 6af1e457f4 user: olr tags: trunk, core
Changes

Modified gc_core/py/lang_core/gc_engine.py from [4742310603] to [ebc3e57546].

24
25
26
27
28
29
30
31
32
33




34
35
36
37

38
39
40
41
42
43
44
24
25
26
27
28
29
30



31
32
33
34
35
36
37

38
39
40
41
42
43
44
45







-
-
-
+
+
+
+



-
+







lang = "${lang}"
locales = ${loc}
pkg = "${implname}"
name = "${name}"
version = "${version}"
author = "${author}"

# grammar rules and dictionary
_sContext = ""                          # what software is running
_rules = None                           # module gc_rules
_rules = None                               # module gc_rules

# data
_sAppContext = ""                           # what software is running
_dOptions = None
_aIgnoredRules = set()
_oDict = None
_dAnalyses = {}                         # cache for data from dictionary
_dAnalyses = {}                             # cache for data from dictionary



#### Parsing

def parse (sText, sCountry="${country_default}", bDebug=False, dOptions=None, bContext=False):
    "analyses the paragraph sText and returns list of errors"
284
285
286
287
288
289
290
291

292
293
294
295

296
297
298
299
300
301
302
285
286
287
288
289
290
291

292
293
294
295

296
297
298
299
300
301
302
303







-
+



-
+







    _createError = _createWriterError
except ImportError:
    _createError = _createDictError


def load (sContext="Python"):
    global _oDict
    global _sContext
    global _sAppContext
    global _dOptions
    try:
        _oDict = IBDAWG("${dic_name}.bdic")
        _sContext = sContext
        _sAppContext = sContext
        _dOptions = dict(gc_options.getOptions(sContext))   # duplication necessary, to be able to reset to default
    except:
        traceback.print_exc()


def setOption (sOpt, bVal):
    if sOpt in _dOptions:
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332

333
334
335
336
337
338
339
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332

333
334
335
336
337
338
339
340







-
+














-
+









def getOptions ():
    return _dOptions


def getDefaultOptions ():
    return dict(gc_options.getOptions(_sContext))
    return dict(gc_options.getOptions(_sAppContext))


def getOptionsLabels (sLang):
    return gc_options.getUI(sLang)


def displayOptions (sLang):
    echo("List of options")
    echo("\n".join( [ k+":\t"+str(v)+"\t"+gc_options.getUI(sLang).get(k, ("?", ""))[0]  for k, v  in sorted(_dOptions.items()) ] ))
    echo("")


def resetOptions ():
    global _dOptions
    _dOptions = dict(gc_options.getOptions(_sContext))
    _dOptions = dict(gc_options.getOptions(_sAppContext))


def getDictionary ():
    return _oDict


def _getRules (bParagraph):