Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jul 2008 19:16:32 GMT
From:      Konrad Jankowski <konrad@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 145445 for review
Message-ID:  <200807181916.m6IJGWjg029293@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145445

Change 145445 by konrad@vspredator on 2008/07/18 19:15:44

	Incremental changes to make 'collating-element' work again.

Affected files ...

.. //depot/projects/soc2008/konrad_collation/colldef.apple/scan.l#6 edit

Differences ...

==== //depot/projects/soc2008/konrad_collation/colldef.apple/scan.l#6 (text+ko) ====

@@ -1,4 +1,4 @@
-%x string s_name charmap defn nchar subs subs2 ldef elem
+%x string s_name charmap defn nchar subs subs2 ldef elem order elem2
 %{
 /*-
  * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
@@ -59,9 +59,9 @@
 static int orderpass = 0;
 %}
 %%
-<INITIAL,charmap,nchar,subs,subs2,ldef>[ \t]+      ;
-<subs2>\"		{ ptr = buf; BEGIN(string); }
-<ldef>\"		return EXPAND;
+<INITIAL,charmap,nchar,subs,subs2,ldef,order>[ \t]+      ;
+<subs2,ldef>\"		{ ptr = buf; BEGIN(string); }
+<order>\"		return EXPAND;
 <string>\<             {
 	if(localedefmode) {
 		ptrsave = ptr;
@@ -75,21 +75,23 @@
 	}
 }
 <subs>\<                { ptr = buf; fromsubs = 1; BEGIN(s_name); }
-<ldef>[,;]		return *yytext;
-<ldef>forward	{ yylval.ch = DIRECTIVE_FORWARD; return ORDER_DIRECTIVE; }
-<ldef>backward	{ yylval.ch = DIRECTIVE_BACKWARD; return ORDER_DIRECTIVE; }
-<ldef>position	{ yylval.ch = DIRECTIVE_POSITION; return ORDER_DIRECTIVE; }
+<ldef,order>[,;]		return *yytext;
+<order>forward	{ yylval.ch = DIRECTIVE_FORWARD; return ORDER_DIRECTIVE; }
+<order>backward	{ yylval.ch = DIRECTIVE_BACKWARD; return ORDER_DIRECTIVE; }
+<order>position	{ yylval.ch = DIRECTIVE_POSITION; return ORDER_DIRECTIVE; }
 <ldef>collating[-_]element	return COLLATING_ELEMENT;
 <ldef>collating[-_]symbol	return COLLATING_SYMBOL;
 <ldef>from		return FROM;
-<ldef>\.\.\.		return ELLIPSIS;
-<ldef>IGNORE		return IGNORE;
-<ldef>UNDEFINED		return UNDEFINED;
-<ldef>order[-_]start	return ORDER_START;
-<ldef>order[-_]end	{
+<ldef,order>\.\.\.	return ELLIPSIS;
+<order>IGNORE		return IGNORE;
+<order>UNDEFINED	return UNDEFINED;
+<ldef>order[-_]start	{ BEGIN(order); return ORDER_START; }
+<order>order[-_]end	{
 	char line[YY_BUF_SIZE];
-	if (orderpass)
+	if (orderpass) {
+		BEGIN(ldef);
 		return ORDER_END;
+	}
 	/* The first pass only defined the left-most symbol.  We reread the
 	 * order lines, and forward references should now be resolved. */
 	orderpass++;
@@ -105,14 +107,16 @@
 		if (strstr(line, "order_start") != NULL)
 			break;
 	}
+	BEGIN(order);
 	return ORDER_SECOND_PASS;
 }
 <ldef>END[ \t]+LC_COLLATE return END_LC_COLLATE;
-<ldef>\n		{
+<ldef,order>\n		{
 	line_no++;
 	return '\n';
 }
-<ldef>\<                { ptr = buf; BEGIN(elem); }
+<ldef>\<		{ ptr = buf; BEGIN(elem); }
+<order>\<		{ ptr = buf; BEGIN(elem2); }
 <INITIAL>\<             {
 	ptr = buf;
 	fromsubs = 0;
@@ -213,13 +217,13 @@
 	BEGIN(nchar);
 	return DEFN;
 }
-<s_name,elem>\/\/         {
+<s_name,elem,elem2>\/\/         {
 	if(ptr >= buf + BUFSIZE - 1)
 		errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '/'",
 		     line_no);
 	*ptr++ = '/';
 }
-<s_name,elem>\/\>         {
+<s_name,elem,elem2>\/\>         {
 	if(ptr >= buf + BUFSIZE - 1)
 		errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '>'",
 		     line_no);
@@ -240,6 +244,15 @@
 	BEGIN(ldef);
 	return ELEM;
 }
+<elem2>\>		{
+	if (ptr == buf)
+		errx(EX_UNAVAILABLE, "non-empty name expected near line %u",
+		     line_no);
+	*ptr = 0;
+	wcscpy(yylval.str, buf);
+	BEGIN(order);
+	return ELEM;
+}
 <s_name>\>		{
 	struct symbol *s;
 
@@ -287,7 +300,7 @@
 		BEGIN(subs2);
 	return STRING;
 }
-<s_name,defn,elem>.       {
+<s_name,defn,elem,elem2>.       {
 	const char *s = (map_fp != NULL) ? map_name : "input";
 
 	if (!isascii(*yytext) || !isprint(*yytext))
@@ -340,7 +353,7 @@
 		     line_no);
 	*ptr++ = '\a';
 }
-<s_name,string,defn,elem>\n       {
+<s_name,string,defn,elem,elem2>\n       {
 	const char *s = (map_fp != NULL) ? map_name : "input";
 
 	if (charmap_cmdline)	
@@ -348,7 +361,7 @@
 	errx(EX_UNAVAILABLE, "unterminated map/name/string near line %u of %s (ptr-buf=%d)",
 	    line_no, s, ptr - buf);
 }
-<s_name,string,nchar,elem><<EOF>> {
+<s_name,string,nchar,order,elem,elem2><<EOF>> {
 	const char *s = (map_fp != NULL) ? map_name : "input";
 
 	errx(EX_UNAVAILABLE, "premature EOF in the name/string/char near line %u of %s", line_no, s);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807181916.m6IJGWjg029293>