Improve regular expressions per Bruce Rennie bug report.#536
Improve regular expressions per Bruce Rennie bug report.#536Jafaral merged 2 commits intouniconproject:masterfrom
Conversation
|
@brucerennie do you have any comments to add to this PR? |
|
I will test it against my local copy of the public release of Unicon. |
|
@brucerennie, let me know if you have any feedback, or if we should move ahead and merge it. |
|
Jafar, I just have to find the test programs I was using at the time and test against these changes. Should be done in the next two days. |
|
Jafar, The changes made above allow the code as follows to compile: However, when attempting to execute the larger program from which this was extracted as below: This fails to execute with a runtime error: The problem appears to be the unitialised variable emptyregex. If this is changed to "" (the empty string), there is no runtime error found. |
|
I confirm Bruce's report. I don't recall whether emptyregex was a pure figment of my imagination, but it functions as one here and its semantics is simple enough to infer. Probably I believed the pattern type already had an epsilon of some kind and we could look it up and use it instead of the empty string here. But the empty string would seem to be OK. At least, I confirm that it removes the runtime error as per Bruce's comment. I don't know enough about git to edit an existing pull request. I don't know whether to accept this pull request and then put in another, very small pull request to change emptyregex to "\"\"" in unigram.y (with corresponding changes to unigram.icn and unigram.y), or to reject this pull request and submit a new one. At the moment my corrected regex nonterminal in unigram.y adds a small comment and looks like: /* The empty string "\"\"", denoting "" in the generated code, serves as an empty regex */ |
|
@cjeffery you opened the PR from the master branch from your fork. It is fine for this PR, but it is good to create a different branch for every feature/fix you add in the future. To add changes to this PR. Make those changes at your end and commit to the same branch you opened this PR from ( |
I have tweaked unigram.y (commit includes unigram.icn and unigram.u for bootstrapping purposes) and tree.icn to handle some regular expressions that were previously failing as reported by Bruce Rennie.