iv-phonic 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/ext/include/iv/ast.h +63 -77
- data/ext/include/iv/ast_factory.h +25 -28
- data/ext/include/iv/character.h +4 -4
- data/ext/include/iv/cmdline.h +127 -2
- data/ext/include/iv/conversions.h +25 -2
- data/ext/include/iv/lexer.h +17 -11
- data/ext/include/iv/parser.h +137 -77
- data/ext/include/iv/token.h +30 -18
- data/ext/iv/phonic/factory.h +26 -21
- data/ext/iv/phonic/parser.h +1 -1
- metadata +4 -20
data/ext/iv/phonic/factory.h
CHANGED
@@ -7,6 +7,7 @@ extern "C" {
|
|
7
7
|
}
|
8
8
|
#include <iv/alloc.h>
|
9
9
|
#include <iv/ustringpiece.h>
|
10
|
+
#include <iv/space.h>
|
10
11
|
#include "encoding.h"
|
11
12
|
#include "ast_fwd.h"
|
12
13
|
namespace iv {
|
@@ -66,22 +67,23 @@ class AstFactory : public core::Space<2> {
|
|
66
67
|
return new (this) FunctionLiteral(type, this);
|
67
68
|
}
|
68
69
|
|
69
|
-
ArrayLiteral* NewArrayLiteral() {
|
70
|
-
return new (this) ArrayLiteral(
|
70
|
+
ArrayLiteral* NewArrayLiteral(Expressions* items) {
|
71
|
+
return new (this) ArrayLiteral(items);
|
71
72
|
}
|
72
73
|
|
73
|
-
ObjectLiteral* NewObjectLiteral() {
|
74
|
-
return new (this) ObjectLiteral(
|
74
|
+
ObjectLiteral* NewObjectLiteral(ObjectLiteral::Properties* properties) {
|
75
|
+
return new (this) ObjectLiteral(properties);
|
75
76
|
}
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
template<typename T>
|
79
|
+
T** NewPtr() {
|
80
|
+
return new (New(sizeof(T*))) T*(NULL); // NOLINT
|
80
81
|
}
|
81
82
|
|
82
83
|
template<typename T>
|
83
|
-
T
|
84
|
-
|
84
|
+
typename core::SpaceVector<AstFactory, T>::type* NewVector() {
|
85
|
+
typedef typename core::SpaceVector<AstFactory, T>::type Vector;
|
86
|
+
return new (New(sizeof(Vector))) Vector(typename Vector::allocator_type(this));
|
85
87
|
}
|
86
88
|
|
87
89
|
NullLiteral* NewNullLiteral() {
|
@@ -120,12 +122,13 @@ class AstFactory : public core::Space<2> {
|
|
120
122
|
return new (this) FunctionDeclaration(func);
|
121
123
|
}
|
122
124
|
|
123
|
-
Block* NewBlock() {
|
124
|
-
return new (this) Block(
|
125
|
+
Block* NewBlock(Statements* body) {
|
126
|
+
return new (this) Block(body);
|
125
127
|
}
|
126
128
|
|
127
|
-
VariableStatement* NewVariableStatement(core::Token::Type token
|
128
|
-
|
129
|
+
VariableStatement* NewVariableStatement(core::Token::Type token,
|
130
|
+
Declarations* decls) {
|
131
|
+
return new (this) VariableStatement(token, decls);
|
129
132
|
}
|
130
133
|
|
131
134
|
Declaration* NewDeclaration(Identifier* name, Expression* expr) {
|
@@ -186,14 +189,16 @@ class AstFactory : public core::Space<2> {
|
|
186
189
|
return new (this) WithStatement(expr, stmt);
|
187
190
|
}
|
188
191
|
|
189
|
-
SwitchStatement* NewSwitchStatement(Expression* expr) {
|
190
|
-
return new (this) SwitchStatement(expr,
|
192
|
+
SwitchStatement* NewSwitchStatement(Expression* expr, CaseClauses* clauses) {
|
193
|
+
return new (this) SwitchStatement(expr, clauses);
|
191
194
|
}
|
192
195
|
|
193
|
-
CaseClause* NewCaseClause(bool is_default,
|
194
|
-
|
196
|
+
CaseClause* NewCaseClause(bool is_default,
|
197
|
+
Expression* expr, Statements* body) {
|
198
|
+
return new (this) CaseClause(is_default, expr, body);
|
195
199
|
}
|
196
200
|
|
201
|
+
|
197
202
|
ThrowStatement* NewThrowStatement(Expression* expr) {
|
198
203
|
return new (this) ThrowStatement(expr);
|
199
204
|
}
|
@@ -240,12 +245,12 @@ class AstFactory : public core::Space<2> {
|
|
240
245
|
return new (this) PostfixExpression(op, expr);
|
241
246
|
}
|
242
247
|
|
243
|
-
FunctionCall* NewFunctionCall(Expression* expr) {
|
244
|
-
return new (this) FunctionCall(expr,
|
248
|
+
FunctionCall* NewFunctionCall(Expression* expr, Expressions* args) {
|
249
|
+
return new (this) FunctionCall(expr, args);
|
245
250
|
}
|
246
251
|
|
247
|
-
ConstructorCall* NewConstructorCall(Expression* target) {
|
248
|
-
return new (this) ConstructorCall(target,
|
252
|
+
ConstructorCall* NewConstructorCall(Expression* target, Expressions* args) {
|
253
|
+
return new (this) ConstructorCall(target, args);
|
249
254
|
}
|
250
255
|
|
251
256
|
IndexAccess* NewIndexAccess(Expression* expr, Expression* index) {
|
data/ext/iv/phonic/parser.h
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iv-phonic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
version: 0.0.9
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Constellation
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-02-08 00:00:00 +09:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
24
|
version: "0"
|
31
25
|
type: :development
|
32
26
|
version_requirements: *id001
|
@@ -38,10 +32,6 @@ dependencies:
|
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 2
|
43
|
-
- 8
|
44
|
-
- 0
|
45
35
|
version: 2.8.0
|
46
36
|
type: :development
|
47
37
|
version_requirements: *id002
|
@@ -118,23 +108,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
108
|
requirements:
|
119
109
|
- - ">="
|
120
110
|
- !ruby/object:Gem::Version
|
121
|
-
segments:
|
122
|
-
- 1
|
123
|
-
- 9
|
124
|
-
- 1
|
125
111
|
version: 1.9.1
|
126
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
113
|
none: false
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
segments:
|
132
|
-
- 0
|
133
117
|
version: "0"
|
134
118
|
requirements: []
|
135
119
|
|
136
120
|
rubyforge_project: iv-phonic
|
137
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.5.0
|
138
122
|
signing_key:
|
139
123
|
specification_version: 3
|
140
124
|
summary: "iv / phonic : ECMAScript AST"
|