1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
From patrick%cs.kuleuven.ac.be@princeton.edu Thu Aug 29 01:20:59 1991
Return-Path: <patrick%cs.kuleuven.ac.be@princeton.edu>
Received: from alpha.xerox.com by palain.PARC (4.1/SMI-4.1)
id AA13556; Thu, 29 Aug 91 01:20:57 PDT
Received: from Minos.PARC.Xerox.xns by alpha.xerox.com via XNS id <11523>; Thu, 29 Aug 1991 01:20:32 PDT
Received: from Princeton.EDU ([128.112.128.1]) by alpha.xerox.com with SMTP id <11523>; Thu, 29 Aug 1991 01:20:05 PDT
Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.80/princeton)
id AA15585; Thu, 29 Aug 91 04:19:59 -0400
Received: from Princeton.EDU (Princeton.EDU.) by fs.Princeton.EDU (4.0/1.105)
id AA08885; Thu, 29 Aug 91 04:19:57 EDT
Received: from n-kulcs.cs.kuleuven.ac.be by Princeton.EDU (5.65b/2.80/princeton)
id AA15582; Thu, 29 Aug 91 04:19:49 -0400
Received: from medusa.cs.kuleuven.ac.be by n-kulcs.cs.kuleuven.ac.be (5.64+/n_kulcs1.1)
id AA02072; Thu, 29 Aug 91 10:20:48 +0200
Received: by medusa.cs.kuleuven.ac.be (5.65b/cs_kuleuven.02)
id AA08766; Thu, 29 Aug 91 10:21:14 +0200
X-Ns-Transport-Id: 08002008D0FD000FC327
Date: Thu, 29 Aug 1991 01:21:14 PDT
From: patrick%cs.kuleuven.ac.be@princeton.edu (Patrick Weemeeuw)
Subject: Spidery Web
To: nr@princeton.edu
Message-Id: <9108290821.AA08766@medusa.cs.kuleuven.ac.be>
Status: RO
Hello,
I'm trying to develop a web system for Prolog.
One of the difficulties I had is recognizing tokens containing
backslashes. I changed master/spider.web such that it now correctly
handles tokens like:
token \\== category ....
generating the C string "\\==" but checking for a string with lenght *3*
instead of 4.
The context diff is included below.
Patrick.
--
Patrick Weemeeuw mail: Katholieke Universiteit Leuven
Tel: +32 16 200656 x 3544 Dept. of Computer Science
e-mail: patrick@cs.kuleuven.ac.be Celestijnenlaan 200 A
Fax: +32 16 205308 B-3001 Leuven (Belgium)
======================================================================
*** spider.web Wed Aug 28 19:32:01 1991
--- spider.web.orig Wed Aug 28 17:47:57 1991
***************
*** 794,800
tokenname[$2]="SP_gen_token_" tokennumber
tokennumbers[$2]=tokennumber
tokennumber--
- #<Find real length of |$2| and put it in |tokenlength[$2]|#>
## figure out how to recognize the token
temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, tokenlength[$2])
tokentest[$2]=temp
--- 794,799 -----
tokenname[$2]="SP_gen_token_" tokennumber
tokennumbers[$2]=tokennumber
tokennumber--
## figure out how to recognize the token
temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, length($2))
tokentest[$2]=temp
***************
*** 796,802
tokennumber--
#<Find real length of |$2| and put it in |tokenlength[$2]|#>
## figure out how to recognize the token
! temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, tokenlength[$2])
tokentest[$2]=temp
# To find the length of a string considered as a C~string, we scan it looking
--- 795,801 -----
tokennumbers[$2]=tokennumber
tokennumber--
## figure out how to recognize the token
! temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, length($2))
tokentest[$2]=temp
tokenlength[$2]=length($2)
***************
*** 798,803
## figure out how to recognize the token
temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, tokenlength[$2])
tokentest[$2]=temp
# To find the length of a string considered as a C~string, we scan it looking
for occurrences of the \.{\\} character. We initialize |templ| with
--- 797,803 -----
## figure out how to recognize the token
temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, length($2))
tokentest[$2]=temp
+ tokenlength[$2]=length($2)
# The setting of attributes is as for all tokens:
***************
*** 799,827
temp = sprintf( "strncmp(\"%s\",loc-1,%d)==0", $2, tokenlength[$2])
tokentest[$2]=temp
- # To find the length of a string considered as a C~string, we scan it looking
- for occurrences of the \.{\\} character. We initialize |templ| with
- |length($2)|, and each time we find a legitimate escape sequence, we decrement
- |templ|. Remark that, given the current lexical analysis, \.{\\f}, \.{\\n} etc.
- cannot occur in a token.
- #<Find real length of |$2| and put it in |tokenlength[$2]|#>=
- templ=length($2)
- i=1 #/
- while(i<=length($2)) { #/
- if(substr($2,i,1)=="\\") { #/
- if(i<length($2)) {
- tempc=substr($2,i+1,1) #/
- if((tempc=="a") || (tempc=="b") || (tempc=="\\") || (tempc=="?") || (tempc=="'")) {
- templ--
- i++
- } else { #/
- i++ #/
- } #/
- } #/
- } #/
- i++ #/
- } #/
- tokenlength[$2]=templ
# The setting of attributes is as for all tokens:
#<Set attributes of token |$2|#>=
--- 799,804 -----
tokentest[$2]=temp
tokenlength[$2]=length($2)
# The setting of attributes is as for all tokens:
#<Set attributes of token |$2|#>=
|