| 1 |
/* Copyright (c) 2006, Sun Microsystems, Inc. |
| 2 |
* All rights reserved. |
| 3 |
* |
| 4 |
* Redistribution and use in source and binary forms, with or without |
| 5 |
* modification, are permitted provided that the following conditions are met: |
| 6 |
* |
| 7 |
* * Redistributions of source code must retain the above copyright notice, |
| 8 |
* this list of conditions and the following disclaimer. |
| 9 |
* * Redistributions in binary form must reproduce the above copyright |
| 10 |
* notice, this list of conditions and the following disclaimer in the |
| 11 |
* documentation and/or other materials provided with the distribution. |
| 12 |
* * Neither the name of the Sun Microsystems, Inc. nor the names of its |
| 13 |
* contributors may be used to endorse or promote products derived from |
| 14 |
* this software without specific prior written permission. |
| 15 |
* |
| 16 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 20 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 26 |
* THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
*/ |
| 28 |
|
| 29 |
BABYL OPTIONS: |
| 30 |
Version: 5 |
| 31 |
Labels: |
| 32 |
Note: This is the header of an rmail file. |
| 33 |
Note: If you are seeing it in rmail, |
| 34 |
Note: it means the file has no messages in it. |
| 35 |
|
| 36 |
1, filed,, |
| 37 |
Summary-line: 11-Jan [email protected] #A note on using RE's matching the emty string |
| 38 |
Return-Path: <[email protected]> |
| 39 |
Received: from Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 40 |
id HAA21134; Sat, 11 Jan 1997 07:47:28 -0800 |
| 41 |
Received: from sunmail1.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 42 |
id HAA02652; Sat, 11 Jan 1997 07:44:26 -0800 |
| 43 |
Received: from Eng.Sun.COM by sunmail1.Sun.COM (SMI-8.6/SMI-4.1) |
| 44 |
id HAA06974; Sat, 11 Jan 1997 07:44:26 -0800 |
| 45 |
Received: from suntest.Eng.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 46 |
id HAA02640; Sat, 11 Jan 1997 07:44:24 -0800 |
| 47 |
Received: from asap.Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 48 |
id HAA21295; Sat, 11 Jan 1997 07:44:18 -0800 |
| 49 |
Received: from Eng.Sun.COM by asap.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 50 |
id HAA24684; Sat, 11 Jan 1997 07:44:19 -0800 |
| 51 |
Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 52 |
id HAA02630; Sat, 11 Jan 1997 07:44:17 -0800 |
| 53 |
Received: from cs.albany.edu (cs.albany.edu [169.226.2.22]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id HAA01828 for <[email protected]>; Sat, 11 Jan 1997 07:44:18 -0800 |
| 54 |
Received: from bhaskara.cs.albany.edu ([email protected] [169.226.2.60]) by cs.albany.edu (8.7.4/HUB03) with ESMTP id KAA01464; Sat, 11 Jan 1997 10:44:06 -0500 (EST) |
| 55 |
Received: (from sreeni@localhost) by bhaskara.cs.albany.edu (8.7.4/CLI2) id KAA09608; Sat, 11 Jan 1997 10:43:58 -0500 (EST) |
| 56 |
From: Sreenivasa Rao Viswanadha <[email protected]> |
| 57 |
Date: Sat, 11 Jan 1997 10:43:58 -0500 (EST) |
| 58 |
Message-Id: <[email protected]> |
| 59 |
To: [email protected] |
| 60 |
Subject: A note on using RE's matching the emty string |
| 61 |
Cc: [email protected] |
| 62 |
X-Sun-Charset: US-ASCII |
| 63 |
Content-Type: text |
| 64 |
Content-Length: 1639 |
| 65 |
X-Lines: 32 |
| 66 |
Status: RO |
| 67 |
|
| 68 |
*** EOOH *** |
| 69 |
Return-Path: <[email protected]> |
| 70 |
From: Sreenivasa Rao Viswanadha <[email protected]> |
| 71 |
Date: Sat, 11 Jan 1997 10:43:58 -0500 (EST) |
| 72 |
To: [email protected] |
| 73 |
Subject: A note on using RE's matching the emty string |
| 74 |
Cc: [email protected] |
| 75 |
X-Sun-Charset: US-ASCII |
| 76 |
Content-Type: text |
| 77 |
Content-Length: 1639 |
| 78 |
X-Lines: 32 |
| 79 |
|
| 80 |
|
| 81 |
In the last couple of days, we had seen a couple of users facing problems with |
| 82 |
regular expressions that match "". There is a minor bug in the way it is |
| 83 |
implemented in 0.6.-9. We will fix it. |
| 84 |
|
| 85 |
But the purpose of this mail is to suggest you should be careful when you use |
| 86 |
RE's that match the "" string. Consider the following example of string literals |
| 87 |
where two consecutive "" are interpreted as the literal " (equivalent to \" in |
| 88 |
Java). |
| 89 |
|
| 90 |
< STRING_LITERAL: ( "\"" (~["\""])* "\"" )* > |
| 91 |
|
| 92 |
This will work in general. But, if this a part of a lot of other lexical rules, |
| 93 |
then if there a lexical error, say a char is given that cannot be the first one |
| 94 |
of any token, then, the lexer decides to use the empty string "" and match it |
| 95 |
as STRING_LITERAL without actually giving the lexical error. And since this is |
| 96 |
the empty string, no character will be consumed and you will start getting the |
| 97 |
same STRING_LITERAL token (with "" as the image) infinte number of times. In |
| 98 |
fact, if this was the only lexical rule, then if you give a input that starts |
| 99 |
with any char other than the ", you will get into an infinite loop. |
| 100 |
|
| 101 |
So a better alternative is to use the + operator which will not match the empty |
| 102 |
string. As a matter of fact, I don't know any practical grammar where matching |
| 103 |
"" is useful. |
| 104 |
|
| 105 |
In version 0.5, the lexer generated implicitly treated it as + (which is not |
| 106 |
totally right). But in 0.6.-9, it does it right and so there is a chance that |
| 107 |
your grammar that used to work with 0.5 will not work with 0.6.-9. So if you |
| 108 |
have any top-level lexical rule with ? or *, please change those rules so that |
| 109 |
they don't match the empty string "". |
| 110 |
|
| 111 |
Sreeni. |
| 112 |
|
| 113 |
|
| 114 |
1,, |
| 115 |
Summary-line: 11-Jan [email protected] #Re: Looking for HTML.jack |
| 116 |
Return-Path: <[email protected]> |
| 117 |
Received: from Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 118 |
id QAA21339; Sat, 11 Jan 1997 16:41:53 -0800 |
| 119 |
Received: from sunmail1.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 120 |
id QAA18458; Sat, 11 Jan 1997 16:38:44 -0800 |
| 121 |
Received: from Eng.Sun.COM by sunmail1.Sun.COM (SMI-8.6/SMI-4.1) |
| 122 |
id QAA16642; Sat, 11 Jan 1997 16:38:51 -0800 |
| 123 |
Received: from suntest.Eng.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 124 |
id QAA18449; Sat, 11 Jan 1997 16:38:42 -0800 |
| 125 |
Received: from asap.Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 126 |
id QAA23127; Sat, 11 Jan 1997 16:38:42 -0800 |
| 127 |
Received: from Eng.Sun.COM by asap.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 128 |
id QAA24956; Sat, 11 Jan 1997 16:38:41 -0800 |
| 129 |
Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 130 |
id QAA18438; Sat, 11 Jan 1997 16:38:36 -0800 |
| 131 |
Received: from chmls01.highway1.com (ne.highway1.com [24.128.1.82]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id QAA22125 for <[email protected]>; Sat, 11 Jan 1997 16:38:42 -0800 |
| 132 |
Received: from papa ([24.128.36.164]) by chmls01.highway1.com |
| 133 |
(Netscape Mail Server v2.0) with SMTP id AAA17669; |
| 134 |
Sat, 11 Jan 1997 19:38:31 -0400 |
| 135 |
Message-ID: <[email protected]> |
| 136 |
Date: Sat, 11 Jan 1997 19:38:32 -0500 |
| 137 |
From: [email protected] (Kimbo Mundy) |
| 138 |
X-Mailer: Mozilla 3.0Gold (WinNT; U) |
| 139 |
MIME-Version: 1.0 |
| 140 |
To: Rupert Nagler <[email protected]> |
| 141 |
CC: [email protected] |
| 142 |
Subject: Re: Looking for HTML.jack |
| 143 |
References: <[email protected]> |
| 144 |
Content-Transfer-Encoding: 7bit |
| 145 |
X-Lines: 13 |
| 146 |
Status: RO |
| 147 |
Content-Type: text/plain; charset="us-ascii" |
| 148 |
Content-Length: 447 |
| 149 |
|
| 150 |
*** EOOH *** |
| 151 |
Return-Path: <[email protected]> |
| 152 |
Date: Sat, 11 Jan 1997 19:38:32 -0500 |
| 153 |
From: [email protected] (Kimbo Mundy) |
| 154 |
X-Mailer: Mozilla 3.0Gold (WinNT; U) |
| 155 |
MIME-Version: 1.0 |
| 156 |
To: Rupert Nagler <[email protected]> |
| 157 |
CC: [email protected] |
| 158 |
Subject: Re: Looking for HTML.jack |
| 159 |
References: <[email protected]> |
| 160 |
Content-Transfer-Encoding: 7bit |
| 161 |
X-Lines: 13 |
| 162 |
Content-Type: text/plain; charset="us-ascii" |
| 163 |
Content-Length: 447 |
| 164 |
|
| 165 |
Rupert Nagler wrote: |
| 166 |
> |
| 167 |
> I am very impressed by the Jack-Concept and I am looking for a "HTML.jack". |
| 168 |
> Is there anybody out there who has an example of a Jack-Definition file for |
| 169 |
> HTML 3.2? |
| 170 |
|
| 171 |
I previously sent a message entitled "A first cut at an HTML grammar". |
| 172 |
Did people not get it? If not, see: |
| 173 |
http://www.tiac.net/users/kimbo/jack/HTML.jack |
| 174 |
|
| 175 |
> Is there a way to construct a *.jack file out of a *.sgml file? |
| 176 |
|
| 177 |
Sorry, I can't help with this. |
| 178 |
|
| 179 |
|
| 180 |
1,, |
| 181 |
Summary-line: 13-Jan [email protected] #Re: HTML? |
| 182 |
Return-Path: <[email protected]> |
| 183 |
Received: from suntest.Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 184 |
id XAA21746; Sun, 12 Jan 1997 23:06:34 -0800 |
| 185 |
Received: from Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) |
| 186 |
id XAA29422; Sun, 12 Jan 1997 23:03:31 -0800 |
| 187 |
Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) |
| 188 |
id XAA07269; Sun, 12 Jan 1997 23:03:30 -0800 |
| 189 |
Received: from chmls01.highway1.com (ne.highway1.com [24.128.1.82]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id XAA18021 for <[email protected]>; Sun, 12 Jan 1997 23:03:30 -0800 |
| 190 |
Received: from papa ([24.128.36.164]) by chmls01.highway1.com |
| 191 |
(Netscape Mail Server v2.0) with SMTP id AAA20062 |
| 192 |
for <[email protected]>; Mon, 13 Jan 1997 02:03:25 -0400 |
| 193 |
Message-ID: <[email protected]> |
| 194 |
Date: Mon, 13 Jan 1997 02:03:28 -0500 |
| 195 |
From: [email protected] (Kimbo Mundy) |
| 196 |
X-Mailer: Mozilla 3.0Gold (WinNT; U) |
| 197 |
MIME-Version: 1.0 |
| 198 |
To: Sriram Sankar <[email protected]> |
| 199 |
Subject: Re: HTML? |
| 200 |
References: <[email protected]> |
| 201 |
Content-Transfer-Encoding: 7bit |
| 202 |
X-Lines: 34 |
| 203 |
Status: RO |
| 204 |
Content-Type: text/plain; charset="us-ascii" |
| 205 |
Content-Length: 1420 |
| 206 |
|
| 207 |
*** EOOH *** |
| 208 |
Return-Path: <[email protected]> |
| 209 |
Date: Mon, 13 Jan 1997 02:03:28 -0500 |
| 210 |
From: [email protected] (Kimbo Mundy) |
| 211 |
X-Mailer: Mozilla 3.0Gold (WinNT; U) |
| 212 |
MIME-Version: 1.0 |
| 213 |
To: Sriram Sankar <[email protected]> |
| 214 |
Subject: Re: HTML? |
| 215 |
References: <[email protected]> |
| 216 |
Content-Transfer-Encoding: 7bit |
| 217 |
X-Lines: 34 |
| 218 |
Content-Type: text/plain; charset="us-ascii" |
| 219 |
Content-Length: 1420 |
| 220 |
|
| 221 |
Well, I finally got an HTML grammar out there (at |
| 222 |
http://www.tiac.net/users/kimbo/jack/HTML.jack). I hope you saw it, I |
| 223 |
got some mailer errors, that seemed like the kind that you could ignore, |
| 224 |
but at least one person didn't receive my first posting. |
| 225 |
|
| 226 |
I'd be interested to know if this is the sort of thing people are |
| 227 |
looking for, or do they want the full set of tags enumerated in the |
| 228 |
grammar as well? Also, if there you have any desire to bundle this with |
| 229 |
Jack (possibly after upgrades and/or integration with other people's |
| 230 |
work), please feel free. |
| 231 |
|
| 232 |
I must say Jack is an amazing tool. It was really easy to learn. I |
| 233 |
love how readable the grammars are, and I love being able to pass info |
| 234 |
up and down the productions as the parser runs. I never want to have to |
| 235 |
settle for LALR(1) again! Thanks for writing it! |
| 236 |
|
| 237 |
|