-
Notifications
You must be signed in to change notification settings - Fork 647
Add support for Vala (finish work by Alberto Fanjul) #2661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
80eb228
Add initial Vala parser
masatake 8afc0ce
Improve Vala parser
albfan ff5490b
vala.c: fix some minor nits
rrthomas ff7263d
Vala: ignore attributes
rrthomas 63206bb
fixup! Improve Vala parser
masatake 47eda1a
Vala: support interfaces, argument lists of methods, methods, more ke…
rrthomas 5eb210d
More parser improvements
rrthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl |
This file contains hidden or 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 @@ | ||
| main input.gs 1;" method line:1 language:Genie |
This file contains hidden or 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 @@ | ||
| init | ||
| print "Hello World" |
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl |
This file contains hidden or 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 @@ | ||
| Delegate input.vala /^public delegate bool Delegate ();$/;" method line:2 language:Vala |
This file contains hidden or 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 @@ | ||
| [CCode (has_target="false")] | ||
| public delegate bool Delegate (); |
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl{signature} |
This file contains hidden or 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,12 @@ | ||
| main input.vala /^void main(string[] args) {$/;" method line:8 language:Vala signature:(string [] args) | ||
| Address input.vala /^public class Address {$/;" class line:15 language:Vala | ||
| country input.vala /^ string country;$/;" field line:16 language:Vala class:Address typeref:typename:string | ||
| city input.vala /^ public string city;$/;" field line:17 language:Vala class:Address typeref:typename:string | ||
| street input.vala /^ protected string street;$/;" field line:18 language:Vala class:Address typeref:typename:string | ||
| building input.vala /^ internal int building;$/;" field line:19 language:Vala class:Address typeref:typename:int | ||
| floor input.vala /^ private int floor;$/;" field line:20 language:Vala class:Address typeref:typename:int | ||
| Person input.vala /^class Person {$/;" class line:23 language:Vala | ||
| address input.vala /^ public Address address {get; set;}$/;" property line:24 language:Vala class:Person typeref:unknown:Address | ||
| name input.vala /^ public string name {get; set;}$/;" property line:25 language:Vala class:Person typeref:typename:string | ||
| d_age input.vala /^ private int d_age;$/;" field line:26 language:Vala class:Person typeref:typename:int | ||
| age input.vala /^ public int age {$/;" property line:28 language:Vala class:Person typeref:typename:int |
This file contains hidden or 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 @@ | ||
| /* | ||
| * vala HelloWorld | ||
| * | ||
| * $ valac input.vala | ||
| * $ ./input | ||
| * Hello John, you're 21 years old | ||
| */ | ||
| void main(string[] args) { | ||
| var p = new Person(); | ||
| p.name = "John"; | ||
| p.age = 21; | ||
| print("Hello %s, you're %d years old\n", p.name, p.age); | ||
| } | ||
|
|
||
| public class Address { | ||
| string country; | ||
| public string city; | ||
| protected string street; | ||
| internal int building; | ||
| private int floor; | ||
| } | ||
|
|
||
| class Person { | ||
| public Address address {get; set;} | ||
| public string name {get; set;} | ||
| private int d_age; | ||
|
|
||
| public int age { | ||
| get { return d_age;} | ||
| set { | ||
| if (value > 0) { | ||
| d_age = value; | ||
| } else { | ||
| d_age = 0; | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl |
This file contains hidden or 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 @@ | ||
| f1 input.vala /^void f1 () {$/;" method line:1 language:Vala | ||
| f2 input.vala /^void f2 () {print ("hello");} \/\/ void g3 () { print ("hello");}$/;" method line:7 language:Vala | ||
| f3 input.vala /^void f3 () {print ("hello");} void g4 () { print ("hello");}$/;" method line:8 language:Vala | ||
| g4 input.vala /^void f3 () {print ("hello");} void g4 () { print ("hello");}$/;" method line:8 language:Vala | ||
| f4 input.vala /^void f4 () {print ("hello"); \/\/ void g5 () { print ("hello");}$/;" method line:9 language:Vala | ||
| g7 input.vala /^} void g7 () { print ("hello");} \/\/ void g8 () {} ; void f5 () { print ("hello");} # void g/;" method line:11 language:Vala |
This file contains hidden or 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 @@ | ||
| void f1 () { | ||
| print ("hello"); | ||
| } | ||
| // void g0 () { print ("hello");} | ||
| // void g1 () { print ("hello");} | ||
|
|
||
| void f2 () {print ("hello");} // void g3 () { print ("hello");} | ||
| void f3 () {print ("hello");} void g4 () { print ("hello");} | ||
| void f4 () {print ("hello"); // void g5 () { print ("hello");} | ||
| // void g6 () { print ("hello");} | ||
| } void g7 () { print ("hello");} // void g8 () {} ; void f5 () { print ("hello");} # void g9 () {} |
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl{signature} |
This file contains hidden or 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 @@ | ||
| main input.vala /^void main(string[] args) {$/;" method line:4 language:Vala signature:(string [] args) | ||
| sum input.vala /^int sum(int sum1, int sum2) {$/;" method line:8 language:Vala signature:(int sum1, int sum2) |
This file contains hidden or 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,10 @@ | ||
| /* | ||
| * vala sum | ||
| */ | ||
| void main(string[] args) { | ||
| print("Sum is: %d\n", sum(1,2)); | ||
| } | ||
|
|
||
| int sum(int sum1, int sum2) { | ||
| return sum1 + sum2; | ||
| } |
This file contains hidden or 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,19 @@ | ||
| Address input.vala /^ class Address {$/;" c namespace:Data | ||
| Contact input.vala /^ class Contact {$/;" c namespace:Data.Private | ||
| Data input.vala /^namespace Data {$/;" n | ||
| Person input.vala /^class Person {$/;" c | ||
| Private input.vala /^ namespace Private {$/;" n namespace:Data | ||
| address input.vala /^ public Data.Address address {get; set;}$/;" p class:Person typeref:class:Data.Address | ||
| age input.vala /^ public int age {$/;" p class:Person typeref:typename:int | ||
| building input.vala /^ public int building;$/;" f class:Data.Address typeref:typename:int | ||
| city input.vala /^ public string city;$/;" f class:Data.Address typeref:typename:string | ||
| country input.vala /^ public string country;$/;" f class:Data.Address typeref:typename:string | ||
| d_age input.vala /^ private int d_age;$/;" f class:Person typeref:typename:int | ||
| d_street input.vala /^ public string d_street;$/;" f class:Data.Address typeref:typename:string | ||
| email input.vala /^ public string email;$/;" f class:Data.Private.Contact typeref:typename:string | ||
| floor input.vala /^ public int floor;$/;" f class:Data.Address typeref:typename:int | ||
| id input.vala /^ public string id;$/;" f class:Data.Private.Contact typeref:typename:string | ||
| main input.vala /^void main(string[] args) {$/;" m | ||
| name input.vala /^ public string name {get; set;}$/;" p class:Person typeref:typename:string | ||
| phone input.vala /^ public string phone;$/;" f class:Data.Private.Contact typeref:typename:string | ||
| street input.vala /^ public string street {$/;" p class:Data.Address typeref:typename:string |
This file contains hidden or 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,55 @@ | ||
| using Data; | ||
|
|
||
| void main(string[] args) { | ||
| var p = new Person(); | ||
| var a = new Address(); | ||
| a.street = "Oxford Street"; | ||
| p.address = a; | ||
| p.name = "John"; | ||
| p.age = 21; | ||
| print("Hello %s, you're %d years old\nliving in %s\n", p.name, p.age, p.address.street); | ||
| } | ||
|
|
||
| namespace Data { | ||
| class Address { | ||
| public string country; | ||
| public string city; | ||
| public string d_street; | ||
| public int building; | ||
| public int floor; | ||
|
|
||
| public string street { | ||
| owned get { | ||
| return d_street; | ||
| } | ||
| set { | ||
| d_street = value; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| namespace Private { | ||
| class Contact { | ||
| public string email; | ||
| public string phone; | ||
| public string id; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| class Person { | ||
| public Data.Address address {get; set;} | ||
| public string name {get; set;} | ||
| private int d_age; | ||
|
|
||
| public int age { | ||
| get { return d_age;} | ||
| set { | ||
| if (value > 0) { | ||
| d_age = value; | ||
| } else { | ||
| d_age = 0; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| --sort=no | ||
| --fields=+neKl |
This file contains hidden or 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 @@ | ||
| main input.vala /^void main(string[] args) {$/;" method line:4 language:Vala |
This file contains hidden or 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 @@ | ||
| /* | ||
| * vala HelloWorld | ||
| */ | ||
| void main(string[] args) { | ||
| print("Hello, World\n"); | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, you can store "public" to "access:" field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint, I did wonder about this.