public static long GetValueOf(PExpression exp) { if (exp.GetType() == typeof(AIntegerConstantExpression)) { long temp = 0; AIntegerConstantExpression expCast = (AIntegerConstantExpression)exp; if (long.TryParse(expCast.GetIntegerLiteral().Text, out temp)) { if (expCast.GetSign() != null) { temp = -temp; } return(temp); } else { // error? return(0); } } else { //error or composite? return(0); } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { base.GetPropertyHeight(property, label); pExpression = property.GetValue <PExpression>(); textProperty = property.FindPropertyRelative("Text"); int lineCount = textProperty.stringValue.Count(c => c == '\n' || c == '\r') + 1; height = Mathf.Max(lineCount * (lineHeight - 3f) + 4f, lineHeight); return(height); }
public override void CaseAVariableDefinition(AVariableDefinition node) { // create the variable in the data segment DataSegmentElement elm = new DataSegmentElement(node.GetName().Text, TypeEnvironment.GetVxcTypeOf(node.GetTypeSpecifier().GetType())); mOutputFile.mDataSegment.Add(elm); // create initializer expression in code segment. PExpression pexp = node.GetInit(); if (pexp != null) { long value = TypeEnvironment.GetValueOf(pexp); VariableInitializerExpression exp = new VariableInitializerExpression(value, elm.Type, elm.Identifier); mOutputFile.AddTemplate("init", exp); } base.CaseAVariableDefinition(node); }
internal override void RemoveChild(Node child) { if ( _keyword_declfirst_ == child ) { _keyword_declfirst_ = null; return; } if ( _identifier_ == child ) { _identifier_ = null; return; } if ( _operator_assign_ == child ) { _operator_assign_ = null; return; } if ( _expression_ == child ) { _expression_ = null; return; } }
public void SetExpression(PExpression node) { if(_expression_ != null) { _expression_.Parent(null); } if(node != null) { if(node.Parent() != null) { node.Parent().RemoveChild(node); } node.Parent(this); } _expression_ = node; }
public ADeclarefirstnormal( TKeywordDeclfirst _keyword_declfirst_, TIdentifier _identifier_, TOperatorAssign _operator_assign_, PExpression _expression_ ) { SetKeywordDeclfirst (_keyword_declfirst_); SetIdentifier (_identifier_); SetOperatorAssign (_operator_assign_); SetExpression (_expression_); }
public ADeclareassign( TKeywordDecl _keyword_decl_, PSimple _simple_, TIdentifier _identifier_, TOperatorAssign _operator_assign_, PExpression _expression_ ) { SetKeywordDecl (_keyword_decl_); SetSimple (_simple_); SetIdentifier (_identifier_); SetOperatorAssign (_operator_assign_); SetExpression (_expression_); }
internal override void RemoveChild(Node child) { if ( _operator_opening_parenthesis_ == child ) { _operator_opening_parenthesis_ = null; return; } if ( _expression_ == child ) { _expression_ = null; return; } if ( _newline_ == child ) { _newline_ = null; return; } if ( _operator_closing_parenthesis_ == child ) { _operator_closing_parenthesis_ = null; return; } }
public ABTabblockinside( PTabblockinside _tabblockinside_, TNewline _newline_, PExpression _expression_ ) { SetTabblockinside (_tabblockinside_); SetNewline (_newline_); SetExpression (_expression_); }
internal override void RemoveChild(Node child) { if ( _argumentlist_ == child ) { _argumentlist_ = null; return; } if ( _operator_comma_ == child ) { _operator_comma_ = null; return; } if ( _expression_ == child ) { _expression_ = null; return; } }
public ABArgumentlist( PArgumentlist _argumentlist_, TOperatorComma _operator_comma_, PExpression _expression_ ) { SetArgumentlist (_argumentlist_); SetOperatorComma (_operator_comma_); SetExpression (_expression_); }
internal override void RemoveChild(Node child) { if ( _expression_ == child ) { _expression_ = null; return; } }
public AATabblockinside( PExpression _expression_ ) { SetExpression (_expression_); }
public AAArgumentlist( PExpression _expression_ ) { SetExpression (_expression_); }
internal override void RemoveChild(Node child) { if ( _tabblockinside_ == child ) { _tabblockinside_ = null; return; } if ( _newline_ == child ) { _newline_ = null; return; } if ( _expression_ == child ) { _expression_ = null; return; } }
protected virtual INode_Expression parseExpression(PExpression node) { if( node is ADeclareemptyExpression ) return parseDeclareEmpty( (ADeclareempty)(node as ADeclareemptyExpression).GetDeclareempty() ); if( node is ARaiseExpression ) return parseRaise( (ARaise)(node as ARaiseExpression).GetRaise() ); if( node is AAssignExpression ) return parseAssign( (AAssign)(node as AAssignExpression).GetAssign() ); if( node is ACallExpression ) return parseCall( (ACall)(node as ACallExpression).GetCall() ); if( node is ACompoundExpression ) return parseCompound( (ACompound)(node as ACompoundExpression).GetCompound() ); if( node is AConditionalExpression ) return parseConditional( (AConditional)(node as AConditionalExpression).GetConditional() ); if( node is ACurryExpression ) return parseCurry( (ACurry)(node as ACurryExpression).GetCurry() ); if( node is ADeclareassignExpression ) return parseDeclareAssign( (ADeclareassign)(node as ADeclareassignExpression).GetDeclareassign() ); if( node is AIdentifierExpression ) return parseIdentifier( (node as AIdentifierExpression).GetIdentifier() ); if( node is ASelectExpression ) return parseSelect( (ASelect)(node as ASelectExpression).GetSelect() ); if( node is ASetpropertyExpression ) return parseSetProperty( (ASetproperty)(node as ASetpropertyExpression).GetSetproperty() ); if( node is ATrycatchExpression ) return parseTryCatch( (ATrycatch)(node as ATrycatchExpression).GetTrycatch() ); if( node is ATypeselectExpression ) return parseTypeSelect( (ATypeselect)(node as ATypeselectExpression).GetTypeselect() ); if( node is AAndExpression ) return parseAnd( (AAnd)(node as AAndExpression).GetAnd() ); if( node is ANandExpression ) return parseNand( (ANand)(node as ANandExpression).GetNand() ); if( node is AOrExpression ) return parseOr( (AOr)(node as AOrExpression).GetOr() ); if( node is ANorExpression ) return parseNor( (ANor)(node as ANorExpression).GetNor() ); if( node is AXorExpression ) return parseXor( (AXor)(node as AXorExpression).GetXor() ); if( node is AXnorExpression ) return parseXnor( (AXnor)(node as AXnorExpression).GetXnor() ); if( node is ABreedExpression ) return parseBreed( (ABreed)(node as ABreedExpression).GetBreed() ); if( node is ACallerExpression ) return parseCaller( (ACaller)(node as ACallerExpression).GetCaller() ); if( node is AObjectExpression ) return parseObject( (AObject)(node as AObjectExpression).GetObject() ); if( node is ADictionaryExpression ) return parseDictionary( (ADictionary)(node as ADictionaryExpression).GetDictionary() ); if( node is AEnumExpression ) return parseEnum( (AEnum)(node as AEnumExpression).GetEnum() ); if( node is AExtractmemberExpression ) return parseExtractMember( (AExtractmember)(node as AExtractmemberExpression).GetExtractmember() ); if( node is AFunctionExpression ) return parseFunction( (AFunction)(node as AFunctionExpression).GetFunction() ); if( node is AFunctioninterfaceExpression ) return parseFunctionInterface( (AFunctioninterface)(node as AFunctioninterfaceExpression).GetFunctioninterface() ); if( node is AGeneratorExpression ) return parseGenerator( (AGenerator)(node as AGeneratorExpression).GetGenerator() ); if( node is AGenericfunctionExpression ) return parseGenericFunction( (AGenericfunction)(node as AGenericfunctionExpression).GetGenericfunction() ); if( node is AGenericinterfaceExpression ) return parseGenericInterface( (AGenericinterface)(node as AGenericinterfaceExpression).GetGenericinterface() ); if( node is AInstantiategenericExpression ) return parseInstantiateGeneric( (AInstantiategeneric)(node as AInstantiategenericExpression).GetInstantiategeneric() ); if( node is AIntegerExpression ) return parseInteger( (node as AIntegerExpression).GetInteger() ); if( node is AInterfaceExpression ) return parseInterface( (AInterface)(node as AInterfaceExpression).GetInterface() ); if( node is ARationalExpression ) return parseRational( (node as ARationalExpression).GetRational() ); if( node is AStringExpression ) return parseString( (node as AStringExpression).GetString() ); else throw new Exception("unknown node type: " + node); }
public AParenthetical( TOperatorOpeningParenthesis _operator_opening_parenthesis_, PExpression _expression_, TNewline _newline_, TOperatorClosingParenthesis _operator_closing_parenthesis_ ) { SetOperatorOpeningParenthesis (_operator_opening_parenthesis_); SetExpression (_expression_); SetNewline (_newline_); SetOperatorClosingParenthesis (_operator_closing_parenthesis_); }