-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed lookahead predicate from exprt (expression term).
I'm sure this will break something, but the predicate was causing Proparse to hang when processing very long IF THEN ELSE IF THEN ELSE chains. Please report any new issues! I think this might break some newer syntax where keywords are (now) allowed to be used as class, method, and property names.
- Loading branch information
Showing
7 changed files
with
936 additions
and
904 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#Build Number for ANT. Do not edit! | ||
#Wed Oct 07 14:00:29 PDT 2015 | ||
build.number=1124 | ||
#Thu Oct 08 11:24:45 PDT 2015 | ||
build.number=1126 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Test that long IF THEN ELSE IF THEN ELSE chains don't cause Proparse to hang. | ||
In proparse.g, I had a lookahead predicate in exprt like this: | ||
(exprt2)=> exprt2 | ||
I think I had added that lookahead predicate back in 2009: | ||
"First steps toward support of static member references and namespace.class | ||
names using reserved keywords" | ||
That lookahead predicate resulted in the parser to hang on the following code. | ||
I found at around 10 ELSE conditions, I could see Proparse taking a few seconds | ||
to process this, then adding another ELSE seemed to increase the time, perhaps | ||
exponentially. Something like that anyway. | ||
So now (Oct 2015) I'm removing that lookahead predicate from proparse.g. | ||
I suspect doing this will break something, but my regression tests seem OK. | ||
(See newsyntax/102b/DisplayTest.p and Display.cls) | ||
*/ | ||
|
||
DEFINE VARIABLE lv-i AS INTEGER NO-UNDO. | ||
DEFINE VARIABLE lv-DescId AS CHARACTER NO-UNDO. | ||
|
||
DO lv-i = 1 TO 17 BY 1: | ||
|
||
ASSIGN | ||
lv-DescId = (IF lv-i = 1 THEN "Include In Tender?" | ||
ELSE IF lv-i = 2 THEN "Data Checked?" | ||
ELSE IF lv-i = 3 THEN "Authority To Accept?" | ||
ELSE IF lv-i = 4 THEN "Authority To Tender / Negotiate?" | ||
ELSE IF lv-i = 5 THEN "Authority To Terminate?" | ||
ELSE IF lv-i = 6 THEN "100Kw Site?" | ||
ELSE IF lv-i = 7 THEN "Tendered?" | ||
ELSE IF lv-i = 8 THEN "Interruptable" | ||
ELSE IF lv-i = 9 THEN "Tender Issue Status" | ||
ELSE IF lv-i = 10 THEN "Supplier Agreement Admin Problem?" | ||
ELSE IF lv-i = 11 THEN "View Front End Specification Records" | ||
ELSE IF lv-i = 12 THEN "Set Costing Parameters" | ||
ELSE IF lv-i = 13 THEN "Swap Columns..." | ||
ELSE IF lv-i = 14 THEN "Override Checks!" | ||
ELSE IF lv-i = 15 THEN "Energy Trading Override!" | ||
ELSE IF lv-i = 16 THEN "Add to Tender Basket" | ||
ELSE "Approval to Tender"). | ||
END. /* DO lv-i = 1 TO 17: */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* For testing keywords as class, property, method names */ | ||
|
||
class newsyntax.102b.Display: | ||
|
||
def public static property Message as char init "hello" get. set. | ||
|
||
method public static char For(): | ||
return "hi". | ||
end method. | ||
|
||
end class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using newsyntax.102b.*. | ||
|
||
compile newsyntax/102b/Display.cls. | ||
|
||
display Display:For(). | ||
display Display:Message. |
Oops, something went wrong.