Grammalecte  Check-in [00c946ab84]

Overview
Comment:[core] listRules()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 00c946ab843038d798e190873d41b4fd5fa90b7fd0baca07386dbb10bbc2c5dd
User & Date: olr on 2019-07-22 06:55:53
Other Links: manifest | tags
Context
2019-07-22
11:47
[fr] fix tests.py check-in: e39cca00d3 user: olr tags: fr, trunk
06:55
[core] listRules() check-in: 00c946ab84 user: olr tags: core, trunk
2019-07-19
16:47
[build][misc][fr] antipatterns for token rules, +syntax for SublimeText, +ajustements check-in: 6d63ab4c87 user: olr tags: build, fr, misc, new_feature, trunk
Changes

Modified gc_core/py/lang_core/gc_engine.py from [d5503bf3bb] to [f4d14f00c4].

   138    138           except re.error:
   139    139               echo("# Error. List rules: wrong regex.")
   140    140               sFilter = None
   141    141       for sOption, lRuleGroup in chain(_getRules(True), _getRules(False)):
   142    142           if sOption != "@@@@":
   143    143               for _, _, sLineId, sRuleId, _, _ in lRuleGroup:
   144    144                   if not sFilter or zFilter.search(sRuleId):
   145         -                    yield (sOption, sLineId, sRuleId)
          145  +                    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)
   146    151   
   147    152   
   148    153   def displayRules (sFilter=None):
   149    154       "display the name of rules, with the filter <sFilter>"
   150    155       echo("List of rules. Filter: << " + str(sFilter) + " >>")
   151         -    for sOption, sLineId, sRuleId in listRules(sFilter):
   152         -        echo("{:<10} {:<10} {}".format(sOption, sLineId, sRuleId))
          156  +    for sOption, sLineId, sRuleId, sType in listRules(sFilter):
          157  +        echo("{:<8} {:<10} {:<10} {}".format(sOption, sLineId, sRuleId, sType))
   153    158   
   154    159   
   155    160   #### Options
   156    161   
   157    162   def setOption (sOpt, bVal):
   158    163       "set option <sOpt> with <bVal> if it exists"
   159    164       if sOpt in _dOptions: