Index: app/lib/ser.l.template
===================================================================
--- app/lib/ser.l.template	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/lib/ser.l.template	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,30 @@
+%{
+		#include<string.h>
+		int n=0;
+%}
+
+%%
+
+PATTERN			{
+			  int start, end, len;
+			  char *lastseg, *tmp;
+			  if(yytext[yyleng-1]!='\n')
+			    {fprintf(stderr,"ser: pattern matches incomplete line\n"); exit(1);}
+			  n++;
+			  sscanf(yytext,"%d %d",&start,&len);
+			  yytext[yyleng-1]='\0';
+			  if(tmp=strrchr(yytext,'\n'))
+			  {
+			    lastseg=tmp+1;
+			    sscanf(lastseg,"%d %d", &end, &len);
+			  }
+			  else
+			    end=start;
+			  yytext[yyleng-1]='\n';
+			  printf("%04d 00 BOM * ser:%d\n",start,n);
+			  ECHO;
+			  printf("%04d 00 EOM * ser:%d\n",end+len,n);
+			}
+
+
+.*\n			DEFAULTACTION;
Index: app/lib/terms.m4
===================================================================
--- app/lib/terms.m4	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/lib/terms.m4	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,52 @@
+divert(-1)
+#--------------------------------------------------------------------------
+
+# Macros defined here may be used in pattern specifications 
+# You can modify this file according to your needs.
+
+# ENDOFSEGMENT and MORFIELD are macros expanded to, respectively,
+# end of segment marker (dependes on the format: flattened or not)
+# and the name of the annotation field containing morphological
+# information (standard value is 'lem'). These values are controlled
+# by programs using this file to expand search patterns (ser, grp, ...).
+
+# seg(type,form,annotation) 
+
+define(`seg',`(\s*((\d+\s+)(\d+\s+)?)?dnl
+ifelse($1, `',`(\S+)', `($1)')\s+dnl
+ifelse($2, `',`(\S+)', `($2)')dnl
+ifelse($3, `',`((\s+\S+)*)', `(\s+($3))')\s*ENDOFSEGMENT)')
+
+# form(f) - segment containing the form f 
+
+define(`form', `seg(,$1)')
+
+# field(f) segment containing auxiliary field f 
+
+define(`field', `seg(,,`(\S+\s+)*($1)(\s+\S+)*')')
+
+# word, space, punct, number segments (assuming W, S, P, N segment types)
+
+define(`space', `seg(`S',`$1')')
+define(`word',  `seg(`W',`$1')')
+define(`punct', `seg(`P',`$1')')
+define(`number', `seg(`N',`$1')')
+
+# macros specific to PMDB format 
+
+define(`lexeme', `field(`MORFIELD:(\S+;)?$1,\S+')')
+define(`cat', `field(`MORFIELD:\S+,$1([,;]\S+)?')')
+
+
+# Place here your macro definitions. 
+
+
+
+
+
+
+
+
+
+#--------------------------------------------------------------------------
+divert(0)
