Grammalecte  Check-in [8f59594242]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[core] listRules() update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256:8f5959424221f301ba9ffdb5e842cab614fa001be976c72d89dd073fc3839820
User & Date: olr 2019-07-27 01:07:04
Context
2019-07-28
23:18
[fr] tests et ajustements check-in: fc9f9195c1 user: olr tags: fr, trunk
2019-07-27
01:07
[core] listRules() update check-in: 8f59594242 user: olr tags: core, trunk
01:06
[fr] tests check-in: 17195aec63 user: olr tags: fr, trunk
Changes

Changes to gc_core/py/lang_core/gc_engine.py.

   134    134       "generator: returns typle (sOption, sLineId, sRuleId)"
   135    135       if sFilter:
   136    136           try:
   137    137               zFilter = re.compile(sFilter)
   138    138           except re.error:
   139    139               echo("# Error. List rules: wrong regex.")
   140    140               sFilter = None
          141  +    # regex rules
   141    142       for sOption, lRuleGroup in chain(_getRules(True), _getRules(False)):
   142    143           if sOption != "@@@@":
   143    144               for _, _, sLineId, sRuleId, _, _ in lRuleGroup:
   144    145                   if not sFilter or zFilter.search(sRuleId):
   145    146                       yield ("RegEx", sOption, sLineId, sRuleId)
   146         -        else:
   147         -            for sRuleName, lActions in _rules_graph.dRule.items():
   148         -                sOption, _, cActionType, *_ = lActions
   149         -                if cActionType == "-":
   150         -                    yield("Tokens", sOption, "", sRuleName)
          147  +    # tokens rules
          148  +    for sRuleName, lActions in _rules_graph.dRule.items():
          149  +        sOption, _, cActionType, *_ = lActions
          150  +        if cActionType == "-":
          151  +            yield("Tokens", sOption, "", sRuleName)
   151    152   
   152    153   
   153    154   def displayRules (sFilter=None):
   154    155       "display the name of rules, with the filter <sFilter>"
   155    156       echo("List of rules. Filter: << " + str(sFilter) + " >>")
   156    157       for sOption, sLineId, sRuleId, sType in listRules(sFilter):
   157    158           echo("{:<8} {:<10} {:<10} {}".format(sOption, sLineId, sRuleId, sType))