* Python parser for SN
@ 2000-08-03 0:17 Thomas Heller
2000-08-03 0:34 ` Ben Elliston
2000-08-03 2:00 ` Mo DeJong
0 siblings, 2 replies; 10+ messages in thread
From: Thomas Heller @ 2000-08-03 0:17 UTC (permalink / raw)
To: sourcenav
This patch contains a python parser and syntax highlighting for
python.
Since I don't have automake on my development system (I use NT),
i had to write Makefile.in's and Makefile.am's by hand.
Enjoy!
Thomas Heller
diff -c2rN SN451-p0005/snavigator/ChangeLog SN451/snavigator/ChangeLog
*** SN451-p0005/snavigator/ChangeLog Tue Aug 1 17:06:04 2000
--- SN451/snavigator/ChangeLog Tue Aug 1 19:29:42 2000
***************
*** 1,2 ****
--- 1,23 ----
+ 2000-08-01 Thomas Heller <thomas.heller@ion-tof.com>
+
+ * parsers/python/README: New file.
+ * parsers/python/pybrowser.l: New file.
+ * parsers/python/Makefile.in: New file.
+ * parsers/python/Makefile.am: New file.
+
+ * parsers/Makefile.in: Added python parser subdir.
+ * parsers/Makefile.am: Added python parser subdir.
+
+ * etc/sn_prop.cfg.in: Python parser support.
+ * configure.in: Python parser support.
+ * configure: Python parser support.
+
+ * hyper/py_high.l: New file. Python syntax highlight support.
+
+ * hyper/Makefile.in: Python syntax highlight support.
+ * hyper/Makefile.am: Python syntax highlight support.
+ * hyper/highlight.c: Python syntax highlight support.
+ * gui/sninit.tcl: Python syntax highlight support.
+
2000-07-27 Warren Jones <wjones@tc.fluke.com>
diff -c2rN SN451-p0005/snavigator/configure SN451/snavigator/configure
*** SN451-p0005/snavigator/configure Wed Apr 12 19:52:50 2000
--- SN451/snavigator/configure Tue Aug 1 19:06:53 2000
***************
*** 4351,4354 ****
--- 4351,4355 ----
parsers/sendmail/Makefile
parsers/tcl/Makefile
+ parsers/python/Makefile
parsers/java/Makefile
parsers/libjcreuse/Makefile
***************
*** 4579,4582 ****
--- 4580,4584 ----
parsers/sendmail/Makefile
parsers/tcl/Makefile
+ parsers/python/Makefile
parsers/java/Makefile
parsers/libjcreuse/Makefile
diff -c2rN SN451-p0005/snavigator/configure.in SN451/snavigator/configure.in
*** SN451-p0005/snavigator/configure.in Tue Aug 1 17:01:12 2000
--- SN451/snavigator/configure.in Tue Aug 1 19:07:41 2000
***************
*** 407,410 ****
--- 407,411 ----
parsers/sendmail/Makefile
parsers/tcl/Makefile
+ parsers/python/Makefile
parsers/java/Makefile
parsers/libjcreuse/Makefile
diff -c2rN SN451-p0005/snavigator/etc/sn_prop.cfg.in SN451/snavigator/etc/sn_prop.cfg.in
*** SN451-p0005/snavigator/etc/sn_prop.cfg.in Tue Jun 29 00:09:02 1999
--- SN451/snavigator/etc/sn_prop.cfg.in Tue Aug 1 19:09:22 2000
***************
*** 243,246 ****
--- 243,253 ----
-high_cmd $sn_path(bindir)/chbrowser
+ # Python
+
+ sn_add_parser python \
+ -suffix {*.py *.pyw} \
+ -brow_cmd $sn_path(bindir)/pybrowser \
+ -high_cmd $sn_path(bindir)/pybrowser
+
# Files without a parser
diff -c2rN SN451-p0005/snavigator/gui/sninit.tcl SN451/snavigator/gui/sninit.tcl
*** SN451-p0005/snavigator/gui/sninit.tcl Tue Mar 14 19:40:21 2000
--- SN451/snavigator/gui/sninit.tcl Tue Aug 1 19:11:02 2000
***************
*** 647,651 ****
set sn_options(def,localhost) "127.0.0.1"
! set sn_options(sys,builtin-highlighting) {c++ java tcl chill}
set sn_options(sys,language-with-xref) {c++ java tcl fortran chill}
--- 647,651 ----
set sn_options(def,localhost) "127.0.0.1"
! set sn_options(sys,builtin-highlighting) {c++ java tcl chill python}
set sn_options(sys,language-with-xref) {c++ java tcl fortran chill}
diff -c2rN SN451-p0005/snavigator/hyper/Makefile.am SN451/snavigator/hyper/Makefile.am
*** SN451-p0005/snavigator/hyper/Makefile.am Sat Feb 12 00:50:31 2000
--- SN451/snavigator/hyper/Makefile.am Tue Aug 1 19:15:04 2000
***************
*** 55,59 ****
hyper_SOURCES = compare.h compare.c dbsym.c exint.c \
recudir.c services.c tclsql.c tclxlist.c tcl_high.c c_high.c ch_high.c \
! j_high.c highlight.c tclfileutils.c
hyper_LDFLAGS = $(WIN32LDAPP)
--- 55,59 ----
hyper_SOURCES = compare.h compare.c dbsym.c exint.c \
recudir.c services.c tclsql.c tclxlist.c tcl_high.c c_high.c ch_high.c \
! j_high.c py_high.c highlight.c tclfileutils.c
hyper_LDFLAGS = $(WIN32LDAPP)
***************
*** 87,90 ****
--- 87,93 ----
j_high.c: j_high.l
$(LEX) -t > $@ $(LFLAGS) -Pjava_highlight_ $<
+
+ py_high.c: py_high.l
+ $(LEX) -t > $@ $(LFLAGS) -Ppy_highlight_ $<
c_high.c: c_high.l
diff -c2rN SN451-p0005/snavigator/hyper/Makefile.in SN451/snavigator/hyper/Makefile.in
*** SN451-p0005/snavigator/hyper/Makefile.in Tue Aug 1 17:01:54 2000
--- SN451/snavigator/hyper/Makefile.in Wed Aug 2 19:00:51 2000
***************
*** 226,230 ****
hyper_SOURCES = compare.h compare.c dbsym.c exint.c \
recudir.c services.c tclsql.c tclxlist.c tcl_high.c c_high.c ch_high.c \
! j_high.c highlight.c tclfileutils.c
--- 226,230 ----
hyper_SOURCES = compare.h compare.c dbsym.c exint.c \
recudir.c services.c tclsql.c tclxlist.c tcl_high.c c_high.c ch_high.c \
! j_high.c py_high.c highlight.c tclfileutils.c
***************
*** 260,264 ****
recudir.$(OBJEXT) services.$(OBJEXT) tclsql.$(OBJEXT) \
tclxlist.$(OBJEXT) tcl_high.$(OBJEXT) c_high.$(OBJEXT) \
! ch_high.$(OBJEXT) j_high.$(OBJEXT) highlight.$(OBJEXT) \
tclfileutils.$(OBJEXT)
CFLAGS = @CFLAGS@
--- 260,264 ----
recudir.$(OBJEXT) services.$(OBJEXT) tclsql.$(OBJEXT) \
tclxlist.$(OBJEXT) tcl_high.$(OBJEXT) c_high.$(OBJEXT) \
! ch_high.$(OBJEXT) j_high.$(OBJEXT) py_high.$(OBJEXT) highlight.$(OBJEXT) \
tclfileutils.$(OBJEXT)
CFLAGS = @CFLAGS@
***************
*** 484,487 ****
--- 484,490 ----
j_high.c: j_high.l
$(LEX) -t > $@ $(LFLAGS) -Pjava_highlight_ $<
+
+ py_high.c: py_high.l
+ $(LEX) -t > $@ $(LFLAGS) -Ppy_highlight_ $<
c_high.c: c_high.l
diff -c2rN SN451-p0005/snavigator/hyper/highlight.c SN451/snavigator/hyper/highlight.c
*** SN451-p0005/snavigator/hyper/highlight.c Sat Feb 12 00:50:43 2000
--- SN451/snavigator/hyper/highlight.c Tue Aug 1 19:13:20 2000
***************
*** 41,48 ****
--- 41,50 ----
int java_highlight_lex();
int ch_highlight_lex();
+ int py_highlight_lex();
void tcl_highlight_init_func(int maxs, int lineno, int charno, void (**func)(), void *idx1, void *idx2);
void c_highlight_init_func(int maxs, int lineno, int charno, void (**func)(), void *idx1, void *idx2);
void ch_highlight_init_func(int maxs, int lineno, int charno, void (**func)(), void *idx1, void *idx2);
void java_highlight_init_func(int maxs, int lineno, int charno, void (**func)(), void *idx1, void *idx2);
+ void py_highlight_init_func(int maxs, int lineno, int charno, void (**func)(), void *idx1, void *idx2);
static char *high_tag_names[] = {
***************
*** 277,280 ****
--- 279,287 ----
high_func = ch_highlight_lex;
high_init_func = ch_highlight_init_func;
+ }
+ else if (strcmp(language, "python") == 0)
+ {
+ high_func = py_highlight_lex;
+ high_init_func = py_highlight_init_func;
}
diff -c2rN SN451-p0005/snavigator/hyper/py_high.l SN451/snavigator/hyper/py_high.l
*** SN451-p0005/snavigator/hyper/py_high.l Thu Jan 1 01:00:00 1970
--- SN451/snavigator/hyper/py_high.l Tue Aug 1 19:21:02 2000
***************
*** 0 ****
--- 1,276 ----
+ /* -*- c -*- */
+ /*
+
+ Copyright (c) 2000, Red Hat, Inc.
+
+ This file is part of Source-Navigator.
+
+ Source-Navigator is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ Source-Navigator is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Source-Navigator; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+ /*
+ * py_high.l
+ *
+ * Written by Thomas Heller <thomas.heller@ion-tof.com>
+ *
+ * Description:
+ * A lex specification for a scanner to parse python files
+ * and highlight the source code.
+ */
+
+ %{
+ #include <ctype.h>
+
+ #include "highlight.h"
+
+ static long lineNumber = 1;
+ static int charNumber = 0;
+ static int lex_buf_size = YY_BUF_SIZE;
+ static void *user_data1;
+ static void *user_data2;
+
+ static void drop_until();
+ static void parse_triple();
+
+ #undef yywrap
+ #define YY_SKIP_YYWRAP 1
+ static int yywrap();
+ %}
+
+ %%
+
+ "#".*$ {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+ paf_high_pos.end_lineno = lineNumber + 1;
+ paf_high_pos.end_charno = 0;
+
+ charNumber += yyleng;
+
+ return PAF_HIGH_COMMENT;
+ }
+
+ \' {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+
+ charNumber += yyleng;
+
+ drop_until((int)'\'',(int)'\\');
+
+ paf_high_pos.end_lineno = lineNumber;
+ paf_high_pos.end_charno = charNumber;
+
+ return PAF_HIGH_STRING;
+ }
+
+ \"\"\" {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+ charNumber += yyleng;
+
+ parse_triple((int)'"');
+
+ paf_high_pos.end_lineno = lineNumber;
+ paf_high_pos.end_charno = charNumber;
+
+ return PAF_HIGH_STRING;
+ }
+
+ \'\'\' {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+ charNumber += yyleng;
+
+ parse_triple((int)'\'');
+
+ paf_high_pos.end_lineno = lineNumber;
+ paf_high_pos.end_charno = charNumber;
+
+ return PAF_HIGH_STRING;
+ }
+
+ \" {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+
+ charNumber += yyleng;
+
+ drop_until((int)'"',(int)'\\');
+
+ paf_high_pos.end_lineno = lineNumber;
+ paf_high_pos.end_charno = charNumber;
+
+ return PAF_HIGH_STRING;
+ }
+
+ and |
+ assert |
+ break |
+ class |
+ continue |
+ def |
+ del |
+ elif |
+ else |
+ except |
+ exec |
+ finally |
+ for |
+ from |
+ global |
+ if |
+ import |
+ in |
+ is |
+ lambda |
+ not |
+ or |
+ pass |
+ print |
+ raise |
+ return |
+ try |
+ while {
+ paf_high_pos.beg_lineno = lineNumber;
+ paf_high_pos.beg_charno = charNumber;
+ paf_high_pos.end_lineno = lineNumber;
+ paf_high_pos.end_charno = charNumber + yyleng;
+
+ charNumber += yyleng;
+
+ return PAF_HIGH_KEYWORD;
+ }
+
+ \n+ {
+ lineNumber += yyleng;
+ charNumber = 0;
+ }
+
+ \r+ {
+ }
+
+ [a-zA-Z0-9_]+ |
+ [ \t]+ |
+ . {
+ charNumber += yyleng;
+ }
+ %%
+
+ static void
+ parse_triple(int term)
+ {
+ int c;
+ int count;
+ while (1) {
+ c = input();
+ charNumber++;
+ if (c == term) {
+ ++count;
+ if (count == 3)
+ return;
+ } else {
+ count = 0;
+ switch (c) {
+ case '\\':
+ c = input();
+ if (c <= 0)
+ return;
+ if (c != '\n') {
+ charNumber++;
+ c = -1;
+ } else {
+ ++lineNumber;
+ }
+ break;
+
+ case '\n':
+ lineNumber++;
+ charNumber = -1;
+ break;
+
+ case '\r':
+ charNumber--;
+ break;
+
+ case EOF:
+ return;
+ }
+ }
+ }
+ }
+
+ static void
+ drop_until(int term, int esc)
+ {
+ int c, l = 0;
+
+ for (l = -1; ((c = (int)input()) != term || l == esc); l = c, charNumber++)
+ {
+ switch (c)
+ {
+ case '\\':
+ c = input();
+ if (c <= 0)
+ return;
+ if (c != '\n') {
+ charNumber++;
+ c = -1;
+ } else {
+ ++lineNumber;
+ }
+ break;
+
+ case '\n':
+ lineNumber++;
+ charNumber = -1;
+ return;
+
+ case '\r':
+ charNumber--;
+ break;
+
+ case EOF:
+ return;
+ }
+ }
+ charNumber++;
+ }
+
+ static int
+ yywrap()
+ {
+ return 1;
+ }
+
+ static void
+ flush_lex_scanner()
+ {
+ YY_FLUSH_BUFFER;
+ }
+
+ void
+ py_highlight_init_func(int maxs, int lineno, int charno, void *(*func), void *u_d1, void *u_d2)
+ {
+ lex_buf_size = maxs;
+ lineNumber = lineno;
+ charNumber = charno;
+ *func = flush_lex_scanner;
+ user_data1 = u_d1;
+ user_data2 = u_d2;
+ }
+
diff -c2rN SN451-p0005/snavigator/parsers/Makefile.am SN451/snavigator/parsers/Makefile.am
*** SN451-p0005/snavigator/parsers/Makefile.am Sat Feb 12 00:51:29 2000
--- SN451/snavigator/parsers/Makefile.am Tue Aug 1 19:23:42 2000
***************
*** 23,26 ****
## Order is important here.
! SUBDIRS = common libjcreuse toolbox assembly cobol cpp fortran java @JAVA_PARSER@ @SENDMAIL_PARSER@ tcl
--- 23,26 ----
## Order is important here.
! SUBDIRS = common libjcreuse toolbox assembly cobol cpp fortran java @JAVA_PARSER@ @SENDMAIL_PARSER@ tcl python
diff -c2rN SN451-p0005/snavigator/parsers/Makefile.in SN451/snavigator/parsers/Makefile.in
*** SN451-p0005/snavigator/parsers/Makefile.in Wed Apr 12 19:53:24 2000
--- SN451/snavigator/parsers/Makefile.in Tue Aug 1 19:24:47 2000
***************
*** 203,207 ****
AUTOMAKE_OPTIONS = cygnus
! SUBDIRS = common libjcreuse toolbox assembly cobol cpp fortran java @JAVA_PARSER@ @SENDMAIL_PARSER@ tcl
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
--- 203,207 ----
AUTOMAKE_OPTIONS = cygnus
! SUBDIRS = common libjcreuse toolbox assembly cobol cpp fortran java @JAVA_PARSER@ @SENDMAIL_PARSER@ tcl python
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
diff -c2rN SN451-p0005/snavigator/parsers/python/Makefile.am SN451/snavigator/parsers/python/Makefile.am
*** SN451-p0005/snavigator/parsers/python/Makefile.am Thu Jan 1 01:00:00 1970
--- SN451/snavigator/parsers/python/Makefile.am Wed Aug 2 17:44:14 2000
***************
*** 0 ****
--- 1,43 ----
+ # Copyright (c) 2000, Red Hat, Inc.
+ #
+ # This file is part of Source-Navigator.
+ #
+ # Source-Navigator is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License as published
+ # by the Free Software Foundation; either version 2, or (at your option)
+ # any later version.
+ #
+ # Source-Navigator is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with Source-Navigator; see the file COPYING. If not, write to
+ # the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ # MA 02111-1307, USA.
+ #
+ AUTOMAKE_OPTIONS = cygnus
+
+ ## Process this file with automake to create .in.
+
+ toolbox = $(top_builddir)/parsers/toolbox
+ common = $(top_builddir)/parsers/common
+
+ bin_PROGRAMS = pybrowser
+
+ INCLUDES = $(WINFLAGS) -I$(top_srcdir)/hyper \
+ -I$(top_srcdir)/parsers/toolbox \
+ -I$(top_srcdir)/parsers/common $(TCLHDIR)
+
+ pybrowser_LDADD = $(toolbox)/libsnptools.a $(top_builddir)/db/libdbutils.a \
+ $(common)/libcommon.a $(DB_LIBDIR)/libdb.a @LEXLIB@ \
+ $(top_builddir)/misc/libutils/libutils.a \
+ $(TCL_BUILD_LIB_SPEC) $(TCL_LIBS)
+
+ pybrowser_SOURCES = pybrowser.l
+
+ pybrowser_DEPENDENCIES = $(top_builddir)/db/libdbutils.a $(DB_LIBDIR)/libdb.a \
+ $(toolbox)/libsnptools.a $(common)/libcommon.a \
+ $(top_builddir)/misc/libutils/libutils.a
+
diff -c2rN SN451-p0005/snavigator/parsers/python/Makefile.in SN451/snavigator/parsers/python/Makefile.in
*** SN451-p0005/snavigator/parsers/python/Makefile.in Thu Jan 1 01:00:00 1970
--- SN451/snavigator/parsers/python/Makefile.in Wed Aug 2 17:44:17 2000
***************
*** 0 ****
--- 1,435 ----
+ # Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+ # with or without modifications, as long as this notice is preserved.
+
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ # PARTICULAR PURPOSE.
+
+ # Copyright (c) 2000, Red Hat, Inc.
+ #
+ # This file is part of Source-Navigator.
+ #
+ # Source-Navigator is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License as published
+ # by the Free Software Foundation; either version 2, or (at your option)
+ # any later version.
+ #
+ # Source-Navigator is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with Source-Navigator; see the file COPYING. If not, write to
+ # the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ # MA 02111-1307, USA.
+ #
+
+
+ SHELL = @SHELL@
+
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+
+ bindir = @bindir@
+ sbindir = @sbindir@
+ libexecdir = @libexecdir@
+ datadir = @datadir@
+ sysconfdir = @sysconfdir@
+ sharedstatedir = @sharedstatedir@
+ localstatedir = @localstatedir@
+ libdir = @libdir@
+ infodir = @infodir@
+ mandir = @mandir@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+
+ DESTDIR =
+
+ pkgdatadir = $(datadir)/@PACKAGE@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkgincludedir = $(includedir)/@PACKAGE@
+
+ top_builddir = ../..
+
+ ACLOCAL = @ACLOCAL@
+ AUTOCONF = @AUTOCONF@
+ AUTOMAKE = @AUTOMAKE@
+ AUTOHEADER = @AUTOHEADER@
+
+ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ transform = @program_transform_name@
+
+ NORMAL_INSTALL = :
+ PRE_INSTALL = :
+ POST_INSTALL = :
+ NORMAL_UNINSTALL = :
+ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ ASM_DEMO = @ASM_DEMO@
+ AWK = @AWK@
+ BFDHDIR = @BFDHDIR@
+ BFDLIB = @BFDLIB@
+ BUG_ADDRESS = @BUG_ADDRESS@
+ CC = @CC@
+ CC_FOR_BUILD = @CC_FOR_BUILD@
+ COB_DEMO = @COB_DEMO@
+ CONFIG_H = @CONFIG_H@
+ CXX = @CXX@
+ CXXCPP = @CXXCPP@
+ C_DEMO = @C_DEMO@
+ DB_INCDIR = @DB_INCDIR@
+ DB_LIBDIR = @DB_LIBDIR@
+ DEJAGNUHDIR = @DEJAGNUHDIR@
+ DEJAGNULIB = @DEJAGNULIB@
+ DEVOHDIR = @DEVOHDIR@
+ ENDIAN = @ENDIAN@
+ EXEEXT = @EXEEXT@
+ FOR_DEMO = @FOR_DEMO@
+ GETTING_STARTED_DIR = @GETTING_STARTED_DIR@
+ GETTING_STARTED_INDEX = @GETTING_STARTED_INDEX@
+ GETTING_STARTED_NAME = @GETTING_STARTED_NAME@
+ GUILIB = @GUILIB@
+ HALDIR = @HALDIR@
+ HAVE_DEVO_SIM = @HAVE_DEVO_SIM@
+ HYPER_CFLAGS = @HYPER_CFLAGS@
+ HYPER_CONSOLE = @HYPER_CONSOLE@
+ HYPER_MAIN = @HYPER_MAIN@
+ IDEHDIR = @IDEHDIR@
+ IDELIB = @IDELIB@
+ IDETCLLIB = @IDETCLLIB@
+ ILUHDIR = @ILUHDIR@
+ ILULIB = @ILULIB@
+ ILUTOP = @ILUTOP@
+ INTLHDIR = @INTLHDIR@
+ INTLLIB = @INTLLIB@
+ ITCLHDIR = @ITCLHDIR@
+ ITCLLIB = @ITCLLIB@
+ ITCLMKIDX = @ITCLMKIDX@
+ ITCLSH = @ITCLSH@
+ ITCL_MKINDEX_DIR = @ITCL_MKINDEX_DIR@
+ ITCL_SH = @ITCL_SH@
+ JAVAEXE = @JAVAEXE@
+ JAVA_PARSER = @JAVA_PARSER@
+ JAV_DEMO = @JAV_DEMO@
+ KERNELHDIR = @KERNELHDIR@
+ KERNELLIB = @KERNELLIB@
+ LEX = @LEX@
+ LIBERTY = @LIBERTY@
+ LIBGCC = @LIBGCC@
+ LIBGUIHDIR = @LIBGUIHDIR@
+ LIBGUILIB = @LIBGUILIB@
+ LIBIBERTY = @LIBIBERTY@
+ MAINT = @MAINT@
+ MAKEINFO = @MAKEINFO@
+ MONOP_DEMO = @MONOP_DEMO@
+ OBJEXT = @OBJEXT@
+ OLDTARFLAG = @OLDTARFLAG@
+ OPCODESLIB = @OPCODESLIB@
+ PACKAGE = @PACKAGE@
+ PRODUCT_NAME = @PRODUCT_NAME@
+ PROGRAMMERS_REFERENCE_DIR = @PROGRAMMERS_REFERENCE_DIR@
+ PROGRAMMERS_REFERENCE_INDEX = @PROGRAMMERS_REFERENCE_INDEX@
+ PROGRAMMERS_REFERENCE_NAME = @PROGRAMMERS_REFERENCE_NAME@
+ RANLIB = @RANLIB@
+ RUNTESTDIR = @RUNTESTDIR@
+ SDK_DIR = @SDK_DIR@
+ SENDMAIL_PARSER = @SENDMAIL_PARSER@
+ SIMHDIR = @SIMHDIR@
+ SIMLIB = @SIMLIB@
+ SN_BOOKS = @SN_BOOKS@
+ SN_DOCSET = @SN_DOCSET@
+ SN_GUI_DIR = @SN_GUI_DIR@
+ SN_LAUNCH_SHELL = @SN_LAUNCH_SHELL@
+ SN_PLATFORM_DIR = @SN_PLATFORM_DIR@
+ SN_SDK_EXEC_PREFIX = @SN_SDK_EXEC_PREFIX@
+ SOCKLIB = @SOCKLIB@
+ SPLASHFILE = @SPLASHFILE@
+ SUITE_NAME = @SUITE_NAME@
+ TAR = @TAR@
+ TCLCONFIG = @TCLCONFIG@
+ TCLHDIR = @TCLHDIR@
+ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@
+ TCL_DEFS = @TCL_DEFS@
+ TCL_LD_FLAGS = @TCL_LD_FLAGS@
+ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+ TCL_LIBRARY = @TCL_LIBRARY@
+ TCL_LIBS = @TCL_LIBS@
+ TCL_LIB_FILE = @TCL_LIB_FILE@
+ TCL_LIB_FULL_PATH = @TCL_LIB_FULL_PATH@
+ TCL_LIB_SPEC = @TCL_LIB_SPEC@
+ TCL_RANLIB = @TCL_RANLIB@
+ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+ TCL_SHLIB_LD = @TCL_SHLIB_LD@
+ TIXHDIR = @TIXHDIR@
+ TIXLIB = @TIXLIB@
+ TIX_BUILD_LIB_SPEC = @TIX_BUILD_LIB_SPEC@
+ TIX_VERSION = @TIX_VERSION@
+ TKCONFIG = @TKCONFIG@
+ TKHDIR = @TKHDIR@
+ TK_BUILD_INCLUDES = @TK_BUILD_INCLUDES@
+ TK_BUILD_LIB_SPEC = @TK_BUILD_LIB_SPEC@
+ TK_DEFS = @TK_DEFS@
+ TK_LIBS = @TK_LIBS@
+ TK_LIB_SPEC = @TK_LIB_SPEC@
+ TK_VERSION = @TK_VERSION@
+ TK_XINCLUDES = @TK_XINCLUDES@
+ TK_XLIBSW = @TK_XLIBSW@
+ TMGRHDIR = @TMGRHDIR@
+ TMGRLIB = @TMGRLIB@
+ USING_GNUPRO_DIR = @USING_GNUPRO_DIR@
+ USING_GNUPRO_INDEX = @USING_GNUPRO_INDEX@
+ USING_GNUPRO_NAME = @USING_GNUPRO_NAME@
+ VERSION = @VERSION@
+ WIN32LDAPP = @WIN32LDAPP@
+ WIN32LIBS = @WIN32LIBS@
+ WINDRES = @WINDRES@
+ WINFLAGS = @WINFLAGS@
+ X11ICON = @X11ICON@
+ YACC = @YACC@
+ ac_cv_c_itclsh = @ac_cv_c_itclsh@
+
+ AUTOMAKE_OPTIONS = cygnus
+
+ toolbox = $(top_builddir)/parsers/toolbox
+ common = $(top_builddir)/parsers/common
+
+ bin_PROGRAMS = pybrowser
+
+ INCLUDES = $(WINFLAGS) -I$(top_srcdir)/hyper -I$(top_srcdir)/parsers/toolbox -I$(top_srcdir)/parsers/common $(TCLHDIR)
+
+
+ pybrowser_LDADD = $(toolbox)/libsnptools.a $(top_builddir)/db/libdbutils.a $(common)/libcommon.a $(DB_LIBDIR)/libdb.a @LEXLIB@ $(top_builddir)/misc/libutils/libutils.a $(TCL_BUILD_LIB_SPEC) $(TCL_LIBS)
+
+
+ pybrowser_SOURCES = pybrowser.l
+
+ pybrowser_DEPENDENCIES = $(top_builddir)/db/libdbutils.a $(DB_LIBDIR)/libdb.a $(toolbox)/libsnptools.a $(common)/libcommon.a $(top_builddir)/misc/libutils/libutils.a
+
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+ CONFIG_HEADER = ../../config.h
+ CONFIG_CLEAN_FILES =
+ bin_PROGRAMS = pybrowser$(EXEEXT)
+ PROGRAMS = $(bin_PROGRAMS)
+
+
+ DEFS = @DEFS@ -I. -I$(srcdir) -I../..
+ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+ pybrowser_OBJECTS = pybrowser.$(OBJEXT)
+ pybrowser_LDFLAGS =
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LEXLIB = @LEXLIB@
+ CFLAGS = @CFLAGS@
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+ DIST_COMMON = Makefile.am Makefile.in pybrowser.c
+
+
+ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+ GZIP_ENV = --best
+ SOURCES = $(pybrowser_SOURCES)
+ OBJECTS = $(pybrowser_OBJECTS)
+
+ all: all-redirect
+ .SUFFIXES:
+ .SUFFIXES: .S .c .l .o .obj .s
+ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus parsers/python/Makefile
+
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+ mostlyclean-binPROGRAMS:
+
+ clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+ distclean-binPROGRAMS:
+
+ maintainer-clean-binPROGRAMS:
+
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+ uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+ .c.o:
+ $(COMPILE) -c $<
+
+ # FIXME: We should only use cygpath when building on Windows,
+ # and only if it is available.
+ .c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+ .s.o:
+ $(COMPILE) -c $<
+
+ .S.o:
+ $(COMPILE) -c $<
+
+ mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+ clean-compile:
+
+ distclean-compile:
+ -rm -f *.tab.c
+
+ maintainer-clean-compile:
+
+ pybrowser$(EXEEXT): $(pybrowser_OBJECTS) $(pybrowser_DEPENDENCIES)
+ @rm -f pybrowser$(EXEEXT)
+ $(LINK) $(pybrowser_LDFLAGS) $(pybrowser_OBJECTS) $(pybrowser_LDADD) $(LIBS)
+ .l.c:
+ $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
+
+ tags: TAGS
+
+ ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+ mostlyclean-tags:
+
+ clean-tags:
+
+ distclean-tags:
+ -rm -f TAGS ID
+
+ maintainer-clean-tags:
+
+ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+ subdir = parsers/python
+
+ distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ info-am:
+ info: info-am
+ dvi-am:
+ dvi: dvi-am
+ check-am:
+ check: check-am
+ installcheck-am:
+ installcheck: installcheck-am
+ install-info-am:
+ install-info: install-info-am
+ install-exec-am: install-binPROGRAMS
+ install-exec: install-exec-am
+
+ install-data-am:
+ install-data: install-data-am
+
+ install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ install: install-am
+ uninstall-am: uninstall-binPROGRAMS
+ uninstall: uninstall-am
+ all-am: Makefile $(PROGRAMS)
+ all-redirect: all-am
+ install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+ installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+
+ mostlyclean-generic:
+
+ clean-generic:
+
+ distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+ maintainer-clean-generic:
+ -test -z "pybrowserl" || rm -f pybrowserl
+ mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
+ mostlyclean-tags mostlyclean-generic
+
+ mostlyclean: mostlyclean-am
+
+ clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \
+ mostlyclean-am
+
+ clean: clean-am
+
+ distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
+ distclean-generic clean-am
+
+ distclean: distclean-am
+
+ maintainer-clean-am: maintainer-clean-binPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+ maintainer-clean: maintainer-clean-am
+
+ .PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+ mostlyclean-compile distclean-compile clean-compile \
+ maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+ clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+ check-am installcheck-am installcheck install-info-am install-info \
+ install-exec-am install-exec install-data-am install-data install-am \
+ install uninstall-am uninstall all-redirect all-am all installdirs \
+ mostlyclean-generic distclean-generic clean-generic \
+ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff -c2rN SN451-p0005/snavigator/parsers/python/README SN451/snavigator/parsers/python/README
*** SN451-p0005/snavigator/parsers/python/README Thu Jan 1 01:00:00 1970
--- SN451/snavigator/parsers/python/README Wed Aug 2 20:42:50 2000
***************
*** 0 ****
--- 1,14 ----
+ This is a parser for python source code.
+
+ Current limitations:
+
+ * Continuation lines (ending in a backslash) are not always
+ handled correctly.
+
+ * This parser has nearly the same limitations as python's
+ class browser module pyclbr.py (which also served as implementation
+ guideline). Triple quoted strings are, however, handled correctly.
+
+ ---
+ Thomas Heller
+ thomas.heller@ion-tof.com
diff -c2rN SN451-p0005/snavigator/parsers/python/pybrowser.l SN451/snavigator/parsers/python/pybrowser.l
*** SN451-p0005/snavigator/parsers/python/pybrowser.l Thu Jan 1 01:00:00 1970
--- SN451/snavigator/parsers/python/pybrowser.l Wed Aug 2 15:17:03 2000
***************
*** 0 ****
--- 1,334 ----
+ /* -*- c -*- */
+ /*
+
+ Copyright (c) 2000, Red Hat, Inc.
+
+ This file is part of Source-Navigator.
+
+ Source-Navigator is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ Source-Navigator is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Source-Navigator; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+ %{
+ /*
+ * pybrowser.l
+ *
+ * Written by Thomas Heller <thomas.heller@ion-tof.com>
+ *
+ * Description:
+ * A lex specification for a scanner to parse python source code files
+ * and store relevant information into the Source-Navigator project database.
+ */
+
+ #include <ctype.h>
+ #include "lexinput.h"
+ #include "tcl.h"
+ #include "snptools.h"
+
+ static char group[] = "python";
+
+ static char *mystrdup(char *);
+ static void var_or_const(int);
+
+ static struct stack *scope_stack;
+
+ static void push(int, int, char *);
+ static void pop(int);
+ static char *top(int *);
+ static int calc_indent (char*, char *);
+ static void baseclasses (char *, char *);
+ static void parse_triple(int);
+
+ /* XXX Is this correct? */
+ #undef YY_INPUT
+ #define YY_INPUT(buf,r,ms) (r = sn_encoded_input(buf, ms))
+
+ int
+ yywrap()
+ {
+ return(1);
+ }
+
+ %}
+
+ %%
+
+ \"\"\" {
+ sn_advance_column (3);
+ parse_triple((int)'"');
+ }
+
+ \'\'\' {
+ sn_advance_column (3);
+ parse_triple((int)'\'');
+ }
+
+ ^[ \t]*def[ \t]+[a-zA-Z_][a-zA-Z_0-9]*[ \t]*\( {
+ int ofs;
+ char *p;
+ int indent;
+ char *classname;
+ int code;
+ int context;
+ /* point just before the '(', then go backwards to find and mark
+ the end of the name */
+ p = yytext + yyleng - 1;
+ while ((p[-1] == ' ') || (p[-1] == '\t'))
+ --p;
+ *p = '\0';
+ /* now go backwards to find the beginning */
+ p = yytext + yyleng-1;
+ while ((p > yytext) && (p[-1] != ' ') && (p[-1] != '\t'))
+ --p;
+ ofs = p - yytext;
+
+ indent = calc_indent (yytext, p);
+ pop(indent);
+ classname = top(&context);
+ if (classname) {
+ switch (context) {
+ case SN_CLASS_DEF:
+ code = SN_MBR_FUNC_DEF;
+ break;
+ default:
+ code = SN_FUNC_DEF;
+ classname = NULL;
+ break;
+ }
+ } else
+ code = SN_FUNC_DEF;
+
+ push(indent, code, p);
+
+ sn_insert_symbol(code, classname, p, sn_current_file(),
+ sn_line(), sn_column()+ofs, sn_line(),
+ sn_column()+ofs + strlen(p),
+ 0, NULL, NULL, NULL, NULL,
+ sn_line(), sn_column()+ofs, sn_line(),
+ sn_column()+ofs + strlen(p));
+ }
+
+ ^[ \t]*class[ \t]+[a-zA-Z_][a-zA-Z_0-9]*[ \t]*(\([^)]*\))?[ \t]*: {
+ int ofs;
+ char *p, *super;
+ int indent;
+ char *end;
+ yytext[yyleng] = '\0';
+
+ p = yytext;
+ while (isspace (*p))
+ ++p;
+ indent = calc_indent (yytext, p);
+
+ p += strlen ("class");
+ while (isspace (*p))
+ ++p;
+ ofs = p - yytext;
+ end = p;
+ while (*end && (isalnum (*end) || (*end == '_')))
+ ++end;
+ *end = '\0';
+
+ pop(indent);
+ push(indent, SN_CLASS_DEF, p);
+ sn_insert_symbol(SN_CLASS_DEF, NULL, p, sn_current_file(),
+ sn_line(), sn_column()+ofs, sn_line(),
+ sn_column()+ofs + strlen(p),
+ 0, NULL, NULL, NULL, NULL,
+ sn_line(), sn_column()+ofs, sn_line(),
+ sn_column()+ofs + strlen(p));
+ ++end;
+ super = end;
+ while ((end < yytext+yyleng) && *end) {
+ if (*end == '\n') {
+ sn_advance_line();
+ sn_reset_column();
+ }
+ ++end;
+ }
+ baseclasses (p, super);
+ }
+
+ ^[A-Z_][A-Z0-9_]*[ \t]*= { var_or_const (SN_CONS_DEF); }
+
+ ^[a-zA-Z_][a-zA-Z0-9_]*[ \t]*= { var_or_const (SN_GLOB_VAR_DEF); }
+
+ \n {
+ sn_advance_line();
+ sn_reset_column();
+ }
+
+ . { sn_advance_column(yyleng); }
+
+ %%
+ struct stack {
+ int indent;
+ int code;
+ char *name;
+ struct stack *prev;
+ };
+
+ static struct stack *scope_stack = NULL;
+
+ static int calc_indent(char *start, char *stop)
+ {
+ int indent = 0;
+ char *cp = start;
+ while (cp < stop) {
+ switch (*cp++) {
+ case ' ':
+ ++indent;
+ break;
+ case '\t':
+ indent = (indent / 8) * 8 + 8;
+ break;
+ default:
+ return indent;
+ }
+ }
+ return indent;
+ }
+
+ static char *top(int *code)
+ {
+ if (scope_stack) {
+ *code = scope_stack->code;
+ return scope_stack->name;
+ }
+ return NULL;
+ }
+
+ static void push(int indent, int code, char *name)
+ {
+ struct stack *node;
+
+ node = (struct stack *)malloc(sizeof (struct stack));
+ node->indent = indent;
+ node->code = code;
+ node->name = mystrdup (name);
+ node->prev = scope_stack;
+ scope_stack = node;
+ }
+
+ static void pop(int indent)
+ {
+ while (scope_stack && (scope_stack->indent >= indent)) {
+ scope_stack = scope_stack->prev;
+ }
+ }
+
+ static void baseclasses (char *classname, char *rest)
+ {
+ /* We enter here with something like " ( Tester ):" */
+ char *cp = rest;
+ char *base;
+
+ while (base = strtok (cp, "():, \t\r\n")) {
+ if (strchr (base, '.'))
+ base = strrchr (base, '.') + 1;
+ cp = NULL;
+ /* I don't really know why we need a filename here, the
+ base class may be defined in a totally different file */
+ sn_insert_symbol(SN_CLASS_INHERIT, classname, base,
+ sn_current_file(),
+ sn_line(), sn_column(), sn_line(),
+ sn_column() + strlen(base),
+ 0, NULL, NULL, NULL, NULL,
+ sn_line(), sn_column(), sn_line(),
+ sn_column() + strlen(base));
+ }
+ }
+
+ static void var_or_const (int code)
+ {
+ char *p;
+ /* point just before the '=', then go backwards to find and mark
+ the end of identifier */
+ p = yytext + yyleng - 1;
+ while ((p > yytext) && (p[-1] == ' ') || (p[-1] == '\t'))
+ --p;
+ *p = '\0';
+ sn_insert_symbol(code, NULL, yytext, sn_current_file(),
+ sn_line(), sn_column(), sn_line(),
+ sn_column() + strlen(yytext),
+ 0, NULL, NULL, NULL, NULL,
+ sn_line(), sn_column(), sn_line(),
+ sn_column() + strlen(yytext));
+ }
+
+ static void parse_triple(int term)
+ {
+ int c;
+ int count;
+ while (1) {
+ c = input();
+ sn_advance_column (1);
+ if (c == term) {
+ ++count;
+ if (count == 3)
+ return;
+ } else {
+ count = 0;
+ switch (c) {
+ case '\\':
+ c = input();
+ if (c <= 0)
+ return;
+ if (c != '\n') {
+ sn_advance_column (1);
+ c = -1;
+ } else {
+ sn_advance_line ();
+ }
+ break;
+
+ case '\n':
+ sn_advance_line ();
+ sn_reset_column ();
+ break;
+
+ case '\r':
+ sn_reset_column ();
+ break;
+
+ case EOF:
+ return;
+ }
+ }
+ }
+ }
+
+ static char *mystrdup(char *name)
+ {
+ char *p = malloc(strlen (name) + 1);
+ if (!p)
+ return NULL;
+ strcpy (p, name);
+ return p;
+ }
+
+ void reset()
+ {
+ sn_reset_line();
+ sn_reset_column();
+ sn_reset_encoding();
+ }
+
+ int
+ main(int argc, char *argv[])
+ {
+ return sn_main(argc, argv, group, &yyin, yylex, reset);
+ }
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 0:17 Python parser for SN Thomas Heller
@ 2000-08-03 0:34 ` Ben Elliston
2000-08-03 0:46 ` Thomas Heller
2000-08-03 2:00 ` Mo DeJong
1 sibling, 1 reply; 10+ messages in thread
From: Ben Elliston @ 2000-08-03 0:34 UTC (permalink / raw)
To: Thomas Heller; +Cc: sourcenav
This patch contains a python parser and syntax highlighting for
python.
Fantastic! Thanks for doing it.
Since I don't have automake on my development system (I use NT), i had
to write Makefile.in's and Makefile.am's by hand.
Note that it's not necessary to run Automake and Autoconf on the system
you're using. If you move your tree to a Unix system with these tools
installed, you can run it there. Autoconf and Automake work fine under
Cygwin, by the way.
Ben
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 0:34 ` Ben Elliston
@ 2000-08-03 0:46 ` Thomas Heller
2000-08-03 0:48 ` Ben Elliston
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Heller @ 2000-08-03 0:46 UTC (permalink / raw)
To: Ben Elliston; +Cc: sourcenav
>
> Since I don't have automake on my development system (I use NT), i had
> to write Makefile.in's and Makefile.am's by hand.
>
> Note that it's not necessary to run Automake and Autoconf on the system
> you're using. If you move your tree to a Unix system with these tools
> installed, you can run it there. Autoconf and Automake work fine under
> Cygwin, by the way.
>
Autoconf requires perl. So I downloaded and installed ActiveState's
ActivePerl,
and tried to install automake-1.4.
But it refused to run.
Do I have to build perl from the source under cygwin?
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 0:46 ` Thomas Heller
@ 2000-08-03 0:48 ` Ben Elliston
2000-08-03 1:08 ` Thomas Heller
0 siblings, 1 reply; 10+ messages in thread
From: Ben Elliston @ 2000-08-03 0:48 UTC (permalink / raw)
To: Thomas Heller; +Cc: sourcenav
Autoconf requires perl. So I downloaded and installed ActiveState's
ActivePerl,
Autoconf requires m4. It's Automake that requires Perl.
and tried to install automake-1.4. But it refused to run. Do I have to
build perl from the source under cygwin?
Nope. There are plenty of binary distributions of Perl around for Cygwin.
Keep digging. :-)
Ben
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 0:48 ` Ben Elliston
@ 2000-08-03 1:08 ` Thomas Heller
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Heller @ 2000-08-03 1:08 UTC (permalink / raw)
To: Ben Elliston; +Cc: sourcenav
> Autoconf requires perl. So I downloaded and installed ActiveState's
> ActivePerl,
>
> Autoconf requires m4. It's Automake that requires Perl.
A typo. I meant Automake.
>
> and tried to install automake-1.4. But it refused to run. Do I have to
> build perl from the source under cygwin?
>
> Nope. There are plenty of binary distributions of Perl around for Cygwin.
> Keep digging. :-)
>
> Ben
Thanks! Did this, and it worked like a charm!
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 0:17 Python parser for SN Thomas Heller
2000-08-03 0:34 ` Ben Elliston
@ 2000-08-03 2:00 ` Mo DeJong
2000-08-03 2:51 ` Thomas Heller
` (2 more replies)
1 sibling, 3 replies; 10+ messages in thread
From: Mo DeJong @ 2000-08-03 2:00 UTC (permalink / raw)
To: Thomas Heller; +Cc: sourcenav
On Thu, 3 Aug 2000, Thomas Heller wrote:
> This patch contains a python parser and syntax highlighting for
> python.
>
> Since I don't have automake on my development system (I use NT),
> i had to write Makefile.in's and Makefile.am's by hand.
>
> Enjoy!
> Thomas Heller
Wow. Looks like we have a winner in the "First Source-Navigator patch"
contest. (sorry ben, your wait patch does not count because you work here)
I am not sure what the prize will be yet. Perhaps a copy of Red Hat 7.0
when it ships? How about a limited edition Source-Navigator shirt?
At the very least we are going to have to put a note about this
up on the website.
Mo DeJong
Red Hat Inc
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 2:00 ` Mo DeJong
@ 2000-08-03 2:51 ` Thomas Heller
2000-08-03 5:16 ` Florent Pillet
2000-08-03 8:13 ` Syd Polk
2 siblings, 0 replies; 10+ messages in thread
From: Thomas Heller @ 2000-08-03 2:51 UTC (permalink / raw)
To: Mo DeJong; +Cc: sourcenav
>
> Wow. Looks like we have a winner in the "First Source-Navigator patch"
> contest. (sorry ben, your wait patch does not count because you work here)
>
> I am not sure what the prize will be yet. Perhaps a copy of Red Hat 7.0
> when it ships? How about a limited edition Source-Navigator shirt?
> At the very least we are going to have to put a note about this
> up on the website.
>
If you need a shipping address for the prizes, just let me know ;-)
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 2:00 ` Mo DeJong
2000-08-03 2:51 ` Thomas Heller
@ 2000-08-03 5:16 ` Florent Pillet
2000-08-03 10:57 ` Mo DeJong
2000-08-03 8:13 ` Syd Polk
2 siblings, 1 reply; 10+ messages in thread
From: Florent Pillet @ 2000-08-03 5:16 UTC (permalink / raw)
To: sourcenav
Mo DeJong wrote:
>
> On Thu, 3 Aug 2000, Thomas Heller wrote:
>
> > This patch contains a python parser and syntax highlighting for
> > python.
> >
> > Since I don't have automake on my development system (I use NT),
> > i had to write Makefile.in's and Makefile.am's by hand.
> >
> > Enjoy!
> > Thomas Heller
>
> Wow. Looks like we have a winner in the "First Source-Navigator patch"
> contest. (sorry ben, your wait patch does not count because you work here)
>
> I am not sure what the prize will be yet. Perhaps a copy of Red Hat 7.0
> when it ships? How about a limited edition Source-Navigator shirt?
> At the very least we are going to have to put a note about this
> up on the website.
>
> Mo DeJong
> Red Hat Inc
Wow wow wow.... The _first_ patch was mine, when I sent the additions to the C++ parser
for bool, const_cast, static_cast and reinterpret_cast. I know that's no big deal but if
there is a contest, I was here first :=))
Cheers,
Florent.
--
Florent Pillet, Software Architect. e-mail: fpillet@opteway.com
opt[e]way S.A., 2881 route des cretes, BP 308
06906 Sophia Antipolis Cedex, France
Phone: +33 4 92 95 26 13 - Fax: +33 4 92 95 26 03
http://www.opteway.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 2:00 ` Mo DeJong
2000-08-03 2:51 ` Thomas Heller
2000-08-03 5:16 ` Florent Pillet
@ 2000-08-03 8:13 ` Syd Polk
2 siblings, 0 replies; 10+ messages in thread
From: Syd Polk @ 2000-08-03 8:13 UTC (permalink / raw)
To: Mo DeJong; +Cc: Thomas Heller, sourcenav
No, the first patch was the c parser extension. But this is also cool.
Mo DeJong wrote:
>
> On Thu, 3 Aug 2000, Thomas Heller wrote:
>
> > This patch contains a python parser and syntax highlighting for
> > python.
> >
> > Since I don't have automake on my development system (I use NT),
> > i had to write Makefile.in's and Makefile.am's by hand.
> >
> > Enjoy!
> > Thomas Heller
>
> Wow. Looks like we have a winner in the "First Source-Navigator patch"
> contest. (sorry ben, your wait patch does not count because you work here)
>
> I am not sure what the prize will be yet. Perhaps a copy of Red Hat 7.0
> when it ships? How about a limited edition Source-Navigator shirt?
> At the very least we are going to have to put a note about this
> up on the website.
>
> Mo DeJong
> Red Hat Inc
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Python parser for SN
2000-08-03 5:16 ` Florent Pillet
@ 2000-08-03 10:57 ` Mo DeJong
0 siblings, 0 replies; 10+ messages in thread
From: Mo DeJong @ 2000-08-03 10:57 UTC (permalink / raw)
To: sourcenav
On Thu, 3 Aug 2000, Florent Pillet wrote:
> Mo DeJong wrote:
> >
> > On Thu, 3 Aug 2000, Thomas Heller wrote:
> >
> > > This patch contains a python parser and syntax highlighting for
> > > python.
> > >
> > > Since I don't have automake on my development system (I use NT),
> > > i had to write Makefile.in's and Makefile.am's by hand.
> > >
> > > Enjoy!
> > > Thomas Heller
> >
> > Wow. Looks like we have a winner in the "First Source-Navigator patch"
> > contest. (sorry ben, your wait patch does not count because you work here)
> >
> > I am not sure what the prize will be yet. Perhaps a copy of Red Hat 7.0
> > when it ships? How about a limited edition Source-Navigator shirt?
> > At the very least we are going to have to put a note about this
> > up on the website.
> >
> > Mo DeJong
> > Red Hat Inc
>
> Wow wow wow.... The _first_ patch was mine, when I sent the additions to the C++ parser
> for bool, const_cast, static_cast and reinterpret_cast. I know that's no big deal but if
> there is a contest, I was here first :=))
>
> Cheers,
> Florent.
Sorry about that. Your patch had slipped my mind. We should really
try to get a prize to both of you :) One for the first patch,
the other for first new language support.
Mo DeJong
Red Hat Inc
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2000-08-03 10:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-03 0:17 Python parser for SN Thomas Heller
2000-08-03 0:34 ` Ben Elliston
2000-08-03 0:46 ` Thomas Heller
2000-08-03 0:48 ` Ben Elliston
2000-08-03 1:08 ` Thomas Heller
2000-08-03 2:00 ` Mo DeJong
2000-08-03 2:51 ` Thomas Heller
2000-08-03 5:16 ` Florent Pillet
2000-08-03 10:57 ` Mo DeJong
2000-08-03 8:13 ` Syd Polk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).