Author Topic: Custom ASM definition & symbols  (Read 808 times)

jc44

  • Senior Community Member
  • Posts: 144
  • Hero Points: 5
Custom ASM definition & symbols
« on: February 13, 2017, 01:49:53 pm »
Hi

I'm doing some work in an unusual assembler (qasm for Broadcom VideoCore IV).  I've found the general custom file type stuff (comments keywords etc.), but I'd really like to define symbols/labels s.t. they turn up in the "Defs" pane.  They are defined as one or two colons as the first thing on a line followed by alphanumeric.  Is there any way of achieving this?

Thanks

John Cox


Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2364
  • Hero Points: 319
Re: Custom ASM definition & symbols
« Reply #1 on: February 16, 2017, 03:08:07 pm »
A good proc-search function to start with is the bat_proc_search() (for Windows batch files).

From the SlickEdit command line, type in "fp bat_proc_search", and hit enter.

Then copy it to your language module, change the language ID from "bat" to whatever you are using, and adjust the regular expression to work with your language.

Code: [Select]
/**
 * Search for labels in a QASM file.
 *
 * @param proc_name    (reference) proc to search for, or set to name of proc found
 * @param find_first   find first proc, or find next?
 *
 * @return 0 on success, nonzero on error or if no more tags.
 */
_str qasm_proc_search(_str &proc_name,boolean find_first)
{
   if ( proc_name:=='' ) {
      proc_name = _clex_identifier_re();
   } else {
      proc_name=_escape_re_chars(proc_name);
      parse proc_name with proc_name '(' .;
   }
   status := 0;
   search_key := '^\:\:?{'proc_name'} *';
   if ( find_first ) {
      status=search(search_key,'@rhiXcs');
   } else {
      status=repeat_search();
   }
   if ( !status ) {
      word := strip(get_text(match_length('0'),match_length('S0')),'T');
      proc_name=word'(label)';
   }
   return status;
}

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4174
  • Hero Points: 300
Re: Custom ASM definition & symbols
« Reply #2 on: February 16, 2017, 10:25:41 pm »
To clarify, "bat" is a language id (p_LangId) which is always a valid slick-C identifier. If you don't know what yours is, print it with "say(p_LangId);".