editors

changeset 42:3d5955166bdf

add ctags source and test files for simple euphoria regex parser
author ne1uno <ne1uno@users.sourceforge.net>
date Tue Nov 29 05:54:05 2011 -0400 (2011-11-29)
parents 4ba58a70989f
children 1bb7df51432a
files ctags/ReadMe.txt ctags/ctags-sample ctags/ctags_euphoria_test.e ctags/euphoria.c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ctags/ReadMe.txt	Tue Nov 29 05:54:05 2011 -0400
     1.3 @@ -0,0 +1,12 @@
     1.4 +get ctags source or binary from 
     1.5 +from http://ctags.sourceforge.net
     1.6 +
     1.7 +currently late 2011 you have to compile ctags to get euphoria language
     1.8 +add euphoria.c to the ctags source directory
     1.9 +replace eiffel language in parsers.h 
    1.10 +and in source.mak 2 places
    1.11 +
    1.12 +ran ctags. on ctags_euphoria_test.e and euphoria.e
    1.13 +to generate ctags-sample
    1.14 +
    1.15 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ctags/ctags-sample	Tue Nov 29 05:54:05 2011 -0400
     2.3 @@ -0,0 +1,17 @@
     2.4 +!_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
     2.5 +!_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
     2.6 +!_TAG_PROGRAM_AUTHOR	Darren Hiebert	/dhiebert@users.sourceforge.net/
     2.7 +!_TAG_PROGRAM_NAME	Exuberant Ctags	//
     2.8 +!_TAG_PROGRAM_URL	http://ctags.sourceforge.net	/official site/
     2.9 +!_TAG_PROGRAM_VERSION	Development	//
    2.10 +EuphoriaParser	.\euphoria.c	/^extern parserDefinition* EuphoriaParser (void)$/;"	f	line:53	signature:(void)
    2.11 +_1of1function	.\ctags_euphoria_test.e	/^function _1of1function() end function$/;"	f	line:14
    2.12 +_1of1memstruct	.\ctags_euphoria_test.e	/^memstruct _1of1memstruct$/;"	s	line:19
    2.13 +_1of1memtype	.\ctags_euphoria_test.e	/^memtype amemtype as _1of1memtype$/;"	m	line:17
    2.14 +_1of1memunion	.\ctags_euphoria_test.e	/^memunion _1of1memunion$/;"	s	line:22
    2.15 +_1of1procedure	.\ctags_euphoria_test.e	/^function _1of1procedure() end function$/;"	f	line:15
    2.16 +_1of4type	.\ctags_euphoria_test.e	/^public type _1of4type(object w)$/;"	t	line:8
    2.17 +_2of4type	.\ctags_euphoria_test.e	/^export type _2of4type(sequence z) end type$/;"	t	line:10
    2.18 +_3of4type	.\ctags_euphoria_test.e	/^global type _3of4type(integer y) end type$/;"	t	line:11
    2.19 +_4of4type	.\ctags_euphoria_test.e	/^override type _4of4type(atom x) end type$/;"	t	line:12
    2.20 +installEuphoriaRegex	.\euphoria.c	/^static void installEuphoriaRegex (const langType language)$/;"	f	line:26	file:	signature:(const langType language)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ctags/ctags_euphoria_test.e	Tue Nov 29 05:54:05 2011 -0400
     3.3 @@ -0,0 +1,25 @@
     3.4 +--t11B29a03:33 limited test file for ctags euphoria regex parser
     3.5 +--ctags_euphoria_test.e  (struct branch)
     3.6 +
     3.7 +include std/os.e
     3.8 +include std/sequence.e
     3.9 +include std/io.e
    3.10 +
    3.11 +public type _1of4type(object w)
    3.12 + end type
    3.13 +export type _2of4type(sequence z) end type
    3.14 +global type _3of4type(integer y) end type
    3.15 +override type _4of4type(atom x) end type
    3.16 +
    3.17 +function _1of1function() end function
    3.18 +function _1of1procedure() end function
    3.19 +
    3.20 +memtype amemtype as _1of1memtype
    3.21 +
    3.22 +memstruct _1of1memstruct
    3.23 +end memstruct
    3.24 +
    3.25 +memunion _1of1memunion
    3.26 +end memunion
    3.27 +
    3.28 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ctags/euphoria.c	Tue Nov 29 05:54:05 2011 -0400
     4.3 @@ -0,0 +1,61 @@
     4.4 +/*
     4.5 +*   $Id$
     4.6 +*
     4.7 +*   Copyright (c) 2008 by Jeremy Cowgar
     4.8 +*
     4.9 +*   This source code is released for free distribution under the terms of the
    4.10 +*   GNU General Public License.
    4.11 +*
    4.12 +*   This module contains functions for generating tags for Euphoria routines.
    4.13 +*   http://openeuphoria.org/
    4.14 +*
    4.15 +*   m11B28p05:33 ne1 add |public|override.  (mem)*type
    4.16 +*   	it's not ignoring function def inside multiline comments?
    4.17 +*   	next version should be full parser?
    4.18 +*/
    4.19 +
    4.20 +/*
    4.21 +*   INCLUDE FILES
    4.22 +*/
    4.23 +
    4.24 +#include "general.h"    /* always include first */
    4.25 +#include "parse.h"      /* always include */
    4.26 +
    4.27 +/* FUNCTION DEFINITIONS */
    4.28 +
    4.29 +static void installEuphoriaRegex (const langType language)
    4.30 +{
    4.31 +	//symbol names can't actually start with numbers, but we let it slide.
    4.32 +
    4.33 +    addTagRegex (language,
    4.34 +		"^(global|export|public|override)*[ \t\n]*function[ \t\n]+([a-zA-Z0-9_]+)",
    4.35 +								"\\2", "f,function", NULL);
    4.36 +    addTagRegex (language,
    4.37 +		"^(global|export|public|override)*[ \t\n]*procedure[ \t\n]+([a-zA-Z0-9_]+)",
    4.38 +								"\\2", "p,procedure", NULL);
    4.39 +    addTagRegex (language,
    4.40 +		"^(global|export|public|override)*[ \t\n]*type[ \t\n]+([a-zA-Z0-9_]+)",
    4.41 +								"\\2", "t,type", NULL);
    4.42 +
    4.43 +    //memtype might be a list and it would only get the first one 
    4.44 +    addTagRegex (language,
    4.45 +		"^(global|export|public|override)*[ \t\n]*memtype[ \t\n]+([a-zA-Z0-9_]+)[ \t\n]+as[ \t\n]+([a-zA-Z0-9_]+)",
    4.46 +								"\\3", "m,memtype", NULL);
    4.47 +
    4.48 +	//memstruct/union/type currently in a branch. not sure ctags can capture them?
    4.49 +    addTagRegex (language,
    4.50 +		"^(global|export|public|override)*[ \t\n]*mem(struct|union)+[ \t\n]+([a-zA-Z0-9_]+)",
    4.51 +								"\\3", "s,mem\\2", NULL);
    4.52 +    //namespace and memtype similar
    4.53 +}
    4.54 +
    4.55 +/* Create parser definition stucture */
    4.56 +extern parserDefinition* EuphoriaParser (void)
    4.57 +{
    4.58 +    static const char *const extensions [] = { "e", "ed", "ew", "ex", "exu", "exw", "exd", NULL };
    4.59 +    parserDefinition* const def = parserNew ("Euphoria");
    4.60 +    def->extensions = extensions;
    4.61 +    def->initialize = installEuphoriaRegex;
    4.62 +    def->regex      = TRUE;
    4.63 +    return def;
    4.64 +}

SCM Home | OpenEuphoria.org Home