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: trunk, fr
06:55
[core] listRules() check-in: 00c946ab84 user: olr tags: trunk, core
2019-07-19
16:47
[build][misc][fr] antipatterns for token rules, +syntax for SublimeText, +ajustements check-in: 6d63ab4c87 user: olr tags: trunk, fr, build, new_feature, misc
Changes

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

138
139
140
141
142
143
144
145





146
147
148
149
150
151
152
153
154
155
156
157
158
159
        except re.error:
            echo("# Error. List rules: wrong regex.")
            sFilter = None
    for sOption, lRuleGroup in chain(_getRules(True), _getRules(False)):
        if sOption != "@@@@":
            for _, _, sLineId, sRuleId, _, _ in lRuleGroup:
                if not sFilter or zFilter.search(sRuleId):
                    yield (sOption, sLineId, sRuleId)







def displayRules (sFilter=None):
    "display the name of rules, with the filter <sFilter>"
    echo("List of rules. Filter: << " + str(sFilter) + " >>")
    for sOption, sLineId, sRuleId in listRules(sFilter):
        echo("{:<10} {:<10} {}".format(sOption, sLineId, sRuleId))


#### Options

def setOption (sOpt, bVal):
    "set option <sOpt> with <bVal> if it exists"
    if sOpt in _dOptions:







|
>
>
>
>
>





|
|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        except re.error:
            echo("# Error. List rules: wrong regex.")
            sFilter = None
    for sOption, lRuleGroup in chain(_getRules(True), _getRules(False)):
        if sOption != "@@@@":
            for _, _, sLineId, sRuleId, _, _ in lRuleGroup:
                if not sFilter or zFilter.search(sRuleId):
                    yield ("RegEx", sOption, sLineId, sRuleId)
        else:
            for sRuleName, lActions in _rules_graph.dRule.items():
                sOption, _, cActionType, *_ = lActions
                if cActionType == "-":
                    yield("Tokens", sOption, "", sRuleName)


def displayRules (sFilter=None):
    "display the name of rules, with the filter <sFilter>"
    echo("List of rules. Filter: << " + str(sFilter) + " >>")
    for sOption, sLineId, sRuleId, sType in listRules(sFilter):
        echo("{:<8} {:<10} {:<10} {}".format(sOption, sLineId, sRuleId, sType))


#### Options

def setOption (sOpt, bVal):
    "set option <sOpt> with <bVal> if it exists"
    if sOpt in _dOptions: