YCode Class Reference

YCode for precompiled ycp code. More...

#include <YCode.h>

Inheritance diagram for YCode:
Rep YBlock YConst YEBinary YEBracket YEBuiltin YECall YECompare YEIs YEList YELocale YEMap YEPropagate YEReference YEReturn YETerm YETriple YEUnary YEVariable YFunction YLocale YStatement

List of all members.

Public Types

enum  ykind {
  yxError = 0, ycVoid, ycBoolean, ycInteger,
  ycFloat, ycString, ycByteblock, ycPath,
  ycSymbol, ycList, ycMap, ycTerm,
  ycEntry, ycConstant, ycLocale, ycFunction,
  yePropagate, yeUnary, yeBinary, yeTriple,
  yeCompare, yeLocale, yeList, yeMap,
  yeTerm, yeIs, yeBracket, yeBlock,
  yeReturn, yeVariable, yeBuiltin, yeFunction,
  yeReference, yeFunctionPointer, yeExpression, ysTypedef,
  ysVariable, ysFunction, ysAssign, ysBracket,
  ysIf, ysWhile, ysDo, ysRepeat,
  ysExpression, ysReturn, ysBreak, ysContinue,
  ysTextdomain, ysInclude, ysFilename, ysImport,
  ysBlock, ysSwitch, ysStatement
}

Public Member Functions

 YCode ()
virtual ~YCode ()
virtual ykind kind () const =0
virtual string toString () const
virtual std::ostream & toStream (std::ostream &str) const =0
virtual std::ostream & toXml (std::ostream &str, int indent) const =0
virtual bool isConstant () const
bool isError () const
virtual bool isStatement () const
virtual bool isBlock () const
virtual bool isReferenceable () const
virtual YCPValue evaluate (bool cse=false)
virtual constTypePtr type () const

Static Public Member Functions

static string toString (ykind kind)

Private Member Functions

 REP_BODY (YCode)

Detailed Description

YCode for precompiled ycp code.

A class representing parsed YCP code. This is an abstract base class for implementing any YCP language feature. kind uniquely identifies the type of the class. The class provides infrastructure for dumping a bytecode representation (toStream), XML representation (toXML) and ASCII representation (toString).

The represented YCP code is executed via invoking evaluate.


Member Enumeration Documentation

Enumerator:
yxError 
ycVoid 
ycBoolean 
ycInteger 
ycFloat 
ycString 
ycByteblock 
ycPath 
ycSymbol 
ycList 
ycMap 
ycTerm 
ycEntry 
ycConstant 
ycLocale 
ycFunction 
yePropagate 
yeUnary 
yeBinary 
yeTriple 
yeCompare 
yeLocale 
yeList 
yeMap 
yeTerm 
yeIs 
yeBracket 
yeBlock 
yeReturn 
yeVariable 
yeBuiltin 
yeFunction 
yeReference 
yeFunctionPointer 
yeExpression 
ysTypedef 
ysVariable 
ysFunction 
ysAssign 
ysBracket 
ysIf 
ysWhile 
ysDo 
ysRepeat 
ysExpression 
ysReturn 
ysBreak 
ysContinue 
ysTextdomain 
ysInclude 
ysFilename 
ysImport 
ysBlock 
ysSwitch 
ysStatement 

Constructor & Destructor Documentation

YCode::YCode (  ) 

Creates a new YCode element

YCode::~YCode (  )  [virtual]

Destructor


Member Function Documentation

YCPValue YCode::evaluate ( bool  cse = false  )  [virtual]

Execute YCP code to get the resulting YCPValue. Every inherited class of YCode should reimplement this method.

Returns:
YCPValue after executing the code
Parameters:
cse should the evaluation be done for parse time evaluation (i.e. constant subexpression elimination)

Reimplemented in YBlock, YConst, YLocale, YFunction, YEVariable, YEReference, YETerm, YECompare, YELocale, YEList, YEMap, YEPropagate, YEUnary, YEBinary, YETriple, YEIs, YEReturn, YEBracket, YEBuiltin, YEFunction, YEFunctionPointer, YStatement, YSBreak, YSContinue, YSExpression, YSBlock, YSReturn, YSTypedef, YSFunction, YSAssign, YSBracket, YSIf, YSWhile, YSRepeat, YSDo, YSTextdomain, YSInclude, YSImport, YSFilename, and YSSwitch.

References isError(), toString(), y2debug, and y2error.

bool YCode::isBlock (  )  const [virtual]

Is this a YCP block?

Returns:
true if the YCode represents a block

Reimplemented in YBlock.

Referenced by YECall::finalize().

bool YCode::isConstant (  )  const [virtual]

Is this code constant?

Returns:
true if the YCode represents a constant

Reimplemented in YConst.

bool YCode::isError (  )  const

Is this code a representation of an error?

Returns:
true if the YCode represents an error

Referenced by evaluate().

bool YCode::isReferenceable (  )  const [virtual]

Can this code be stored in a variable of a type reference?

Returns:
true if the YCode represents something we can reference to

Reimplemented in YEVariable.

bool YCode::isStatement (  )  const [virtual]

Is this a YCP statement (e.g. if, while, ...)

Returns:
true if the YCode represents a statement

Reimplemented in YBlock, and YStatement.

virtual ykind YCode::kind (  )  const [pure virtual]
YCode::REP_BODY ( YCode   )  [private]
std::ostream & YCode::toStream ( std::ostream &  str  )  const [pure virtual]

Write YCP code to a byte stream (bytecode implementation). Every class inheriting from YCode must reimplement this method.

Parameters:
str byte stream to store into
Returns:
byte stream for chaining writing bytecode (str)

Implemented in YBlock, YConst, YLocale, YFunction, YEVariable, YEReference, YETerm, YECompare, YELocale, YEList, YEMap, YEPropagate, YEUnary, YEBinary, YETriple, YEIs, YEReturn, YEBracket, YEBuiltin, YECall, YStatement, YSBreak, YSContinue, YSExpression, YSBlock, YSReturn, YSTypedef, YSFunction, YSAssign, YSBracket, YSIf, YSWhile, YSRepeat, YSDo, YSTextdomain, YSInclude, YSImport, YSFilename, and YSSwitch.

References kind(), toString(), and y2debug.

string YCode::toString ( ykind  kind  )  [static]

String representation of the YCode kind value. For debugging purposes.

Parameters:
kind which kind representation should be returned
Returns:
string representation

References names, and y2error.

string YCode::toString ( void   )  const [virtual]
std::ostream & YCode::toXml ( std::ostream &  str,
int  indent 
) const [pure virtual]

Write YCP code as XML representation. Every class inheriting from YCode must reimplement this method.

Parameters:
str string stream to store into
indend indentation level for pretty print
Returns:
string stream for chaining writing XML (str)

Implemented in YBlock, YConst, YLocale, YFunction, YEVariable, YEReference, YETerm, YECompare, YELocale, YEList, YEMap, YEPropagate, YEUnary, YEBinary, YETriple, YEIs, YEReturn, YEBracket, YEBuiltin, YECall, YStatement, YSBreak, YSContinue, YSExpression, YSBlock, YSReturn, YSTypedef, YSFunction, YSAssign, YSBracket, YSIf, YSWhile, YSRepeat, YSDo, YSTextdomain, YSInclude, YSImport, YSFilename, and YSSwitch.

References kind(), toString(), and y2debug.

constTypePtr YCode::type (  )  const [virtual]

Return type of this YCP code (interesting mostly for function calls).

Returns:
type of the value to be returned after calling evaluate

Reimplemented in YBlock, YConst, YLocale, YFunction, YEVariable, YEReference, YETerm, YECompare, YELocale, YEList, YEMap, YEPropagate, YEUnary, YEBinary, YETriple, YEIs, YEReturn, YEBracket, YEBuiltin, YECall, YStatement, YSExpression, YSBlock, YSReturn, YSTypedef, YSFunction, YSBracket, YSIf, YSWhile, YSRepeat, YSDo, YSTextdomain, YSInclude, YSImport, YSFilename, and YSSwitch.

References Type::Unspec.


The documentation for this class was generated from the following files:

Generated on a sunny day for yast2-core by doxygen 1.6.3