jbarnette-johnson 1.0.0.200808062111 → 1.0.0.200811251942
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST +4 -1
- data/Rakefile +65 -2
- data/bin/johnson +9 -9
- data/ext/spidermonkey/context.c +1 -7
- data/ext/spidermonkey/debugger.c +18 -0
- data/ext/spidermonkey/immutable_node.c.erb +1 -0
- data/ext/spidermonkey/ruby_land_proxy.c +7 -3
- data/ext/spidermonkey/runtime.c +5 -3
- data/johnson.gemspec +8 -6
- data/js/johnson/browser/env.js +60 -43
- data/js/johnson/browser/jquery.js +5 -3
- data/js/johnson/cli.js +1 -1
- data/lib/johnson.rb +8 -0
- data/lib/johnson/cli/options.rb +11 -6
- data/lib/johnson/nodes/binary_node.rb +1 -0
- data/lib/johnson/nodes/list.rb +1 -0
- data/lib/johnson/runtime.rb +8 -0
- data/lib/johnson/spidermonkey/immutable_node.rb +2 -0
- data/lib/johnson/spidermonkey/mutable_tree_visitor.rb +9 -0
- data/lib/johnson/spidermonkey/ruby_land_proxy.rb +2 -0
- data/lib/johnson/visitors/dot_visitor.rb +2 -0
- data/lib/johnson/visitors/ecma_visitor.rb +8 -0
- data/lib/johnson/visitors/enumerating_visitor.rb +7 -1
- data/lib/johnson/visitors/sexp_visitor.rb +2 -0
- data/test/helper.rb +2 -2
- data/test/johnson/browser_test.rb +32 -27
- data/test/johnson/nodes/let_test.rb +31 -0
- data/test/johnson/runtime_test.rb +10 -10
- data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +9 -0
- data/test/jquery_units/units/core.js +42 -39
- data/vendor/spidermonkey/jsxml.h +349 -0
- metadata +4 -2
@@ -0,0 +1,349 @@
|
|
1
|
+
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2
|
+
*
|
3
|
+
* ***** BEGIN LICENSE BLOCK *****
|
4
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
5
|
+
*
|
6
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
7
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
8
|
+
* the License. You may obtain a copy of the License at
|
9
|
+
* http://www.mozilla.org/MPL/
|
10
|
+
*
|
11
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
12
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13
|
+
* for the specific language governing rights and limitations under the
|
14
|
+
* License.
|
15
|
+
*
|
16
|
+
* The Original Code is SpiderMonkey E4X code, released August, 2004.
|
17
|
+
*
|
18
|
+
* The Initial Developer of the Original Code is
|
19
|
+
* Netscape Communications Corporation.
|
20
|
+
* Portions created by the Initial Developer are Copyright (C) 1998
|
21
|
+
* the Initial Developer. All Rights Reserved.
|
22
|
+
*
|
23
|
+
* Contributor(s):
|
24
|
+
*
|
25
|
+
* Alternatively, the contents of this file may be used under the terms of
|
26
|
+
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
27
|
+
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
28
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
29
|
+
* of those above. If you wish to allow use of your version of this file only
|
30
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
31
|
+
* use your version of this file under the terms of the MPL, indicate your
|
32
|
+
* decision by deleting the provisions above and replace them with the notice
|
33
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
34
|
+
* the provisions above, a recipient may use your version of this file under
|
35
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
36
|
+
*
|
37
|
+
* ***** END LICENSE BLOCK ***** */
|
38
|
+
|
39
|
+
#ifndef jsxml_h___
|
40
|
+
#define jsxml_h___
|
41
|
+
|
42
|
+
#include "jsstddef.h"
|
43
|
+
#include "jspubtd.h"
|
44
|
+
|
45
|
+
JS_BEGIN_EXTERN_C
|
46
|
+
|
47
|
+
extern const char js_AnyName_str[];
|
48
|
+
extern const char js_AttributeName_str[];
|
49
|
+
extern const char js_isXMLName_str[];
|
50
|
+
extern const char js_XMLList_str[];
|
51
|
+
|
52
|
+
extern const char js_amp_entity_str[];
|
53
|
+
extern const char js_gt_entity_str[];
|
54
|
+
extern const char js_lt_entity_str[];
|
55
|
+
extern const char js_quot_entity_str[];
|
56
|
+
|
57
|
+
struct JSXMLNamespace {
|
58
|
+
JSObject *object;
|
59
|
+
JSString *prefix;
|
60
|
+
JSString *uri;
|
61
|
+
JSBool declared; /* true if declared in its XML tag */
|
62
|
+
};
|
63
|
+
|
64
|
+
extern JSXMLNamespace *
|
65
|
+
js_NewXMLNamespace(JSContext *cx, JSString *prefix, JSString *uri,
|
66
|
+
JSBool declared);
|
67
|
+
|
68
|
+
extern void
|
69
|
+
js_TraceXMLNamespace(JSTracer *trc, JSXMLNamespace *ns);
|
70
|
+
|
71
|
+
extern void
|
72
|
+
js_FinalizeXMLNamespace(JSContext *cx, JSXMLNamespace *ns);
|
73
|
+
|
74
|
+
extern JSObject *
|
75
|
+
js_NewXMLNamespaceObject(JSContext *cx, JSString *prefix, JSString *uri,
|
76
|
+
JSBool declared);
|
77
|
+
|
78
|
+
extern JSObject *
|
79
|
+
js_GetXMLNamespaceObject(JSContext *cx, JSXMLNamespace *ns);
|
80
|
+
|
81
|
+
struct JSXMLQName {
|
82
|
+
JSObject *object;
|
83
|
+
JSString *uri;
|
84
|
+
JSString *prefix;
|
85
|
+
JSString *localName;
|
86
|
+
};
|
87
|
+
|
88
|
+
extern JSXMLQName *
|
89
|
+
js_NewXMLQName(JSContext *cx, JSString *uri, JSString *prefix,
|
90
|
+
JSString *localName);
|
91
|
+
|
92
|
+
extern void
|
93
|
+
js_TraceXMLQName(JSTracer *trc, JSXMLQName *qn);
|
94
|
+
|
95
|
+
extern void
|
96
|
+
js_FinalizeXMLQName(JSContext *cx, JSXMLQName *qn);
|
97
|
+
|
98
|
+
extern JSObject *
|
99
|
+
js_NewXMLQNameObject(JSContext *cx, JSString *uri, JSString *prefix,
|
100
|
+
JSString *localName);
|
101
|
+
|
102
|
+
extern JSObject *
|
103
|
+
js_GetXMLQNameObject(JSContext *cx, JSXMLQName *qn);
|
104
|
+
|
105
|
+
extern JSObject *
|
106
|
+
js_GetAttributeNameObject(JSContext *cx, JSXMLQName *qn);
|
107
|
+
|
108
|
+
extern JSObject *
|
109
|
+
js_ConstructXMLQNameObject(JSContext *cx, jsval nsval, jsval lnval);
|
110
|
+
|
111
|
+
typedef JSBool
|
112
|
+
(* JS_DLL_CALLBACK JSIdentityOp)(const void *a, const void *b);
|
113
|
+
|
114
|
+
struct JSXMLArray {
|
115
|
+
uint32 length;
|
116
|
+
uint32 capacity;
|
117
|
+
void **vector;
|
118
|
+
JSXMLArrayCursor *cursors;
|
119
|
+
};
|
120
|
+
|
121
|
+
#define JSXML_PRESET_CAPACITY JS_BIT(31)
|
122
|
+
#define JSXML_CAPACITY_MASK JS_BITMASK(31)
|
123
|
+
#define JSXML_CAPACITY(array) ((array)->capacity & JSXML_CAPACITY_MASK)
|
124
|
+
|
125
|
+
struct JSXMLArrayCursor {
|
126
|
+
JSXMLArray *array;
|
127
|
+
uint32 index;
|
128
|
+
JSXMLArrayCursor *next;
|
129
|
+
JSXMLArrayCursor **prevp;
|
130
|
+
void *root;
|
131
|
+
};
|
132
|
+
|
133
|
+
/*
|
134
|
+
* NB: don't reorder this enum without changing all array initializers that
|
135
|
+
* depend on it in jsxml.c.
|
136
|
+
*/
|
137
|
+
typedef enum JSXMLClass {
|
138
|
+
JSXML_CLASS_LIST,
|
139
|
+
JSXML_CLASS_ELEMENT,
|
140
|
+
JSXML_CLASS_ATTRIBUTE,
|
141
|
+
JSXML_CLASS_PROCESSING_INSTRUCTION,
|
142
|
+
JSXML_CLASS_TEXT,
|
143
|
+
JSXML_CLASS_COMMENT,
|
144
|
+
JSXML_CLASS_LIMIT
|
145
|
+
} JSXMLClass;
|
146
|
+
|
147
|
+
#define JSXML_CLASS_HAS_KIDS(class_) ((class_) < JSXML_CLASS_ATTRIBUTE)
|
148
|
+
#define JSXML_CLASS_HAS_VALUE(class_) ((class_) >= JSXML_CLASS_ATTRIBUTE)
|
149
|
+
#define JSXML_CLASS_HAS_NAME(class_) \
|
150
|
+
((uintN)((class_) - JSXML_CLASS_ELEMENT) <= \
|
151
|
+
(uintN)(JSXML_CLASS_PROCESSING_INSTRUCTION - JSXML_CLASS_ELEMENT))
|
152
|
+
|
153
|
+
#ifdef DEBUG_notme
|
154
|
+
#include "jsclist.h"
|
155
|
+
#endif
|
156
|
+
|
157
|
+
typedef struct JSXMLListVar {
|
158
|
+
JSXMLArray kids; /* NB: must come first */
|
159
|
+
JSXML *target;
|
160
|
+
JSXMLQName *targetprop;
|
161
|
+
} JSXMLListVar;
|
162
|
+
|
163
|
+
typedef struct JSXMLElemVar {
|
164
|
+
JSXMLArray kids; /* NB: must come first */
|
165
|
+
JSXMLArray namespaces;
|
166
|
+
JSXMLArray attrs;
|
167
|
+
} JSXMLElemVar;
|
168
|
+
|
169
|
+
struct JSXML {
|
170
|
+
#ifdef DEBUG_notme
|
171
|
+
JSCList links;
|
172
|
+
uint32 serial;
|
173
|
+
#endif
|
174
|
+
JSObject *object;
|
175
|
+
void *domnode; /* DOM node if mapped info item */
|
176
|
+
JSXML *parent;
|
177
|
+
JSXMLQName *name;
|
178
|
+
uint16 xml_class; /* discriminates u, below */
|
179
|
+
uint16 xml_flags; /* flags, see below */
|
180
|
+
union {
|
181
|
+
JSXMLListVar list;
|
182
|
+
JSXMLElemVar elem;
|
183
|
+
JSString *value;
|
184
|
+
} u;
|
185
|
+
|
186
|
+
/* Don't add anything after u -- see js_NewXML for why. */
|
187
|
+
};
|
188
|
+
|
189
|
+
/* union member shorthands */
|
190
|
+
#define xml_kids u.list.kids
|
191
|
+
#define xml_target u.list.target
|
192
|
+
#define xml_targetprop u.list.targetprop
|
193
|
+
#define xml_namespaces u.elem.namespaces
|
194
|
+
#define xml_attrs u.elem.attrs
|
195
|
+
#define xml_value u.value
|
196
|
+
|
197
|
+
/* xml_flags values */
|
198
|
+
#define XMLF_WHITESPACE_TEXT 0x1
|
199
|
+
|
200
|
+
/* xml_class-testing macros */
|
201
|
+
#define JSXML_HAS_KIDS(xml) JSXML_CLASS_HAS_KIDS((xml)->xml_class)
|
202
|
+
#define JSXML_HAS_VALUE(xml) JSXML_CLASS_HAS_VALUE((xml)->xml_class)
|
203
|
+
#define JSXML_HAS_NAME(xml) JSXML_CLASS_HAS_NAME((xml)->xml_class)
|
204
|
+
#define JSXML_LENGTH(xml) (JSXML_CLASS_HAS_KIDS((xml)->xml_class) \
|
205
|
+
? (xml)->xml_kids.length \
|
206
|
+
: 0)
|
207
|
+
|
208
|
+
extern JSXML *
|
209
|
+
js_NewXML(JSContext *cx, JSXMLClass xml_class);
|
210
|
+
|
211
|
+
extern void
|
212
|
+
js_TraceXML(JSTracer *trc, JSXML *xml);
|
213
|
+
|
214
|
+
extern void
|
215
|
+
js_FinalizeXML(JSContext *cx, JSXML *xml);
|
216
|
+
|
217
|
+
extern JSObject *
|
218
|
+
js_ParseNodeToXMLObject(JSContext *cx, JSParseContext *pc, JSParseNode *pn);
|
219
|
+
|
220
|
+
extern JSObject *
|
221
|
+
js_NewXMLObject(JSContext *cx, JSXMLClass xml_class);
|
222
|
+
|
223
|
+
extern JSObject *
|
224
|
+
js_GetXMLObject(JSContext *cx, JSXML *xml);
|
225
|
+
|
226
|
+
extern JS_FRIEND_DATA(JSXMLObjectOps) js_XMLObjectOps;
|
227
|
+
extern JS_FRIEND_DATA(JSClass) js_XMLClass;
|
228
|
+
extern JS_FRIEND_DATA(JSExtendedClass) js_NamespaceClass;
|
229
|
+
extern JS_FRIEND_DATA(JSExtendedClass) js_QNameClass;
|
230
|
+
extern JS_FRIEND_DATA(JSClass) js_AttributeNameClass;
|
231
|
+
extern JS_FRIEND_DATA(JSClass) js_AnyNameClass;
|
232
|
+
extern JSClass js_XMLFilterClass;
|
233
|
+
|
234
|
+
/*
|
235
|
+
* Macros to test whether an object or a value is of type "xml" (per typeof).
|
236
|
+
* NB: jsobj.h must be included before any call to OBJECT_IS_XML, and jsapi.h
|
237
|
+
* and jsobj.h must be included before any call to VALUE_IS_XML.
|
238
|
+
*/
|
239
|
+
#define OBJECT_IS_XML(cx,obj) ((obj)->map->ops == &js_XMLObjectOps.base)
|
240
|
+
#define VALUE_IS_XML(cx,v) (!JSVAL_IS_PRIMITIVE(v) && \
|
241
|
+
OBJECT_IS_XML(cx, JSVAL_TO_OBJECT(v)))
|
242
|
+
|
243
|
+
extern JSObject *
|
244
|
+
js_InitNamespaceClass(JSContext *cx, JSObject *obj);
|
245
|
+
|
246
|
+
extern JSObject *
|
247
|
+
js_InitQNameClass(JSContext *cx, JSObject *obj);
|
248
|
+
|
249
|
+
extern JSObject *
|
250
|
+
js_InitAttributeNameClass(JSContext *cx, JSObject *obj);
|
251
|
+
|
252
|
+
extern JSObject *
|
253
|
+
js_InitAnyNameClass(JSContext *cx, JSObject *obj);
|
254
|
+
|
255
|
+
extern JSObject *
|
256
|
+
js_InitXMLClass(JSContext *cx, JSObject *obj);
|
257
|
+
|
258
|
+
extern JSObject *
|
259
|
+
js_InitXMLClasses(JSContext *cx, JSObject *obj);
|
260
|
+
|
261
|
+
extern JSBool
|
262
|
+
js_GetFunctionNamespace(JSContext *cx, jsval *vp);
|
263
|
+
|
264
|
+
/*
|
265
|
+
* If obj is QName corresponding to function::name, set *funidp to name's id,
|
266
|
+
* otherwise set *funidp to 0.
|
267
|
+
*/
|
268
|
+
JSBool
|
269
|
+
js_IsFunctionQName(JSContext *cx, JSObject *obj, jsid *funidp);
|
270
|
+
|
271
|
+
extern JSBool
|
272
|
+
js_GetDefaultXMLNamespace(JSContext *cx, jsval *vp);
|
273
|
+
|
274
|
+
extern JSBool
|
275
|
+
js_SetDefaultXMLNamespace(JSContext *cx, jsval v);
|
276
|
+
|
277
|
+
/*
|
278
|
+
* Return true if v is a XML QName object, or if it converts to a string that
|
279
|
+
* contains a valid XML qualified name (one containing no :), false otherwise.
|
280
|
+
* NB: This function is an infallible predicate, it hides exceptions.
|
281
|
+
*/
|
282
|
+
extern JSBool
|
283
|
+
js_IsXMLName(JSContext *cx, jsval v);
|
284
|
+
|
285
|
+
extern JSBool
|
286
|
+
js_ToAttributeName(JSContext *cx, jsval *vp);
|
287
|
+
|
288
|
+
extern JSString *
|
289
|
+
js_EscapeAttributeValue(JSContext *cx, JSString *str, JSBool quote);
|
290
|
+
|
291
|
+
extern JSString *
|
292
|
+
js_AddAttributePart(JSContext *cx, JSBool isName, JSString *str,
|
293
|
+
JSString *str2);
|
294
|
+
|
295
|
+
extern JSString *
|
296
|
+
js_EscapeElementValue(JSContext *cx, JSString *str);
|
297
|
+
|
298
|
+
extern JSString *
|
299
|
+
js_ValueToXMLString(JSContext *cx, jsval v);
|
300
|
+
|
301
|
+
extern JSBool
|
302
|
+
js_GetAnyName(JSContext *cx, jsval *vp);
|
303
|
+
|
304
|
+
/*
|
305
|
+
* Note: nameval must be either QName, AttributeName, or AnyName.
|
306
|
+
*/
|
307
|
+
extern JSBool
|
308
|
+
js_FindXMLProperty(JSContext *cx, jsval nameval, JSObject **objp, jsid *idp);
|
309
|
+
|
310
|
+
extern JSBool
|
311
|
+
js_GetXMLFunction(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
312
|
+
|
313
|
+
extern JSBool
|
314
|
+
js_GetXMLDescendants(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
315
|
+
|
316
|
+
extern JSBool
|
317
|
+
js_DeleteXMLListElements(JSContext *cx, JSObject *listobj);
|
318
|
+
|
319
|
+
extern JSObject *
|
320
|
+
js_InitXMLFilterClass(JSContext *cx, JSObject* obj);
|
321
|
+
|
322
|
+
extern JSBool
|
323
|
+
js_StepXMLListFilter(JSContext *cx, JSBool initialized);
|
324
|
+
|
325
|
+
extern JSObject *
|
326
|
+
js_ValueToXMLObject(JSContext *cx, jsval v);
|
327
|
+
|
328
|
+
extern JSObject *
|
329
|
+
js_ValueToXMLListObject(JSContext *cx, jsval v);
|
330
|
+
|
331
|
+
extern JSObject *
|
332
|
+
js_CloneXMLObject(JSContext *cx, JSObject *obj);
|
333
|
+
|
334
|
+
extern JSObject *
|
335
|
+
js_NewXMLSpecialObject(JSContext *cx, JSXMLClass xml_class, JSString *name,
|
336
|
+
JSString *value);
|
337
|
+
|
338
|
+
extern JSString *
|
339
|
+
js_MakeXMLCDATAString(JSContext *cx, JSString *str);
|
340
|
+
|
341
|
+
extern JSString *
|
342
|
+
js_MakeXMLCommentString(JSContext *cx, JSString *str);
|
343
|
+
|
344
|
+
extern JSString *
|
345
|
+
js_MakeXMLPIString(JSContext *cx, JSString *name, JSString *str);
|
346
|
+
|
347
|
+
JS_END_EXTERN_C
|
348
|
+
|
349
|
+
#endif /* jsxml_h___ */
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jbarnette-johnson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.200811251942
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Barnette
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2008-
|
15
|
+
date: 2008-11-25 00:00:00 -08:00
|
16
16
|
default_executable: johnson
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -420,6 +420,7 @@ files:
|
|
420
420
|
- vendor/spidermonkey/resource.h
|
421
421
|
- vendor/spidermonkey/rules.mk
|
422
422
|
- vendor/spidermonkey/win32.order
|
423
|
+
- test/johnson/nodes/let_test.rb
|
423
424
|
has_rdoc: true
|
424
425
|
homepage: http://github.com/jbarnette/johnson/wikis
|
425
426
|
post_install_message:
|
@@ -476,6 +477,7 @@ test_files:
|
|
476
477
|
- test/johnson/nodes/if_test.rb
|
477
478
|
- test/johnson/nodes/import_test.rb
|
478
479
|
- test/johnson/nodes/label_test.rb
|
480
|
+
- test/johnson/nodes/let_test.rb
|
479
481
|
- test/johnson/nodes/object_literal_test.rb
|
480
482
|
- test/johnson/nodes/return_test.rb
|
481
483
|
- test/johnson/nodes/semi_test.rb
|