Skip to content
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

WIP: Vala #2320

Closed
wants to merge 19 commits into from
Closed

WIP: Vala #2320

wants to merge 19 commits into from

Conversation

albfan
Copy link
Contributor

@albfan albfan commented Nov 13, 2019

Work in progress for vala parser.

Written from scratch.

Right now is just a plain copy/paste from tcl parser

relates to #621

@coveralls
Copy link

coveralls commented Nov 13, 2019

Coverage Status

Coverage increased (+0.04%) to 86.407% when pulling 7692199 on albfan:vala into 2ebf5b1 on universal-ctags:master.

@albfan
Copy link
Contributor Author

albfan commented Nov 16, 2019

I think this is a wrong way to approach the implementation.

@albfan albfan closed this Nov 16, 2019
@albfan
Copy link
Contributor Author

albfan commented Nov 16, 2019

Reopening this as is the only acceptable approach to include vala into ctags.

@albfan albfan reopened this Nov 16, 2019
@codecov-io
Copy link

codecov-io commented Nov 16, 2019

Codecov Report

Merging #2320 into master will increase coverage by 0.03%.
The diff coverage is 92.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2320      +/-   ##
==========================================
+ Coverage   86.25%   86.29%   +0.03%     
==========================================
  Files         176      177       +1     
  Lines       35717    35921     +204     
==========================================
+ Hits        30808    30997     +189     
- Misses       4909     4924      +15
Impacted Files Coverage Δ
parsers/vala.c 92.64% <92.64%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ebf5b1...e45ea24. Read the comment docs.

/*
 * Vala Hello World
 */
void main(string[] args) {
    print("Hello, World\n");
}
[jet@living]~/var/ctags% ./ctags -o - /tmp/foo.vala
main	/tmp/foo.vala	/^void main(string[] args) {$/;"	m
@albfan albfan force-pushed the vala branch 5 times, most recently from 7e823e8 to 1b1b9eb Compare December 1, 2019 11:00
parsers/vala.c Outdated Show resolved Hide resolved
@albfan albfan force-pushed the vala branch 3 times, most recently from f405135 to 538a597 Compare December 2, 2019 14:48
@albfan
Copy link
Contributor Author

albfan commented Dec 2, 2019

@masatake I have first question on this parsers:

How to detect a vala field (inside a class) and a property (field with get and set:

class Address {
   public string street; 
   ...
}

class Person {
   public Address address;
   public string name {get; set;}
   ...
}

Understanding this seems the key to me. (maybe I should reread the links you suggest right now?)

@masatake
Copy link
Member

masatake commented Dec 2, 2019

How to detect a vala field (inside a class) and a property (field with get and set:

Please show the pair of "input.vala" and "exepected.tags". The pair is very important for me to understand what you need. If you cannot image "expected.tags" for the input, I cannot help you. In that case, what you have to do is reading ctags(1) man page carefully.

@albfan
Copy link
Contributor Author

albfan commented Dec 2, 2019

I added a review comment in expected.ctags that will be my approach to reimplement this, and once I see how to understand the scope for a tag (things inside a pair) things that depends on several previous tokens I will figure out myself the rest.

Thanks for help here!

@masatake
Copy link
Member

masatake commented Dec 2, 2019

I promised @k-takata I will focus on releasing related work till we can find a long term volunteer who drives the documentation related work of this project.

So I will show only sample code. I hope it helps you.
Ideally, I should consider the work of your side.

$ cat foo.vala
void main(string[] args) {
    print("Hello, World\n");
}

class Address {
   public string street;
}

$ ./ctags -o - ./foo.vala
./ctags -o - ./foo.vala
Address	./foo.vala	/^class Address {$/;"	c	language:Vala
main	./foo.vala	/^void main(string[] args) {$/;"	m	language:Vala
$ cat foo.vala
void main(string[] args) {
    print("Hello, World\n");
}

class Address {
   public string street;
   int floor;
}
$ ./ctags -o - --fields=+a ./foo.vala
 ./ctags -o - --fields=+a ./foo.vala
Address	./foo.vala	/^class Address {$/;"	c	language:Vala
floor	./foo.vala	/^   int floor;	   $/;"	f	language:Vala	class:Address	typeref:unknown:int
main	./foo.vala	/^void main(string[] args) {$/;"	m	language:Vala
street	./foo.vala	/^   public string street;$/;"	f	language:Vala	class:Address	typeref:typename:string	access:public

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
$ cat foo.vala
void main(string[] args) {
    print("Hello, World\n");
}

class Address {
   public string street;
   int floor;
}

class Person {
   public Address address;
   public string name {get; set;}
}

$ ./ctags --sort=no -o - --fields=+a ./foo.vala
main	./foo.vala	/^void main(string[] args) {$/;"	m	language:Vala
Address	./foo.vala	/^class Address {$/;"	c	language:Vala
street	./foo.vala	/^   public string street;$/;"	f	language:Vala	class:Address	typeref:typename:string	access:public
floor	./foo.vala	/^   int floor;	   $/;"	f	language:Vala	class:Address	typeref:unknown:int
Person	./foo.vala	/^class Person {$/;"	c	language:Vala
address	./foo.vala	/^   public Address address;$/;"	f	language:Vala	class:Person	typeref:unknown:Address	access:public
name	./foo.vala	/^   public string name {get; set;}$/;"	p	language:Vala	class:Person	typeref:typename:string	access:public
@masatake
Copy link
Member

masatake commented Dec 2, 2019

See #621. I updated my branch.

@albfan
Copy link
Contributor Author

albfan commented Dec 2, 2019

@masatake I think I get it. I rebase this on top of your branch (I rebased on top of master too.

parseClassBody is really helpful. Let's see if I can complete the rest on my own.

* tokenCat
* tokenLast

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…eninfo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
    $ cat /tmp/foo.vala
    class Person {
       public Data.Address address;
    }
    $ ./ctags -o - /tmp/foo.vala
    Person	/tmp/foo.vala	/^class Person {$/;"	c
    address	/tmp/foo.vala	/^   public Data.Address address;$/;"	f	class:Person	typeref:class:Data.Address
    $ cat /tmp/foo.vala
    /*
     * Vala Hello World
     */
    void main(string[] args) {
	print("Hello, World\n");
    $ ./ctags -o - --fields=+S /tmp/foo.vala
    main	/tmp/foo.vala	/^void main(string[] args) {$/;"	m	signature:(string [] args)
    $ cat /tmp/foo.vala
    void main(string[] args) {
	print("Hello, World\n");
    }

    class Address {
       public string street;
       int floor;
    }

    class Person {
       public Address address;
       public string name {get; set;}
    }
    $ ./ctags -o - --sort=no --extras=+q /tmp/foo.vala
    main	/tmp/foo.vala	/^    void main(string[] args) {$/;"	m	language:Vala
    Address	/tmp/foo.vala	/^    class Address {$/;"	c	language:Vala
    street	/tmp/foo.vala	/^       public string street;$/;"	f	language:Vala	class:Address	typeref:typename:string
    Address.street	/tmp/foo.vala	/^       public string street;$/;"	f	language:Vala	class:Address	typeref:typename:string
    floor	/tmp/foo.vala	/^       int floor;$/;"	f	language:Vala	class:Address	typeref:unknown:int
    Address.floor	/tmp/foo.vala	/^       int floor;$/;"	f	language:Vala	class:Address	typeref:unknown:int
    Person	/tmp/foo.vala	/^    class Person {$/;"	c	language:Vala
    address	/tmp/foo.vala	/^       public Address address;$/;"	f	language:Vala	class:Person	typeref:unknown:Address
    Person.address	/tmp/foo.vala	/^       public Address address;$/;"	f	language:Vala	class:Person	typeref:unknown:Address
    name	/tmp/foo.vala	/^       public string name {get; set;}$/;"	p	language:Vala	class:Person	typeref:typename:string
    Person.name	/tmp/foo.vala	/^       public string name {get; set;}$/;"	p	language:Vala	class:Person	typeref:typename:string
@albfan albfan force-pushed the vala branch 3 times, most recently from 4d2f4ed to 1c3b2ad Compare December 7, 2019 06:37
@albfan
Copy link
Contributor Author

albfan commented Dec 8, 2019

Closing in favor of masatake#6 where the development is really happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants