protected void ProcessPageFieldNode(ALSymbolInformation symbol, PageFieldSyntax syntax) { if (syntax.Expression != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.Expression.ToString()); } }
public override SyntaxNode VisitPageField(PageFieldSyntax node) { if (this.HasToolTip(node)) { return(base.VisitPageField(node)); } this.NoOfChanges++; //try to find source field caption string caption = null; if (node.Expression != null) { string source = ALSyntaxHelper.DecodeName(node.Expression.ToString()); if (!String.IsNullOrWhiteSpace(source)) { if (this.CurrentTable != null) { TableFieldTypeInformation tableField = this.CurrentTable.GetField(source); if ((tableField != null) && (!String.IsNullOrWhiteSpace(tableField.Caption))) { caption = tableField.Caption; } } if (String.IsNullOrWhiteSpace(caption)) { caption = source.Replace("\"", ""); } } } return(node.AddPropertyListProperties(this.CreateToolTipProperty(node, caption))); }
protected void ProcessPageExtensionObjectNode(ALSymbolInformation symbol, PageExtensionSyntax syntax) { if (syntax.BaseObject != null) { symbol.extends = ALSyntaxHelper.DecodeName(syntax.BaseObject.ToString()); } }
protected void ProcessQueryColumnNode(ALSymbolInformation symbol, QueryColumnSyntax syntax) { if (syntax.RelatedField != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.RelatedField.ToString()); } }
protected void ProcessXmlPortTableElementNode(SyntaxTree syntaxTree, ALSymbolInformation symbol, XmlPortTableElementSyntax syntax) { symbol.fullName = symbol.kind.ToName() + " " + ALSyntaxHelper.EncodeName(symbol.name) + ": Record " + syntax.SourceTable.ToFullString(); symbol.source = ALSyntaxHelper.DecodeName(syntax.SourceTable.ToFullString()); this.ProcessNodeContentRange(syntaxTree, symbol, syntax, syntax.OpenBraceToken, syntax.CloseBraceToken); }
protected void ProcessReportColumnNode(ALSymbolInformation symbol, ReportColumnSyntax syntax) { symbol.fullName = ALSyntaxHelper.EncodeName(symbol.name) + ": " + syntax.SourceExpression.ToFullString(); if (syntax.SourceExpression != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.SourceExpression.ToString()); } }
protected void ProcessQueryDataItemNode(SyntaxTree syntaxTree, ALSymbolInformation symbol, QueryDataItemSyntax syntax) { if (syntax.DataItemTable != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.DataItemTable.ToString()); } this.ProcessNodeContentRange(syntaxTree, symbol, syntax, syntax.OpenBraceToken, syntax.CloseBraceToken); }
protected void ProcessQueryDataItemNode(dynamic syntaxTree, ALSymbolInformation symbol, dynamic syntax) { if (syntax.DataItemTable != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.DataItemTable.ToString()); } this.ProcessNodeContentRange(syntaxTree, symbol, syntax); }
protected void ProcessReportDataItemNode(SyntaxTree syntaxTree, ALSymbolInformation symbol, ReportDataItemSyntax syntax) { symbol.fullName = ALSyntaxHelper.EncodeName(symbol.name) + ": Record " + syntax.DataItemTable.ToFullString(); if (syntax.DataItemTable != null) { symbol.source = ALSyntaxHelper.DecodeName(syntax.DataItemTable.ToString()); } this.ProcessNodeContentRange(syntaxTree, symbol, syntax, syntax.OpenBraceToken, syntax.CloseBraceToken); }
public static string GetNameStringValue(this SyntaxNode node) { string name = node.GetSyntaxNodeName(); if (!String.IsNullOrWhiteSpace(name)) { name = ALSyntaxHelper.DecodeName(name); } return(name); }
private void CheckSourceTableProperty(SyntaxNode node) { //try to find current table this.CurrentTable = null; PropertyValueSyntax sourceTablePropertyValue = node.GetPropertyValue("SourceTable"); if (sourceTablePropertyValue != null) { string sourceTable = ALSyntaxHelper.DecodeName(sourceTablePropertyValue.ToString()); this.CurrentTable = this.TypeInformationCollector.ProjectTypesInformation.GetTable(sourceTable); } }
protected void ProcessSyntaxNodeProperty(SyntaxTree syntaxTree, ALSymbolInformation parent, string name, string value) { if ((name != null) && (value != null)) { name = name.ToLower(); switch (parent.kind) { case ALSymbolKind.PageObject: if (name == "sourcetable") { parent.source = ALSyntaxHelper.DecodeName(value); } break; case ALSymbolKind.Field: if ((name == "enabled") && (value != null) && ( (value.Equals("false", StringComparison.CurrentCultureIgnoreCase)) || (value == "0"))) { if ((parent.subtype != null) && (parent.subtype.StartsWith("Obsolete"))) { int obsoletePos = parent.fullName.LastIndexOf("(Obsolete"); if (obsoletePos > 0) { parent.fullName = parent.fullName.Substring(0, obsoletePos - 1); } } parent.subtype = "Disabled"; parent.fullName = parent.fullName + " (Disabled)"; } else if ((name == "obsoletestate") && (value != null)) { if (String.IsNullOrEmpty(parent.subtype)) { if (value.Equals("Pending", StringComparison.CurrentCultureIgnoreCase)) { parent.subtype = "ObsoletePending"; parent.fullName = parent.fullName + " (Obsolete-Pending)"; } else if (value.Equals("Removed", StringComparison.CurrentCultureIgnoreCase)) { parent.subtype = "ObsoleteRemoved"; parent.fullName = parent.fullName + " (Obsolete-Removed)"; } } } break; } } }
protected ALSymbolInformation CreateSymbolInfo(SyntaxTree syntaxTree, SyntaxNode node) { //Detect symbol type ALSymbolKind alSymbolKind = SyntaxKindToALSymbolKind(node); if (alSymbolKind == ALSymbolKind.Undefined) { return(null); } //create symbol info Type nodeType = node.GetType(); ALSymbolInformation symbolInfo = new ALSymbolInformation(); symbolInfo.name = ALSyntaxHelper.DecodeName(nodeType.TryGetPropertyValueAsString(node, "Name")); symbolInfo.kind = alSymbolKind; if (node.ContainsDiagnostics) { symbolInfo.containsDiagnostics = true; } var lineSpan = syntaxTree.GetLineSpan(node.FullSpan); symbolInfo.range = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character); lineSpan = syntaxTree.GetLineSpan(node.Span); symbolInfo.selectionRange = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character); //additional information ProcessNode(syntaxTree, symbolInfo, node); //process child nodes IEnumerable <SyntaxNode> list = node.ChildNodes(); if (list != null) { foreach (SyntaxNode childNode in list) { ProcessChildSyntaxNode(syntaxTree, symbolInfo, childNode); } } return(symbolInfo); }
protected ALSymbolInformation CreateSymbolInfo(dynamic syntaxTree, dynamic node) { //Detect symbol type ALSymbolKind alSymbolKind = SyntaxKindToALSymbolKind(node); if (alSymbolKind == ALSymbolKind.Undefined) { return(null); } //create symbol info ALSymbolInformation symbolInfo = new ALSymbolInformation(); if ((node.GetType().GetProperty("Name") != null) && (node.Name != null)) { symbolInfo.name = ALSyntaxHelper.DecodeName(node.Name.ToString()); } symbolInfo.kind = alSymbolKind; dynamic lineSpan = syntaxTree.GetLineSpan(node.FullSpan); symbolInfo.range = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character); lineSpan = syntaxTree.GetLineSpan(node.Span); symbolInfo.selectionRange = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character); //additional information ProcessNode(syntaxTree, symbolInfo, node); //process child nodes IEnumerable <dynamic> list = node.ChildNodes(); if (list != null) { foreach (dynamic childNode in list) { ProcessChildSyntaxNode(syntaxTree, symbolInfo, childNode); } } return(symbolInfo); }
protected ALFullSyntaxTreeNode CreateALNode(SyntaxTree syntaxTree, SyntaxNode node) { //base syntax node properties ALFullSyntaxTreeNode alNode = new ALFullSyntaxTreeNode(); alNode.kind = node.Kind.ToString(); FileLinePositionSpan lineSpan = syntaxTree.GetLineSpan(node.FullSpan); alNode.fullSpan = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character); lineSpan = syntaxTree.GetLineSpan(node.Span); alNode.span = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character); //additional properties Type nodeType = node.GetType(); alNode.name = ALSyntaxHelper.DecodeName(nodeType.TryGetPropertyValueAsString(node, "Name")); if (node.ContainsDiagnostics) { alNode.containsDiagnostics = true; } IEnumerable attributes = nodeType.TryGetPropertyValue <IEnumerable>(node, "Attributes"); if (attributes != null) { foreach (SyntaxNode childNode in attributes) { alNode.AddAttribute(CreateALNode(syntaxTree, childNode)); } } SyntaxToken specialToken = nodeType.TryGetPropertyValue <SyntaxToken>(node, "OpenBraceToken"); if ((specialToken != null) && (specialToken.Kind != SyntaxKind.None)) { alNode.openBraceToken = CreateALNode(syntaxTree, specialToken); } specialToken = nodeType.TryGetPropertyValue <SyntaxToken>(node, "CloseBraceToken"); if ((specialToken != null) && (specialToken.Kind != SyntaxKind.None)) { alNode.closeBraceToken = CreateALNode(syntaxTree, specialToken); } specialToken = nodeType.TryGetPropertyValue <SyntaxToken>(node, "VarKeyword"); if ((specialToken != null) && (specialToken.Kind != SyntaxKind.None)) { alNode.varKeyword = CreateALNode(syntaxTree, specialToken); } alNode.accessModifier = nodeType.TryGetPropertyValueAsString(node, "AccessModifier"); alNode.identifier = nodeType.TryGetPropertyValueAsString(node, "Identifier"); alNode.dataType = nodeType.TryGetPropertyValueAsString(node, "DataType"); alNode.temporary = nodeType.TryGetPropertyValueAsString(node, "Temporary"); return(alNode); }