Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#13 Parser for Rapid (ABB Robots)

open
nobody
None
5
2002-08-30
2002-08-30
Anonymous
No

I have written a parser for Rapid, the programming
language for ABB Robots. It's not exactly fast but since
the program size of most programs is relatively small,
it’s fast enough. For details of how to integrate it with
Ctags please read Extending.html provide with the
source code.
I’m including the code here. Just remember that this
code and information are provided "AS IS" without
warranty of any kind, either expressed or implied,
including but not limited to the implied warranties of
merchantability and/or fitness for a particular purpose. It
works well for me, but use it at your own risk.
Regards,
Rahul

/*****************************************************************
**********
* Rapid.c
* Regex callback-based parser for Rapid definitions
* By Rahul Virli
* This code and information are provided "AS IS"
without warranty
* of any kind, either expressed or implied, including but
not
* limited to the implied warranties of merchantability
and/or
* fitness for a particular purpose.

******************************************************************
********/
/* INCLUDE FILES */
#include "general.h" /* always include first */
#include "parse.h" /* always include */

/* FUNCTION DEFINITIONS */

static void installRapidRegex (const langType language)
{

addTagRegex (language,
"^[ \t]*(LOCAL)?[ \t]*FUNC[ \t]+[A-Z0-9_]+[
\t]+([A-Z0-9_]+)",
"\\2",
"f,function",
"i");

addTagRegex (language,
"^[ \t]*(LOCAL)?[ \t]*(PROC|TRAP)[ \t]+([A-
Z0-9_]+)",
"\\3",
"p,procedures",
"i");

addTagRegex (language,
"^[ \t]*(LOCAL)?[ \t]*(VAR|PERS|CONST)[
\t]+[A-Z0-9_]+[ \t]+([A-Z0-9_]+)",
"\\3",
"v,variable",
"i");

}

/* Create parser definition stucture */
extern parserDefinition* RapidParser (void)
{
static const char *const extensions [] =
{"prg", "mod", NULL };
parserDefinition* def = parserNew ("Rapid");
def->extensions = extensions;
def->initialize = installRapidRegex;
def->regex = TRUE;
return def;
}

Discussion