public static bool IsGetTypeMethod(string methodName) { Validity.Assert(!string.IsNullOrEmpty(methodName)); return(methodName.Equals(DSDefinitions.Keyword.GetType)); }
public static bool IsPropertyTemp(string varname) { Validity.Assert(!string.IsNullOrEmpty(varname)); return(varname.StartsWith(DSASM.Constants.kTempPropertyVar)); }
public static bool IsGetterSetter(string propertyName) { Validity.Assert(null != propertyName); return(IsGetter(propertyName) || IsSetter(propertyName)); }
public static bool IsInternalFunction(string methodName) { Validity.Assert(!string.IsNullOrEmpty(methodName)); return(methodName.StartsWith(DSASM.Constants.kInternalNamePrefix) || methodName.StartsWith(DSDefinitions.Keyword.Dispose)); }
public static bool IsInternalMethod(string methodName) { Validity.Assert(null != methodName); return(methodName.StartsWith(Constants.kInternalNamePrefix)); }
public static bool StartsWithDoubleUnderscores(string name) { Validity.Assert(null != name); return(name.StartsWith(DSASM.Constants.kDoubleUnderscores)); }
public static bool IsSetter(string propertyName) { Validity.Assert(null != propertyName); return(propertyName.StartsWith(DSASM.Constants.kSetterPrefix)); }
public static bool IsAutoGeneratedVar(string name) { Validity.Assert(null != name); return(name.StartsWith("%")); }
private static void ParseUserCodeCore(Core core, string expression, out List <AssociativeNode> astNodes, out List <AssociativeNode> commentNodes) { astNodes = new List <AssociativeNode>(); core.ResetForPrecompilation(); core.IsParsingCodeBlockNode = true; core.ParsingMode = ParseMode.AllowNonAssignment; ParseResult parseResult = ParserUtils.ParseWithCore(expression, core); commentNodes = ParserUtils.GetAstNodes(parseResult.CommentBlockNode); var nodes = ParserUtils.GetAstNodes(parseResult.CodeBlockNode); Validity.Assert(nodes != null); int index = 0; int typedIdentIndex = 0; foreach (var node in nodes) { var n = node as AssociativeNode; Validity.Assert(n != null); // Append the temporaries only if it is not a function def or class decl bool isFunctionOrClassDef = n is FunctionDefinitionNode || n is ClassDeclNode; // Handle non Binary expression nodes separately if (n is ModifierStackNode) { core.BuildStatus.LogSemanticError(Resources.ModifierBlockNotSupported); } else if (n is ImportNode) { core.BuildStatus.LogSemanticError(Resources.ImportStatementNotSupported); } else if (isFunctionOrClassDef) { // Add node as it is astNodes.Add(node); } else { // Handle temporary naming for temporary Binary exp. nodes and non-assignment nodes var ben = node as BinaryExpressionNode; if (ben != null && ben.Optr == Operator.assign) { var mNode = ben.RightNode as ModifierStackNode; if (mNode != null) { core.BuildStatus.LogSemanticError(Resources.ModifierBlockNotSupported); } var lNode = ben.LeftNode as IdentifierNode; if (lNode != null && lNode.Value == Constants.kTempProcLeftVar) { string name = Constants.kTempVarForNonAssignment + index; var newNode = new BinaryExpressionNode(new IdentifierNode(name), ben.RightNode); astNodes.Add(newNode); index++; } else { // Add node as it is astNodes.Add(node); index++; } } else { if (node is TypedIdentifierNode) { // e.g. a : int = %tTypedIdent_<Index>; var ident = new IdentifierNode(Constants.kTempVarForTypedIdentifier + typedIdentIndex); NodeUtils.CopyNodeLocation(ident, node); var typedNode = new BinaryExpressionNode(node as TypedIdentifierNode, ident, Operator.assign); NodeUtils.CopyNodeLocation(typedNode, node); astNodes.Add(typedNode); typedIdentIndex++; } else { string name = Constants.kTempVarForNonAssignment + index; var newNode = new BinaryExpressionNode(new IdentifierNode(name), n); astNodes.Add(newNode); index++; } } } } }