Grammalecte  Check-in [f3f02b6192]

Overview
Comment:[build] rule parser: exit when wrong syntax
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | build | rg
Files: files | file ages | folders
SHA3-256: f3f02b6192f7986054372e744b5698675e5be0a75c997ca8649791341a0e0f67
User & Date: olr on 2018-07-27 08:35:50
Other Links: branch diff | manifest | tags
Context
2018-07-27
09:37
[fr] conversion: regex rules -> graph rules check-in: 99d73d5fde user: olr tags: fr, rg
08:35
[build] rule parser: exit when wrong syntax check-in: f3f02b6192 user: olr tags: build, rg
08:32
[fr] conversion: regex rules -> graph rules check-in: 070d93f9ad user: olr tags: fr, rg
Changes

Modified compile_rules_graph.py from [f5d769e286] to [e2133c86ff].

308
309
310
311
312
313
314
315
316


317
318
319
320
321
322
323
308
309
310
311
312
313
314


315
316
317
318
319
320
321
322
323







-
-
+
+







            # new rule group
            m = re.match("__(\\w+)(!\\d|)__", sLine)
            if m:
                sRuleName = m.group(1)
                iActionBlock = 1
                nPriority = int(m.group(2)[1:]) if m.group(2)  else -1
            else:
                print("Error at rule group: ", sLine, " -- line:", i)
                break
                print("Syntax error in rule group: ", sLine, " -- line:", i)
                exit()
        elif re.search("^    +<<- ", sLine) or sLine.startswith("        ") \
                or re.search("^    +#", sLine) or re.search(r"^    [-~=>/](?:\d\.?(?::\.?\d+|)|)>> ", sLine) :
            # actions
            sActions += " " + sLine.strip()
        elif re.match("[  ]*$", sLine):
            # empty line to end merging
            if not lTokenLine:

Modified gc_lang/fr/rules.grx from [d7105e05ea] to [0a4581811d].

9429
9430
9431
9432
9433
9434
9435
9436

9437
9438
9439
9440
9441
9442
9443
9429
9430
9431
9432
9433
9434
9435

9436
9437
9438
9439
9440
9441
9442
9443







-
+







!!
!!!! Groupe nominal (2)                                                                           !!
!!
!!

## Sans article

__gn_2m_accord__
__[i]/gn(gn_2m_accord)__
    <start>  @:[NA]¬*  @:[NA]¬*
        <<- /gn/ ((morph(\2, ":m", "*") and morph(\3, ":f", "*")) or (morph(\2, ":f", "*") and morph(\3, ":m", "*"))) and not apposition(\2, \3)
        -3>> =switchGender(\3)                                                                      # Accord de genre erroné avec « \2 ».
        <<- __also__ and hasFemForm(\2) -2>> =switchGender(\2)                                      # Accord de genre erroné avec « \3 ».
        <<- /gn/ ((morph(\2, ":s", "*") and morph(\3, ":p", "*")) or (morph(\2, ":p", "*") and morph(\3, ":s", "*"))) and not apposition(\2, \3)
        -3>> =switchPlural(\3)                                                                      # Accord de nombre erroné avec « \2 ».
        <<- __also__ -2>> =switchPlural(\2)                                                         # Accord de nombre erroné avec « \3 ».