struct CYContext;
struct CYThing {
- virtual ~CYThing() {
- }
-
virtual void Output(struct CYOutput &out) const = 0;
};
struct CYPropertyName {
virtual void PropertyName(CYOutput &out) const = 0;
-
- virtual ~CYPropertyName() {
- }
};
struct CYExpression;
CYNext<CYStatement>,
CYThing
{
- virtual ~CYStatement() {
- }
-
void Single(CYOutput &out, CYFlags flags, CYCompactType request) const;
void Multiple(CYOutput &out, CYFlags flags = CYNoFlags) const;
virtual void Output(CYOutput &out) const;
};
struct CYClassName {
- virtual ~CYClassName() {
- }
-
virtual CYExpression *ClassName(CYContext &context, bool object) = 0;
virtual void ClassName(CYOutput &out, bool object) const = 0;
};
CYIdentifier *Replace(CYContext &context);
};
-struct CYComment :
- CYStatement
-{
- const char *value_;
-
- CYComment(const char *value) :
- value_(value)
- {
- }
-
- CYCompact(None)
-
- virtual CYStatement *Replace(CYContext &context);
- virtual void Output(CYOutput &out, CYFlags flags) const;
-};
-
struct CYLabel :
CYStatement
{
void Close(CYContext &context, CYStatement *&statements);
};
-struct CYProgram :
+struct CYScript :
CYThing
{
CYStatement *code_;
- CYProgram(CYStatement *code) :
+ CYScript(CYStatement *code) :
code_(code)
{
}
{
}
- virtual ~CYContext() {
- }
-
void ReplaceAll(CYStatement *&statement) {
if (statement == NULL)
return;
virtual CYStatement *Return();
};
-struct CYForInitialiser {
- virtual ~CYForInitialiser() {
- }
-
+struct CYForInitializer {
virtual CYExpression *Replace(CYContext &context) = 0;
virtual void Output(CYOutput &out, CYFlags flags) const = 0;
};
-struct CYForInInitialiser {
- virtual ~CYForInInitialiser() {
- }
-
+struct CYForInInitializer {
virtual void ForIn(CYOutput &out, CYFlags flags) const = 0;
virtual CYStatement *ForEachIn(CYContext &out, CYExpression *value) = 0;
struct CYString;
struct CYExpression :
- CYForInitialiser,
- CYForInInitialiser,
+ CYForInitializer,
+ CYForInInitializer,
CYClassName,
CYThing
{
CYNext<CYFunctionParameter>,
CYThing
{
- CYForInInitialiser *initialiser_;
+ CYForInInitializer *initialiser_;
- CYFunctionParameter(CYForInInitialiser *initialiser, CYFunctionParameter *next = NULL) :
+ CYFunctionParameter(CYForInInitializer *initialiser, CYFunctionParameter *next = NULL) :
CYNext<CYFunctionParameter>(next),
initialiser_(initialiser)
{
virtual void PropertyName(CYOutput &out) const;
};
+struct CYElementValue;
+
+struct CYSpan :
+ CYNext<CYSpan>
+{
+ CYExpression *expression_;
+ CYString *string_;
+
+ CYSpan(CYExpression *expression, CYString *string, CYSpan *next) :
+ CYNext<CYSpan>(next),
+ expression_(expression),
+ string_(string)
+ {
+ }
+
+ CYElementValue *Replace(CYContext &context);
+};
+
+struct CYTemplate :
+ CYExpression
+{
+ CYString *string_;
+ CYSpan *spans_;
+
+ CYTemplate(CYString *string, CYSpan *spans) :
+ string_(string),
+ spans_(spans)
+ {
+ }
+
+ CYPrecedence(0)
+ CYRightHand(false)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYNumber :
CYTrivial,
CYPropertyName
CYTrivial
{
const char *value_;
+ size_t size_;
- CYRegEx(const char *value) :
- value_(value)
+ CYRegEx(const char *value, size_t size) :
+ value_(value),
+ size_(size)
{
}
};
struct CYNull :
- CYWord,
CYTrivial
{
- CYNull() :
- CYWord("null")
- {
- }
-
virtual CYNumber *Number(CYContext &context);
virtual CYString *String(CYContext &context);
};
struct CYThis :
- CYWord,
CYMagic
{
- CYThis() :
- CYWord("this")
- {
- }
-
virtual CYExpression *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
};
struct CYFalse :
- CYWord,
CYBoolean
{
- CYFalse() :
- CYWord("false")
- {
- }
-
virtual bool Value() const {
return false;
}
};
struct CYTrue :
- CYWord,
CYBoolean
{
- CYTrue() :
- CYWord("true")
- {
- }
-
virtual bool Value() const {
return true;
}
void Output(CYOutput &out) const;
};
-struct CYBlank :
- public CYWord
-{
- CYBlank() :
- CYWord("")
- {
- }
-};
-
struct CYClause :
CYThing,
CYNext<CYClause>
};
struct CYElement :
- CYNext<CYElement>,
CYThing
+{
+ virtual bool Elision() const = 0;
+
+ virtual void Replace(CYContext &context) = 0;
+};
+
+struct CYElementValue :
+ CYNext<CYElement>,
+ CYElement
{
CYExpression *value_;
- CYElement(CYExpression *value, CYElement *next) :
+ CYElementValue(CYExpression *value, CYElement *next) :
CYNext<CYElement>(next),
value_(value)
{
}
- void Replace(CYContext &context);
- void Output(CYOutput &out) const;
+ virtual bool Elision() const {
+ return value_ == NULL;
+ }
+
+ virtual void Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYElementSpread :
+ CYElement
+{
+ CYExpression *value_;
+
+ CYElementSpread(CYExpression *value) :
+ value_(value)
+ {
+ }
+
+ virtual bool Elision() const {
+ return false;
+ }
+
+ virtual void Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
};
struct CYArray :
};
struct CYDeclaration :
- CYForInInitialiser
+ CYForInInitializer
{
CYIdentifier *identifier_;
CYExpression *initialiser_;
};
struct CYForDeclarations :
- CYForInitialiser
+ CYForInitializer
{
CYDeclarations *declarations_;
struct CYFor :
CYStatement
{
- CYForInitialiser *initialiser_;
+ CYForInitializer *initialiser_;
CYExpression *test_;
CYExpression *increment_;
CYStatement *code_;
- CYFor(CYForInitialiser *initialiser, CYExpression *test, CYExpression *increment, CYStatement *code) :
+ CYFor(CYForInitializer *initialiser, CYExpression *test, CYExpression *increment, CYStatement *code) :
initialiser_(initialiser),
test_(test),
increment_(increment),
struct CYForIn :
CYStatement
{
- CYForInInitialiser *initialiser_;
+ CYForInInitializer *initialiser_;
CYExpression *set_;
CYStatement *code_;
- CYForIn(CYForInInitialiser *initialiser, CYExpression *set, CYStatement *code) :
+ CYForIn(CYForInInitializer *initialiser, CYExpression *set, CYStatement *code) :
initialiser_(initialiser),
set_(set),
code_(code)
struct CYForOf :
CYStatement
{
- CYForInInitialiser *initialiser_;
+ CYForInInitializer *initialiser_;
CYExpression *set_;
CYStatement *code_;
- CYForOf(CYForInInitialiser *initialiser, CYExpression *set, CYStatement *code) :
+ CYForOf(CYForInInitializer *initialiser, CYExpression *set, CYStatement *code) :
initialiser_(initialiser),
set_(set),
code_(code)
{
}
- virtual ~CYFunction() {
- }
-
void Inject(CYContext &context);
virtual void Replace_(CYContext &context, bool outer);
virtual void Output(CYOutput &out, CYFlags flags) const;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
+struct CYYieldGenerator :
+ CYExpression
+{
+ CYExpression *value_;
+
+ CYYieldGenerator(CYExpression *value) :
+ value_(value)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYYieldValue :
+ CYExpression
+{
+ CYExpression *value_;
+
+ CYYieldValue(CYExpression *value) :
+ value_(value)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYEmpty :
CYStatement
{