Grammalecte  Diff

Differences From Artifact [25f4682d72]:

To Artifact [4742310603]:


25
26
27
28
29
30
31

32
33


34
35
36
37
38
39
40
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41







+
-
-
+
+







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

# grammar rules and dictionary
_sContext = ""                          # what software is running
_rules = None
_dOptions = dict(gc_options.dOpt)       # duplication necessary, to be able to reset to default
_rules = None                           # module gc_rules
_dOptions = None
_aIgnoredRules = set()
_oDict = None
_dAnalyses = {}                         # cache for data from dictionary



#### Parsing
281
282
283
284
285
286
287
288

289


290
291


292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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







-
+

+
+


+
+




















-
+














-
+







    from com.sun.star.beans import PropertyValue
    #import lightproof_handler_${implname} as opt
    _createError = _createWriterError
except ImportError:
    _createError = _createDictError


def load ():
def load (sContext="Python"):
    global _oDict
    global _sContext
    global _dOptions
    try:
        _oDict = IBDAWG("${dic_name}.bdic")
        _sContext = 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:
        _dOptions[sOpt] = bVal


def setOptions (dOpt):
    for sKey, bVal in dOpt.items():
        if sKey in _dOptions:
            _dOptions[sKey] = bVal


def getOptions ():
    return _dOptions


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


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.dOpt)
    _dOptions = dict(gc_options.getOptions(_sContext))


def getDictionary ():
    return _oDict


def _getRules (bParagraph):