-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancements: - Better parser error recovery for incomplete and garbled class, method and property definitions (see #1086) Technical: - Rewrite the tokenizer lookahead mechanism so it reliably supports multiple levels of speculation - Replace use of string concatenation with interpolation throughout the compiler source
- Loading branch information
Showing
198 changed files
with
2,057 additions
and
1,378 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
] | ||
}, | ||
"ghul.compiler": { | ||
"version": "0.7.13", | ||
"version": "0.8.1", | ||
"commands": [ | ||
"ghul-compiler" | ||
] | ||
|
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 |
---|---|---|
|
@@ -25,4 +25,6 @@ | |
|
||
*.png binary | ||
*.exe binary | ||
*.dll binary | ||
*.dll binary | ||
|
||
integration-tests/parse/carriage-returns/test.ghul eol=crlf |
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,17 +1,17 @@ | ||
name: Trigger Dependabot | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
trigger-dependabot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger Dependabot | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/dispatches \ | ||
-d '{"event_type": "trigger-dependabot"}' | ||
name: Trigger Dependabot | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
trigger-dependabot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger Dependabot | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/dispatches \ | ||
-d '{"event_type": "trigger-dependabot"}' |
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,10 +1,10 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>0.7.13-alpha.2</Version> | ||
<Version>0.8.2-alpha.127</Version> | ||
<NoWarn>$(NoWarn);NU1507</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ghul.runtime" /> | ||
</ItemGroup> | ||
</Project> | ||
</Project> |
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,5 +1,5 @@ | ||
namespace Test is | ||
use Std = IO.Std; | ||
class Main is | ||
entry() static is | ||
namespace Test is | ||
use Std = IO.Std; | ||
|
||
class Main is | ||
entry() static is |
23 changes: 23 additions & 0 deletions
23
integration-tests/parse/function-nesting-error-1/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
2 changes: 2 additions & 0 deletions
2
integration-tests/parse/function-nesting-error-1/err.expected
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,2 @@ | ||
test.ghul: 13,13..13,28: error: expected function literal formal arguments | ||
test.ghul: 15,24..15,29: error: cannot return value of type Ghul.int from function of type Test.IncompleteFunction.Test |
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 @@ | ||
|
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 @@ | ||
{ | ||
"compiler": "dotnet ../../../publish/ghul.dll", | ||
"source": [ | ||
"." | ||
] | ||
} |
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 @@ | ||
--type-check |
Empty file.
38 changes: 38 additions & 0 deletions
38
integration-tests/parse/function-nesting-error-1/test.ghul
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,38 @@ | ||
namespace Test.IncompleteFunction is | ||
class Test is | ||
count: int; | ||
|
||
f(i: int) -> int is | ||
return 0 | ||
si | ||
|
||
g(i:int) -> int is | ||
count = count - 1; | ||
return 0; | ||
|
||
"asdf" (i: int) -> Test is | ||
count = count - 1; | ||
return count; | ||
si | ||
|
||
si | ||
|
||
i(i: int) -> Test is | ||
let x = if count > 0 then | ||
"count is {count}" | ||
else | ||
"count is 0" | ||
fi; | ||
|
||
if count > 0 then | ||
return null | ||
else | ||
return null | ||
fi | ||
si | ||
|
||
j(i: int) -> int is | ||
return count | ||
si | ||
si | ||
si |
Empty file.
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 @@ | ||
test.ghul: 38,15..38,17: error: in definition: expected @, [, class, enum, identifier, namespace, operator, struct, trait or use but found is | ||
test.ghul: 38,15..38,17: error: in member: expected :, ;, = or => but found is | ||
test.ghul: 38,5..38,14: error: syntax error: expected is but found identifier ICS_STATE |
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 |
---|---|---|
|
@@ -71,4 +71,8 @@ namespace Test is | |
return diagnostics_for_path; | ||
si | ||
si | ||
|
||
class CHECK is | ||
|
||
si | ||
si |
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
integration-tests/parse/incomplete-function-10/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
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 @@ | ||
test.ghul: 13,13..13,22: error: nested function definition |
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 @@ | ||
|
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 @@ | ||
{ | ||
"compiler": "dotnet ../../../publish/ghul.dll", | ||
"source": [ | ||
"." | ||
] | ||
} |
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 @@ | ||
--type-check |
Empty file.
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,47 @@ | ||
namespace Test.IncompleteFunction is | ||
class Test is | ||
count: int; | ||
|
||
f(i: int) -> int is | ||
return 0 | ||
si | ||
|
||
g(i:int) -> int is | ||
count = count - 1; | ||
return 0; | ||
|
||
h(i: int) -> Test is | ||
// let x = if count > 0 then | ||
// "count is {count}" | ||
// else | ||
// "count is 0" | ||
// fi; | ||
|
||
if count > 0 then | ||
return null | ||
else | ||
return null | ||
fi | ||
si | ||
|
||
si | ||
|
||
i(i: int) -> Test is | ||
let x = if count > 0 then | ||
"count is {count}" | ||
else | ||
"count is 0" | ||
fi; | ||
|
||
if count > 0 then | ||
return null | ||
else | ||
return null | ||
fi | ||
si | ||
|
||
j(i: int) -> int is | ||
return count | ||
si | ||
si | ||
si |
Empty file.
23 changes: 23 additions & 0 deletions
23
integration-tests/parse/incomplete-function-9/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
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 @@ | ||
test.ghul: 13,9..13,18: error: expected 'si' after member definition |
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 @@ | ||
|
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 @@ | ||
{ | ||
"compiler": "dotnet ../../../publish/ghul.dll", | ||
"source": [ | ||
"." | ||
] | ||
} |
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 @@ | ||
--type-check |
Empty file.
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,45 @@ | ||
namespace Test.IncompleteFunction is | ||
class Test is | ||
count: int; | ||
|
||
f(i: int) -> int is | ||
return 0 | ||
si | ||
|
||
g(i:int) -> int is | ||
count = count - 1; | ||
return 0; | ||
|
||
h(i: int) -> Test is | ||
// let x = if count > 0 then | ||
// "count is {count}" | ||
// else | ||
// "count is 0" | ||
// fi; | ||
|
||
if count > 0 then | ||
return null | ||
else | ||
return null | ||
fi | ||
si | ||
|
||
i(i: int) -> Test is | ||
let x = if count > 0 then | ||
"count is {count}" | ||
else | ||
"count is 0" | ||
fi; | ||
|
||
if count > 0 then | ||
return null | ||
else | ||
return null | ||
fi | ||
si | ||
|
||
j(i: int) -> int is | ||
return count | ||
si | ||
si | ||
si |
Empty file.
Oops, something went wrong.