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

Scheme: handle newline in define/set! line (5 days) #469

Conversation

masatake
Copy link
Member

The parser assumes a name is within the same line where define/set! appears.
This causes a crash.

This is a temporary fix to avoid crashes for unexpected
input. Eventually a token based parser will be needed.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This is a temporary fix to avoid crashes for unexpected
input. Eventually a token based parser will be needed.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The current parser cannot handle comment syntax.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The current parser cannot handle syntax for string literal.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake changed the title Scheme: handle newline in define/set! line Scheme: handle newline in define/set! line (5 days) Jul 28, 2015
@masatake
Copy link
Member Author

For S-expression based language like lisp and scheme, we need a way to define specialized parser.

--langdef=scheme
--sexp-scheme=define-macro/cadr/m,macro
--sexp-scheme=define-syntax/cadr/s,syntax

Kind letter [a-z] should be reserverd in ctags side.
Kind letter [A-Z] is for users.

--langdef=gauche{parent=scheme}
--sexp-gauche=define-class/cadr/c,class
--sexp-gauche=define-method/cadr/m,method

So ctags can be adapted to your define-xxx.

@vhda
Copy link
Contributor

vhda commented Jul 31, 2015

I would avoid the a --sex* option ;)

@masatake
Copy link
Member Author

@QingmingHe
Copy link
Contributor

What about defadvice in elisp:

(defadvice kill-region (before some-name activate)
  ...)

you can't use something like cadr to teach ctags to catch some-name. But --regex-* is useful in this case.

@masatake
Copy link
Member Author

Cadaddr

@masatake
Copy link
Member Author

I have no idea to hadle define-values.

(define-values (x y) ...

@masatake
Copy link
Member Author

c*adr

@QingmingHe
Copy link
Contributor

you use * to match anything of a list?

@masatake
Copy link
Member Author

Yes!
Still do you say regex is better?

@QingmingHe
Copy link
Contributor

I think ctags can treat

(define-values (x y) ...)

automatically.
User use cadr to catch (x y) and ctags find it to be a list, so ctags can tag each item of the list to be a variable or something else.

@QingmingHe
Copy link
Contributor

en, --rexp seems better

@masatake
Copy link
Member Author

We need destructuring here; ctags shoud make two tag entries: one for x, another for y.

@QingmingHe
Copy link
Contributor

another case:

(unless (symbolp some-symbol)
   (defcustome some-symbol ...

Ctags should parse lisp sexp by sexp rather line by line. So that ctags can find some-symbol.

@masatake
Copy link
Member Author

The same discussion can be done for xml based parser with xpointer.

--langdef=svg
--xpointer-svg=...

@masatake
Copy link
Member Author

With sexp based aproach we can deal with lisp families. A difficulty is how to handle the differences in comment syntax. Here we need code prism library. I wrote about it somewhere issue about keyword based parser guessing.

masatake added a commit that referenced this pull request Aug 2, 2015
…tion-line

Scheme: handle newline in define/set! line
@masatake masatake merged commit e6e4f2f into universal-ctags:master Aug 2, 2015
@masatake masatake deleted the scheme-handle-newline-in-definition-line branch August 2, 2015 07:40
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.

3 participants