#include <streambuf>
#include <string>
#include <vector>
-#include <map>
-#include <set>
#include "List.hpp"
#include "Location.hpp"
_assert(out_.sputc(value) != EOF);
recent_ = indent_;
if (value == '\n')
- position_.lines(1);
+ position_.Lines(1);
else
- position_.columns(1);
+ position_.Columns(1);
}
_finline void operator ()(const char *data, std::streamsize size) {
_assert(out_.sputn(data, size) == size);
recent_ = indent_;
- position_.columns(size);
+ position_.Columns(size);
}
_finline void operator ()(const char *data) {
typedef CYList<CYStatement> CYStatements;
+struct CYForInitializer :
+ CYStatement
+{
+ virtual CYForInitializer *Replace(CYContext &context) = 0;
+ virtual void Output(CYOutput &out, CYFlags flags) const = 0;
+};
+
struct CYWord :
CYThing,
CYPropertyName
{
}
- void Set(const char *value) {
- word_ = value;
- }
-
virtual bool Constructor() const {
return strcmp(word_, "constructor") == 0;
}
return lhs << rhs.Word();
}
+enum CYIdentifierKind {
+ CYIdentifierArgument,
+ CYIdentifierCatch,
+ CYIdentifierGlobal,
+ CYIdentifierLexical,
+ CYIdentifierMagic,
+ CYIdentifierOther,
+ CYIdentifierVariable,
+};
+
struct CYIdentifier :
CYNext<CYIdentifier>,
CYWord
{
- CYIdentifier *replace_;
+ CYLocation location_;
size_t offset_;
size_t usage_;
CYIdentifier(const char *word) :
CYWord(word),
- replace_(NULL),
offset_(0),
usage_(0)
{
}
virtual const char *Word() const;
- CYIdentifier *Replace(CYContext &context);
+ CYIdentifier *Replace(CYContext &context, CYIdentifierKind);
};
struct CYLabel :
}
};
-enum CYIdentifierFlags {
- CYIdentifierArgument,
- CYIdentifierVariable,
- CYIdentifierOther,
- CYIdentifierMagic,
- CYIdentifierCatch,
-};
-
-typedef std::set<const char *, CYCStringLess> CYCStringSet;
-typedef std::set<CYIdentifier *, CYIdentifierValueLess> CYIdentifierValueSet;
-typedef std::map<CYIdentifier *, CYIdentifierFlags> CYIdentifierAddressFlagsMap;
-
-struct CYIdentifierUsage {
+struct CYIdentifierFlags :
+ CYNext<CYIdentifierFlags>
+{
CYIdentifier *identifier_;
- size_t usage_;
-};
+ CYIdentifierKind kind_;
+ unsigned count_;
+ unsigned offset_;
-typedef std::vector<CYIdentifierUsage> CYIdentifierUsageVector;
+ CYIdentifierFlags(CYIdentifier *identifier, CYIdentifierKind kind, CYIdentifierFlags *next = NULL) :
+ CYNext<CYIdentifierFlags>(next),
+ identifier_(identifier),
+ kind_(kind),
+ count_(0),
+ offset_(0)
+ {
+ }
+};
struct CYScope {
bool transparent_;
CYScope *parent_;
+ bool damaged_;
+ CYIdentifierFlags *shadow_;
- CYIdentifierAddressFlagsMap internal_;
- CYIdentifierValueSet identifiers_;
+ CYIdentifierFlags *internal_;
CYScope(bool transparent, CYContext &context);
- void Declare(CYContext &context, CYIdentifier *identifier, CYIdentifierFlags flags);
- virtual CYIdentifier *Lookup(CYContext &context, CYIdentifier *identifier);
- void Merge(CYContext &context, CYIdentifier *identifier);
+ CYIdentifierFlags *Lookup(CYContext &context, const char *word);
+ CYIdentifierFlags *Lookup(CYContext &context, CYIdentifier *identifier);
+
+ CYIdentifierFlags *Declare(CYContext &context, CYIdentifier *identifier, CYIdentifierKind kind);
+ void Merge(CYContext &context, const CYIdentifierFlags *flags);
+
void Close(CYContext &context, CYStatement *&statements);
+ void Close(CYContext &context);
+ void Damage();
};
struct CYScript :
CYThisScope *this_;
CYIdentifier *super_;
- CYIdentifierUsageVector rename_;
-
CYNonLocal *nonlocal_;
CYNonLocal *nextlocal_;
unsigned unique_;
+ std::vector<CYIdentifier *> replace_;
+
CYContext(CYOptions &options) :
options_(options),
scope_(NULL),
virtual CYStatement *Return();
};
-struct CYForInitializer {
- virtual CYExpression *Replace(CYContext &context) = 0;
- virtual void Output(CYOutput &out, CYFlags flags) const = 0;
-};
+struct CYTarget;
+struct CYVar;
struct CYForInInitializer {
- virtual void ForIn(CYOutput &out, CYFlags flags) const = 0;
- virtual CYStatement *ForEachIn(CYContext &out, CYExpression *value) = 0;
-
- virtual CYExpression *Replace(CYContext &context) = 0;
- virtual CYAssignment *Assignment(CYContext &context) = 0;
+ virtual CYStatement *Initialize(CYContext &context, CYExpression *value) = 0;
+ virtual CYTarget *Replace(CYContext &context) = 0;
virtual void Output(CYOutput &out, CYFlags flags) const = 0;
};
struct CYString;
struct CYExpression :
- CYForInitializer,
- CYForInInitializer,
CYThing
{
virtual int Precedence() const = 0;
return true;
}
- virtual void ForIn(CYOutput &out, CYFlags flags) const;
- virtual CYStatement *ForEachIn(CYContext &out, CYExpression *value);
+ virtual bool Eval() const {
+ return false;
+ }
- virtual CYExpression *AddArgument(CYContext &context, CYExpression *value);
+ virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
virtual void Output(CYOutput &out) const;
virtual void Output(CYOutput &out, CYFlags flags) const = 0;
void Output(CYOutput &out, int precedence, CYFlags flags) const;
virtual CYExpression *Replace(CYContext &context) = 0;
- virtual CYAssignment *Assignment(CYContext &context);
virtual CYExpression *Primitive(CYContext &context) {
return NULL;
}
};
+struct CYTarget :
+ CYExpression,
+ CYForInInitializer
+{
+ virtual bool RightHand() const {
+ return false;
+ }
+
+ virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
+
+ virtual CYTarget *Replace(CYContext &context) = 0;
+ using CYExpression::Output;
+};
+
#define CYAlphabetic(value) \
virtual bool Alphabetic() const { \
return value; \
return Precedence_; \
}
-#define CYRightHand(value) \
- virtual bool RightHand() const { \
- return value; \
- }
-
struct CYCompound :
CYExpression
{
};
struct CYParenthetical :
- CYExpression
+ CYTarget
{
CYExpression *expression_;
CYPrecedence(0)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
void Output(CYOutput &out, CYFlags flags) const;
};
CYNext<CYFunctionParameter>,
CYThing
{
- CYForInInitializer *initialiser_;
+ CYDeclaration *initialiser_;
- CYFunctionParameter(CYForInInitializer *initialiser, CYFunctionParameter *next = NULL) :
+ CYFunctionParameter(CYDeclaration *initialiser, CYFunctionParameter *next = NULL) :
CYNext<CYFunctionParameter>(next),
initialiser_(initialiser)
{
};
struct CYArrayComprehension :
- CYExpression
+ CYTarget
{
CYExpression *expression_;
CYComprehension *comprehensions_;
CYPrecedence(0)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYLiteral :
- CYExpression
+ CYTarget
{
+ CYLocation location_;
+
CYPrecedence(0)
- CYRightHand(false)
virtual CYExpression *Primitive(CYContext &context) {
return this;
struct CYTrivial :
CYLiteral
{
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
};
struct CYMagic :
- CYExpression
+ CYTarget
{
CYPrecedence(0)
- CYRightHand(false)
};
struct CYRange {
};
struct CYTemplate :
- CYExpression
+ CYTarget
{
CYString *string_;
CYSpan *spans_;
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYThis :
CYMagic
{
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYBoolean :
CYTrivial
{
+ CYPrecedence(4)
+
+ virtual bool RightHand() const {
+ return true;
+ }
+
virtual bool Value() const = 0;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
};
struct CYVariable :
- CYExpression
+ CYTarget
{
CYIdentifier *name_;
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual bool Eval() const {
+ return strcmp(name_->Word(), "eval") == 0;
+ }
+
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
virtual CYFunctionParameter *Parameter() const;
struct CYAssignment :
CYExpression
{
- CYExpression *lhs_;
+ CYTarget *lhs_;
CYExpression *rhs_;
- CYAssignment(CYExpression *lhs, CYExpression *rhs) :
+ CYAssignment(CYTarget *lhs, CYExpression *rhs) :
lhs_(lhs),
rhs_(rhs)
{
}
- void SetLeft(CYExpression *lhs) {
- lhs_ = lhs;
+ void SetRight(CYExpression *rhs) {
+ rhs_ = rhs;
}
virtual const char *Operator() const = 0;
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-struct CYDeclaration :
- CYForInInitializer
-{
+struct CYDeclaration {
CYIdentifier *identifier_;
CYExpression *initialiser_;
{
}
- virtual void ForIn(CYOutput &out, CYFlags flags) const;
- virtual CYStatement *ForEachIn(CYContext &out, CYExpression *value);
+ CYTarget *Target(CYContext &context);
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYAssignment *Replace(CYContext &context, CYIdentifierKind kind);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
- virtual CYAssignment *Assignment(CYContext &context);
- CYVariable *Variable(CYContext &context);
+struct CYForLexical :
+ CYForInInitializer
+{
+ bool constant_;
+ CYDeclaration *declaration_;
+
+ CYForLexical(bool constant, CYDeclaration *declaration) :
+ constant_(constant),
+ declaration_(declaration)
+ {
+ }
+
+ virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
+
+ virtual CYTarget *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYForVariable :
+ CYForInInitializer
+{
+ CYDeclaration *declaration_;
+ CYForVariable(CYDeclaration *declaration) :
+ declaration_(declaration)
+ {
+ }
+
+ virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
+
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
{
}
- void Replace(CYContext &context);
+ CYExpression *Replace(CYContext &context, CYIdentifierKind kind);
- CYExpression *Expression(CYContext &context);
CYArgument *Argument(CYContext &context);
CYFunctionParameter *Parameter(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-struct CYForDeclarations :
- CYForInitializer
-{
- CYDeclarations *declarations_;
-
- CYForDeclarations(CYDeclarations *declarations) :
- declarations_(declarations)
- {
- }
-
- virtual CYExpression *Replace(CYContext &context);
- virtual void Output(CYOutput &out, CYFlags flags) const;
-};
-
struct CYVar :
- CYStatement
+ CYForInitializer
{
CYDeclarations *declarations_;
CYCompact(None)
- virtual CYStatement *Replace(CYContext &context);
+ virtual CYForInitializer *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-struct CYLetStatement :
- CYStatement
+struct CYLet :
+ CYForInitializer
{
+ bool constant_;
CYDeclarations *declarations_;
- CYStatement *code_;
- CYLetStatement(CYDeclarations *declarations, CYStatement *code) :
- declarations_(declarations),
- code_(code)
+ CYLet(bool constant, CYDeclarations *declarations) :
+ constant_(constant),
+ declarations_(declarations)
{
}
- CYCompact(Long)
+ CYCompact(None)
- virtual CYStatement *Replace(CYContext &context);
+ virtual CYForInitializer *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
{
}
+ virtual bool Update() const;
+
CYProperty *ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update);
- void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool computed);
+ void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool protect);
- virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name) = 0;
+ virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) = 0;
virtual void Replace(CYContext &context) = 0;
virtual void Output(CYOutput &out) const;
{
}
- virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name);
+ virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
virtual void Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
virtual void Output(CYOutput &out, CYFlags flags) const;
};
+struct CYForInitialized :
+ CYStatement
+{
+ CYDeclaration *declaration_;
+ CYExpression *set_;
+ CYStatement *code_;
+
+ CYForInitialized(CYDeclaration *declaration, CYExpression *set, CYStatement *code) :
+ declaration_(declaration),
+ set_(set),
+ code_(code)
+ {
+ }
+
+ CYCompact(Long)
+
+ virtual CYStatement *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYForOf :
CYStatement
{
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
void Output(CYOutput &out, CYFlags flags) const;
};
struct CYMember :
- CYExpression
+ CYTarget
{
CYExpression *object_;
CYExpression *property_;
}
CYPrecedence(1)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
}
CYPrecedence(1)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
namespace Syntax {
struct New :
- CYExpression
+ CYTarget
{
CYExpression *constructor_;
CYArgument *arguments_;
return arguments_ == NULL ? 2 : 1;
}
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
- virtual CYExpression *AddArgument(CYContext &context, CYExpression *value);
+ virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
};
} }
-struct CYCall :
- CYExpression
+struct CYApply :
+ CYTarget
{
- CYExpression *function_;
CYArgument *arguments_;
- CYCall(CYExpression *function, CYArgument *arguments = NULL) :
- function_(function),
+ CYApply(CYArgument *arguments = NULL) :
arguments_(arguments)
{
}
CYPrecedence(1)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
+};
+
+struct CYCall :
+ CYApply
+{
+ CYExpression *function_;
+
+ CYCall(CYExpression *function, CYArgument *arguments = NULL) :
+ CYApply(arguments),
+ function_(function)
+ {
+ }
+
virtual void Output(CYOutput &out, CYFlags flags) const;
+ virtual CYTarget *Replace(CYContext &context);
+};
- virtual CYExpression *AddArgument(CYContext &context, CYExpression *value);
+struct CYEval :
+ CYApply
+{
+ CYEval(CYArgument *arguments) :
+ CYApply(arguments)
+ {
+ }
+
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+ virtual CYTarget *Replace(CYContext &context);
};
struct CYRubyProc;
struct CYRubyBlock :
- CYExpression
+ CYTarget
{
CYExpression *call_;
CYRubyProc *proc_;
}
CYPrecedence(1)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
- virtual CYExpression *AddArgument(CYContext &context, CYExpression *value);
+ virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
};
struct CYIf :
struct CYFunctionExpression :
CYFunction,
- CYExpression
+ CYTarget
{
CYIdentifier *name_;
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYTarget *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYExpression *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYRubyProc :
CYFunction,
- CYExpression
+ CYTarget
{
CYRubyProc(CYFunctionParameter *parameters, CYStatement *code) :
CYFunction(parameters, code)
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYTarget *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYCompact(None)
- virtual CYStatement *Replace(CYContext &context);
+ CYStatement *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
{
}
- virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name);
+ virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name);
+ virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
virtual void Output(CYOutput &out) const;
};
{
}
+ bool Update() const override;
+
virtual CYFunctionExpression *Constructor();
- virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name);
+ virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
virtual void Output(CYOutput &out) const;
};
};
struct CYClassExpression :
- CYExpression
+ CYTarget
{
CYIdentifier *name_;
CYClassTail *tail_;
}
CYPrecedence(0)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYTarget *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYCompact(Long)
- virtual CYStatement *Replace(CYContext &context);
+ CYStatement *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYSuperCall :
- CYExpression
+ CYTarget
{
CYArgument *arguments_;
}
CYPrecedence(2)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYTarget *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYSuperAccess :
- CYExpression
+ CYTarget
{
CYExpression *property_;
}
CYPrecedence(1)
- CYRightHand(false)
- virtual CYExpression *Replace(CYContext &context);
+ CYTarget *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYExpress :
- CYStatement
+ CYForInitializer
{
CYExpression *expression_;
CYCompact(None)
- virtual CYStatement *Replace(CYContext &context);
+ CYForInitializer *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
virtual CYStatement *Return();
CYCompact(Short)
- virtual CYStatement *Replace(CYContext &context);
+ CYStatement *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYCompact(Short)
- virtual CYStatement *Replace(CYContext &context);
+ CYStatement *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYCompact(None)
- virtual CYStatement *Replace(CYContext &context);
+ CYStatement *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYPrecedence(0)
- virtual CYExpression *Replace(CYContext &context);
+ CYExpression *Replace(CYContext &context) override;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
};
struct CYEmpty :
- CYStatement
+ CYForInitializer
{
CYCompact(Short)
- virtual CYStatement *Replace(CYContext &context);
+ virtual CYForInitializer *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
struct CYTypeSpecifier :
CYThing
{
- virtual CYExpression *Replace(CYContext &context) = 0;
+ virtual CYTarget *Replace(CYContext &context) = 0;
};
struct CYTypeError :
CYTypeError() {
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
CYTypeVoid() {
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
{
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
};
virtual int Precedence() const = 0;
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type) = 0;
- CYExpression *Replace(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
+ CYTarget *Replace(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const = 0;
void Output(CYOutput &out, int precedence, CYIdentifier *identifier) const;
CYPrecedence(1)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
};
CYPrecedence(0)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
};
CYPrecedence(0)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
};
CYPrecedence(0)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
};
return this;
}
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
CYTypeFunctionWith *Function();
};
struct CYEncodedType :
- CYExpression
+ CYTarget
{
CYTypedIdentifier *typed_;
CYPrecedence(1)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
};
struct CYLambda :
- CYExpression
+ CYTarget
{
CYTypedIdentifier *typed_;
CYTypedParameter *parameters_;
CYPrecedence(1)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
};
CYPrecedence(0)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
};
CYPrecedence(1)
- virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
virtual CYTypeFunctionWith *Function() { return this; }
};
struct CYIndirect :
- CYPrefix
+ CYTarget
{
+ CYExpression *rhs_;
+
CYIndirect(CYExpression *rhs) :
- CYPrefix(rhs)
+ rhs_(rhs)
{
}
- virtual const char *Operator() const {
- return "*";
- }
-
- CYAlphabetic(false)
+ // XXX: this should be checked
+ CYPrecedence(2)
- virtual CYExpression *Replace(CYContext &context);
+ virtual CYTarget *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
};
#define CYReplace \
struct CY ## name ## Assign : \
CYAssignment \
{ args \
- CY ## name ## Assign(CYExpression *lhs, CYExpression *rhs) : \
+ CY ## name ## Assign(CYTarget *lhs, CYExpression *rhs) : \
CYAssignment(lhs, rhs) \
{ \
} \