Author Topic: Adding new language to SE  (Read 9219 times)

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #15 on: July 27, 2018, 03:51:13 PM »
Sorry for the delay as I was out of the office yesterday.

Yes, I had changed the Document type to the new language.
It appears that the symbols are showing up, in the Defs.  But when hovering any of those symbols in the source they report "Symbol Color: Symbol not found."  Moreover, tagging keys (^+/, ^+., etc.) pop up a similar error (see attached image).

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Adding new language to SE
« Reply #16 on: July 27, 2018, 04:30:27 PM »
For me, the hover over help for "Unix Assembly" (the original), seems to only works sometimes (mostly not work). If you use the original Language "Unix Assembly" and tweak it, does it actually work for you?

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #17 on: July 27, 2018, 05:34:17 PM »
Well, it doesn't anymore (Nothing reported in Defs, now).   It was yesterday.  I have the nasty feeling that adding and removing the same language several times has caused it to lose its mind.

I had tweaked some of the coloring (and added several missing keywords), but those shouldn't have impacted the tagging.

Time to uninstall and reinstall the beta.

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #18 on: July 27, 2018, 05:47:37 PM »
After uninstalling and reinstalling the beta (and letting it import my configuration from 2017), I got my symbols back and their colorings (for the Unix Assembly language configured for MIPS).

If it helps, attached is my exported options for SE23.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Adding new language to SE
« Reply #19 on: July 27, 2018, 08:09:00 PM »
Thanks for posting your options. I see you've got Symbol coloring turned on.

We will look into this more


Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Adding new language to SE
« Reply #20 on: July 27, 2018, 08:17:15 PM »
For a language such as Assembly, there are some settings for Symbol Coloring that would be a bit more sensible to use:

Document > Unix Assembly Options... > View > Symbol Coloring

    [ ] Highlight Unidentified symbols (turn this off - too may false-negatives)
    Symbol Lookup:  Use fast, simplitic symbol lookups (symbol name only)

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #21 on: July 27, 2018, 08:51:07 PM »
Thanks for posting your options. I see you've got Symbol coloring turned on.

We will look into this more

Thanks.  There are a few other issues, but I'm trying to localize them before posting.

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #22 on: July 27, 2018, 08:54:05 PM »
For a language such as Assembly, there are some settings for Symbol Coloring that would be a bit more sensible to use:

Document > Unix Assembly Options... > View > Symbol Coloring

    [ ] Highlight Unidentified symbols (turn this off - too may false-negatives)
    Symbol Lookup:  Use fast, simplitic symbol lookups (symbol name only)

For when it works, this makes sense.  However, what I've encountered is that I can't clone (reliably) the language and get tagging to work after the fact.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Adding new language to SE
« Reply #23 on: July 27, 2018, 08:56:03 PM »
We will be looking into this

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Adding new language to SE
« Reply #24 on: July 27, 2018, 09:43:32 PM »
I have identified a bug in the Unix Assembly tagging setup, as well as a separate bug with Symbol Coloring when using the simplistic lookup.  Your test case hit the nail on the head.  Both bugs will be fixed in v23 beta2.

b

  • Senior Community Member
  • Posts: 325
  • Hero Points: 26
Re: Adding new language to SE
« Reply #25 on: July 30, 2018, 03:37:00 PM »
Sweet.  I look forward to the fix.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: Adding new language to SE
« Reply #26 on: October 04, 2018, 12:32:23 PM »
Reviving this thread.
I would like to add tagging support for TLA+. To navigate to a tag, assuming my TLA file was tagged, regular push-tag should do the job. The question is how to generate tags. Looking through pascal.e I found _pas_find_context_tags(). There are multiple other functions named _XXX_find_context_tags(). Presumably I have to implement _tla_find_context_tags(). The function should use API from tagsdb.sh to find tags in a given TLA file.
How do I make SE use this function? For most languages, I don't see an explicit call to their _XXX_find_context_tags().

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Adding new language to SE
« Reply #27 on: October 04, 2018, 02:05:04 PM »
It's pretty hard to write a full parser. You'd be better off just writing a tla_proc_search() function.  You should be able to pick up quite a lot. The downsides with a xxx_proc_search function is that it is slower (because it's in Slick-C), it typically doesn't bother dealing with scope (just insert everything as global symbols of some type), and it never supports statement level tagging (that would be insanely too slow). However, it is way easier to implement one of these and it's usually quite a bit better than not having anything.  plsql_proc_search() is a reasonably simple example. You might need something a little trickier for TLA+ since I saw some variable declarations with commas. Basic idea is to make a regex to find the start of a potential declaration and then figure out the type and name (or names in the comma case) for them.

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Adding new language to SE
« Reply #28 on: October 04, 2018, 02:34:54 PM »
FWIW, the original blog post you referenced explains how to write a proc_search(), as well as several other callbacks, including the _find_context_tags() callback, which is optional.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: Adding new language to SE
« Reply #29 on: October 04, 2018, 02:36:45 PM »
Sounds good. I'll look into that.