Overview
Comment: | [build] merge graph rules building and regex rules building |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | build | rg |
Files: | files | file ages | folders |
SHA3-256: |
cb88d3d2dc6889b8c530b5059d7cd161 |
User & Date: | olr on 2018-06-13 05:37:08 |
Other Links: | branch diff | manifest | tags |
Context
2018-06-13
| ||
05:39 | [fr] merge rules in one file check-in: 6fb93b7388 user: olr tags: fr, rg | |
05:37 | [build] merge graph rules building and regex rules building check-in: cb88d3d2dc user: olr tags: build, rg | |
2018-06-12
| ||
19:55 | [fr] conversion: regex -> graph rules check-in: 3d50852f45 user: olr tags: fr, rg | |
Changes
Modified compile_rules.py from [8c11a24e22] to [22bdc8ba86].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | + | import re import traceback import json import compile_rules_js_convert as jsconv import compile_rules_graph as crg dDEF = {} lFUNCTIONS = [] aRULESET = set() # set of rule-ids to check if there is several rules with the same id nRULEWITHOUTNAME = 0 |
︙ | |||
439 440 441 442 443 444 445 | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - + + - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + | except: print("Error. Rules file in project [" + sLang + "] not found.") exit() # removing comments, zeroing empty lines, creating definitions, storing tests, merging rule lines print(" parsing rules...") global dDEF |
︙ | |||
559 560 561 562 563 564 565 | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | - - + + + + + + | displayStats(lParagraphRules, lSentenceRules) print("Unnamed rules: " + str(nRULEWITHOUTNAME)) d = { "callables": sPyCallables, "callablesJS": sJSCallables, |
Modified compile_rules_graph.py from [a4f6103185] to [e76a1b508a].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + - | # Create a Direct Acyclic Rule Graph (DARG) import re import traceback import json import darg |
︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | - - - - - + - - - - - - - - - - + - - - - - + - - - - - + + - + - - - - - - - - - - - - - - - - - - - - | ## no action, break loop if condition is False return [sOption, sCondition, cAction, ""] else: print("# Unknown action at line " + sIdAction) return None |
︙ | |||
316 317 318 319 320 321 322 | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - + - - - - - | exit() for j, sTokenLine in lTokenLine: dAllGraph[sGraphName].append((j, sRuleName, sTokenLine, sActions, nPriority)) lTokenLine.clear() sActions = "" sRuleName = "" nPriority = 4 |
︙ | |||
376 377 378 379 380 381 382 | 331 332 333 334 335 336 337 338 339 340 341 | - - - - | for sActionName, aAction in dACTIONS.items(): print(sActionName, aAction) # Result d = { "graph_callables": sPyCallables, |
Modified make.py from [5704755499] to [6b14360ed5].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - | import json import platform from distutils import dir_util, file_util import dialog_bundled import compile_rules |
︙ | |||
190 191 192 193 194 195 196 | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - - + + - - - | spLang = "gc_lang/" + sLang dVars = xConfig._sections['args'] dVars['locales'] = dVars["locales"].replace("_", "-") dVars['loc'] = str(dict([ [s, [s[0:2], s[3:5], ""]] for s in dVars["locales"].split(" ") ])) ## COMPILE RULES |
︙ | |||
229 230 231 232 233 234 235 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - - - - + | helpers.copyAndFileTemplate(spLang+"/modules/"+sf, spLangPack+"/"+sf, dVars) print(sf, end=", ") print() # TEST FILES with open("grammalecte/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy: hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n") |
︙ |