/// <summary>
 /// Creates an inspection result.
 /// </summary>
 protected InspectionResultBase(IInspection inspection, QualifiedModuleName qualifiedName, ParserRuleContext context, CommentNode comment = null)
 {
     _inspection    = inspection;
     _qualifiedName = qualifiedName;
     _context       = context;
     _comment       = comment;
 }
        string WriteCommentNode(CommentBlock block, CommentNode node, bool writeCode)
        {
            switch (node.Type)
            {
            case CommentNodeType.Text:
                return(WriteText(block.Text[node.ValueIndex]));

            case CommentNodeType.CRef:
                return(WriteCRef(block.Text[node.ValueIndex]));

            case CommentNodeType.ParamRef:
                return(WriteParamRef(block.Text[node.ValueIndex]));

            case CommentNodeType.TypeParamRef:
                return(WriteTypeParamRef(block.Text[node.ValueIndex]));

            case CommentNodeType.Paragraph:
                return(WriteParagraph(block.Blocks[node.ValueIndex], writeCode));

            case CommentNodeType.CodeBlock:
                return(WriteCodeBlock(block.Blocks[node.ValueIndex]));

            case CommentNodeType.CodeInline:
                return(WriteCodeInline(block.Blocks[node.ValueIndex]));

            case CommentNodeType.List:
                return(WriteList(block.Lists[node.ValueIndex]));

            default:
                return("");
            }
        }
        /// <summary>
        /// Connects the end.
        /// When connecting the end, it also updates information in the experiment model data.
        /// </summary>
        /// <param name='end'>
        /// End.
        /// </param>
        public override void ConnectEnd(MonoHotDraw.Connectors.IConnector end)
        {
            base.ConnectEnd(end);

            if (end != null)
            {
                IComponentControl startComponentControl = StartConnector.Owner as IComponentControl;
                IComponentControl endComponentControl   = end.Owner as IComponentControl;
                if (endComponentControl != null && startComponentControl != null)
                {
                    //get access to owner experiment
                    IEditableExperiment ownerExperiment = endComponentControl.ExperimentNode.Owner as IEditableExperiment;
                    if (ownerExperiment != null)
                    {
                        ExperimentNodeConnection nodeConnection = ownerExperiment.AddConnection(startComponentControl.ExperimentNode, endComponentControl.ExperimentNode);
                        OnConnectionCompleted(nodeConnection);
                        m_experimentNodeConnection = nodeConnection;

                        // SPRINT 2: TLAB-129
                        CommentNode comment = nodeConnection.Source as CommentNode;
                        if (comment != null)
                        {
                            isSourceComment = true;
                        }
                        // END SPRINT 2: TLAB-129
                    }
                }
            }
        }
        public object VisitCommentNode(CommentNode node, Context parameter)
        {
            var comment = node.Comment;

            parameter.AppendRawSql(comment);
            parameter.AppendFormattedSql(comment);
            return(null);
        }
Exemple #5
0
 /// <summary>
 /// Creates an inspection result.
 /// </summary>
 protected CodeInspectionResultBase(string inspection, CodeInspectionSeverity type, QualifiedModuleName qualifiedName, ParserRuleContext context, CommentNode comment = null)
 {
     _name          = inspection;
     _type          = type;
     _qualifiedName = qualifiedName;
     _context       = context;
     _comment       = comment;
 }
        private IEnumerable <ToDoItem> GetToDoMarkers(CommentNode comment)
        {
            var markers = _configService.LoadConfiguration().UserSettings.ToDoListSettings.ToDoMarkers;

            return(markers.Where(marker => !string.IsNullOrEmpty(marker.Text) &&
                                 comment.CommentText.ToLowerInvariant().Contains(marker.Text.ToLowerInvariant()))
                   .Select(marker => new ToDoItem(marker.Text, comment)));
        }
Exemple #7
0
 public static List<CommentNode> parseComment( string comment )
 {
     List<CommentNode> result = new List<CommentNode>();
     System.IO.StringReader rs = new System.IO.StringReader( comment );
     CommentNode current = new CommentNode( CommentType.SUMMARY, "" );
     result.Add( current );
     while( rs.Peek() >= 0 ) {
         string line = rs.ReadLine();
         line = Regex.Replace( line, "^[ \t]*\\*[ \t]*", "" ); // 行頭の * を取り除く
         line = Regex.Replace( line, "^[ \t]*", "" ); // 行頭のスペースを取り除く
         line = Regex.Replace( line, "-{4,}", "" ); // -の4回以上の繰り返しを取り除く
         if( Regex.Match( line, "^@param" ).Success ) {
             Match match;
             if( ( match = Regex.Match( line, "^@param[ \t]*([^ \t]+)[ \t]+(.+)" ) ) != Match.Empty ) {
                 string name  = match.Groups[1].Value;
                 string body = match.Groups[2].Value;
                 current = new CommentNode( CommentType.PARAM, name, body );
                 result.Add( current );
             } else {
                 string body = Regex.Replace( line, "^@param[ \t]*", "" ); // 先頭部分を削除
                 current = new CommentNode( CommentType.PARAM, body );
                 result.Add( current );
             }
         } else if( Regex.Match( line, "^@return" ).Success ) {
             string body = Regex.Replace( line, "^@return[ \t]*", "" );
             current = new CommentNode( CommentType.RETURN, body );
             result.Add( current );
         } else if( Regex.Match( line, "^@throw" ).Success ) {
             string body = Regex.Replace( line, "^@throw[ \t]*", "" );
             current = new CommentNode( CommentType.THROW, body );
             result.Add( current );
         } else if( Regex.Match( line, "^@author" ).Success ) {
             string body = Regex.Replace( line, "^@author[ \t]*", "" );
             current = new CommentNode( CommentType.AUTHOR, body );
             result.Add( current );
         } else if( Regex.Match( line, "^@version" ).Success ) {
             string body = Regex.Replace( line, "^@version[ \t]*", "" );
             current = new CommentNode( CommentType.VERSION, body );
             result.Add( current );
         } else if( Regex.Match( line, "^@see" ).Success ) {
             string body = Regex.Replace( line, "^@see[ \t]*", "" );
             current = new CommentNode( CommentType.SEE, body );
             result.Add( current );
         } else if( Regex.Match( line, "^@description" ).Success ) {
             string body = Regex.Replace( line, "^@description[ \t]*", "" );
             current = new CommentNode( CommentType.DESCRIPTION, body );
             result.Add( current );
         } else {
             // previous type
             if( current.Body.Length > 0 ) {
                 current.Body += "\\n" + line;
             } else {
                 current.Body = line;
             }
         }
     }
     return result;
 }
Exemple #8
0
        private IWebFormsNode CommentNodeBuilder(Match match)
        {
            var node = new CommentNode {
                Text = match.Groups["comment"].Value
            };

            attributesReader.ReadAttributes(match, node.Attributes);
            return(node);
        }
Exemple #9
0
 public EnumMember(string name, string value, CommentNode Comments)
 {
     this.Name = name;
     if (!string.IsNullOrEmpty(value))
     {
         this.Value = value;
     }
     this.Comments = Comments;
 }
 public CefExportFunction(CefType parent, Parser.FunctionNode fd, ApiTypeBuilder api, CefPlatform platform)
 {
     this.Name           = fd.Name;
     this.Comments       = fd.Comments;
     this.Signature      = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, fd.Signature, api);
     this.PrivateWrapper = GeneratorConfig.HasPrivateWrapper(this.Name);
     this.Parent         = parent;
     this.Platform       = platform;
 }
Exemple #11
0
 public CefEnumType(Parser.EnumNode enumNode)
     : base(enumNode.Name)
 {
     members = new EnumMember[enumNode.Members.Count];
     for (var i = 0; i <= enumNode.Members.Count - 1; i++)
     {
         members[i] = new EnumMember(enumNode.Members[i].Name, enumNode.Members[i].Value, enumNode.Members[i].Comments);
     }
     comments = enumNode.Comments;
 }
Exemple #12
0
 public ObsoleteCommentSyntaxInspectionResult(IInspection inspection, CommentNode comment)
     : base(inspection, comment)
 {
     _quickFixes = new CodeInspectionQuickFix[]
     {
         new ReplaceCommentMarkerQuickFix(Context, QualifiedSelection, comment),
         new RemoveCommentQuickFix(Context, QualifiedSelection, comment),
         new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName),
     };
 }
Exemple #13
0
    public override Node Create(Vector2 pos)
    {
        CommentNode node = CreateInstance <CommentNode>();

        node.rect       = new Rect(pos.x, pos.y, 300, 100);
        node.name       = "Comment";
        node.m_Width    = new FloatRemap(300, 0, 4000);
        node.m_Height   = new FloatRemap(100, 0, 500);
        node.m_FontSize = new FloatRemap(20, 0, 100);
        return(node);
    }
Exemple #14
0
        void DrawMessage(GraphRendererContext rendererContext, CommentNode node, GraphCamera camera)
        {
            var style = new GUIStyle(GUI.skin.GetStyle("Label"));

            style.alignment = TextAnchor.UpperLeft;

            var miniFontBaseSize = 20;

            style.normal.textColor = node.Selected ? GraphEditorConstants.TEXT_COLOR_SELECTED : GraphEditorConstants.TEXT_COLOR;
            if (camera.ZoomLevel >= 2)
            {
                float scaledFontSize = style.fontSize;
                if (scaledFontSize == 0)
                {
                    scaledFontSize = miniFontBaseSize;
                }
                scaledFontSize = Mathf.Max(1.0f, scaledFontSize / camera.ZoomLevel);

                style.fontSize = Mathf.RoundToInt(scaledFontSize);
                style.font     = CommentNodeRenderUtils.GetRenderFont();
            }

            GUI.backgroundColor = node.background;

            // Update the node bounds
            var padding  = new Vector2(10, 10);
            var textSize = style.CalcSize(new GUIContent(node.message));
            var nodeSize = textSize + padding * 2;

            Rect boxBounds;
            {
                var positionScreen = camera.WorldToScreen(node.Position);
                var sizeScreen     = nodeSize / camera.ZoomLevel;
                boxBounds = new Rect(positionScreen, sizeScreen);
            }

            Rect textBounds;

            {
                var positionScreen = camera.WorldToScreen(node.Position + padding);
                var sizeScreen     = textSize / camera.ZoomLevel;
                textBounds = new Rect(positionScreen, sizeScreen);
            }

            GUI.Box(boxBounds, "");
            style.normal.textColor = textColor;
            GUI.Label(textBounds, node.message, style);

            {
                var nodeBounds = node.Bounds;
                nodeBounds.size = nodeSize;
                node.Bounds     = nodeBounds;
            }
        }
Exemple #15
0
 protected CfxClass(CefStructType cefStruct, CommentNode comments)
 {
     CefStruct       = cefStruct;
     OriginalSymbol  = cefStruct.OriginalSymbol;
     CfxNativeSymbol = cefStruct.CfxNativeSymbol;
     CfxName         = cefStruct.CfxName;
     ClassName       = cefStruct.ClassName;
     ApiClassName    = ClassName.Substring(3);
     RemoteClassName = cefStruct.RemoteClassName;
     Comments        = comments;
 }
    public static void CreateGUIStyle()
    {
        CommentNode asset = ScriptableObject.CreateInstance <CommentNode>();

        AssetDatabase.CreateAsset(asset, "Assets/Blueprints/Node.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }
 public void AppendSummaryAndRemarks(CommentNode summary, bool forRemote = false, bool forEvent = false)
 {
     if (summary != null && !(summary.Lines.Length == 0))
     {
         AppendSummary(summary, forRemote, forEvent);
         AppendLine("/// <remarks>");
         AppendLine("/// See also the original CEF documentation in");
         AppendLine("/// <see href=\"https://bitbucket.org/chromiumfx/chromiumfx/src/tip/{0}\">{0}</see>.", summary.FileName.Replace("\\", "/"));
         AppendLine("/// </remarks>");
     }
 }
 public void AppendSummary(CommentNode summary, bool forRemote = false, bool forEvent = false)
 {
     if (summary != null && !(summary.Lines.Length == 0))
     {
         AppendLine("/// <summary>");
         foreach (var line in summary.Lines)
         {
             var l1 = CSharp.PrepareSummaryLine(line, forRemote, forEvent);
             AppendLine("/// " + l1);
         }
         AppendLine("/// </summary>");
     }
 }
        /// <summary>
        /// Creates an inspection result.
        /// </summary>
        protected CodeInspectionResultBase(string inspection, CodeInspectionSeverity type, QualifiedModuleName qualifiedName, ParserRuleContext context, CommentNode comment = null)
        {
            if (context == null && comment == null)
            {
                throw new ArgumentNullException("[context] and [comment] cannot both be null.");
            }

            _name          = inspection;
            _type          = type;
            _qualifiedName = qualifiedName;
            _context       = context;
            _comment       = comment;
        }
 internal void AddComment(string text)
 {
     if (this.closed)
     {
         throw new InvalidOperationException();
     }
     if (this.current == null)
     {
         throw new InvalidOperationException();
     }
     CommentNode node = new CommentNode(text, this.CurrentElement);
     this.VerifySize(node);
     this.CurrentElement.Add(node);
 }
Exemple #21
0
        protected bool ParseCommentBlock(CommentNode comments)
        {
            var lines = new List <string>();

            while (
                Scan(@"// (.*)", () => lines.Add(scanner.Group01)) ||
                Scan(@"//\n", () => lines.Add(string.Empty))
                )
            {
                ;
            }
            comments.SetParserLines(lines);
            comments.FileName = currentFile;
            return(lines.Count > 0);
        }
        internal void AddComment(string text)
        {
            if (this.closed)
            {
                throw new InvalidOperationException();
            }
            if (this.current == null)
            {
                throw new InvalidOperationException();
            }
            CommentNode node = new CommentNode(text, this.CurrentElement);

            this.VerifySize(node);
            this.CurrentElement.Add(node);
        }
Exemple #23
0
        protected bool ParseSummary(CommentNode comments)
        {
            Mark();
            var startFound = Skip(@"///");

            ParseCommentBlock(comments);
            var endFound = Skip(@"///");
            var success  = startFound || endFound;

            if (success)
            {
                SkipCommentBlock();
            }
            Unmark(success);
            return(success);
        }
        private void ContextCallback(object o)
        {
            UserActions a = (UserActions)o;

            switch (a)
            {
            case UserActions.AddDialogue:
                DialogueNode dialogueNode = CreateInstance <DialogueNode>();
                dialogueNode.windowRect  = new Rect(_mousePosition.x, _mousePosition.y, 200, 300);
                dialogueNode.windowTitle = "Dialogue";
                windows.Add(dialogueNode);
                break;

            case UserActions.AddActionNode:
                ActionNode actionNode = CreateInstance <ActionNode>();
                actionNode.windowRect      = new Rect(_mousePosition.x, _mousePosition.y, 200, 300);
                actionNode.windowTitle     = "Action";
                actionNode.dialogueActions =
                    (ActionNode.DialogueActions)EditorGUILayout.EnumPopup("Action:", actionNode.dialogueActions);
                windows.Add(actionNode);
                break;

            case UserActions.AddTransitionNode:
                break;

            case UserActions.CommentNode:
                CommentNode commentNode = CreateInstance <CommentNode>();
                commentNode.windowRect  = new Rect(_mousePosition.x, _mousePosition.y, 200, 100);
                commentNode.windowTitle = "Comment";
                windows.Add(commentNode);
                break;

            case UserActions.DeleteNode:
                if (_selectedNode != null)
                {
                    windows.Remove(_selectedNode);
                }
                break;

            default:
                break;
            }
        }
        internal void AddComment(string text)
        {
            if (this.closed)
            {
#pragma warning disable 618
                Fx.Assert("Cannot add data to a closed document");
#pragma warning restore 618
                throw new InvalidOperationException();
            }
            if (this.current == null)
            {
#pragma warning disable 618
                Fx.Assert("Operation is invalid on an empty document");
#pragma warning restore 618
                throw new InvalidOperationException();
            }
            CommentNode node = new CommentNode(text, this.CurrentElement);
            this.VerifySize(node);
            this.CurrentElement.Add(node);
        }
Exemple #26
0
        internal static IEnumerable <ASTNode> ParseUntilFailure(JinjaEnvironment environment, Lexer lexer, ILookaroundEnumerator <ParsingNode> enumerator)
        {
            do
            {
                ASTNode?astNode = default;
                switch (enumerator.Current.NodeType)
                {
                case ParsingNodeType.Statement:
                    StatementNode.TryParse(environment, lexer, enumerator, out astNode);
                    break;

                case ParsingNodeType.NewLine:
                    astNode = new NewLineNode(enumerator.Current);
                    break;

                case ParsingNodeType.Comment:
                    astNode = new CommentNode(enumerator.Current);
                    break;

                case ParsingNodeType.WhiteSpace:
                    astNode = WhiteSpaceNode.Parse(enumerator);
                    break;

                case ParsingNodeType.Expression:
                    if (ExpressionNode.TryParse(environment, enumerator, out astNode) == false)
                    {
                        throw new NotImplementedException();
                    }
                    break;

                case ParsingNodeType.Output:
                    astNode = new OutputNode(enumerator.Current);
                    break;
                }
                if (astNode == default)
                {
                    yield break;
                }
                yield return(astNode);
            } while (enumerator.MoveNext());
        }
Exemple #27
0
        public UICommentNode(Node n, UIGraph graph, double ox, double oy, double xs, double xy, double sc = 1)
        {
            InitializeComponent();
            Graph   = graph;
            Node    = n;
            xShift  = xs;
            yShift  = xy;
            originX = ox;
            originY = oy;
            scale   = sc;

            Id = n.Id;

            Margin = new Thickness(0);

            contained   = new List <IUIGraphNode>();
            OutputNodes = new List <UINodePoint>();
            InputNodes  = new List <UINodePoint>();

            commentNode = n as CommentNode;
        }
Exemple #28
0
    public StructMember(CefStructType parent, StructCategory structCategory, Parser.StructMemberNode smd, ApiTypeBuilder api)
    {
        Debug.Assert(structCategory == StructCategory.Values);
        Debug.Assert(smd.MemberType != null);

        Name      = smd.Name;
        Comments  = smd.Comments;
        cefConfig = smd.CefConfig;

        MemberType = api.GetApiType(smd.MemberType, false);
        if (MemberType.Name == "int" && Comments != null)
        {
            foreach (var c in Comments.Lines)
            {
                if (c.Contains("true") || c.Contains("false"))
                {
                    MemberType = BooleanInteger.Convert(MemberType);
                }
            }
        }
    }
        private IEnumerable <CommentNode> ParseComments(QualifiedModuleName qualifiedName)
        {
            var code           = qualifiedName.Component.CodeModule.Code();
            var commentBuilder = new StringBuilder();
            var continuing     = false;

            var startLine   = 0;
            var startColumn = 0;

            for (var i = 0; i < code.Length; i++)
            {
                var line  = code[i];
                var index = 0;

                if (continuing || line.HasComment(out index))
                {
                    startLine   = continuing ? startLine : i;
                    startColumn = continuing ? startColumn : index;

                    var commentLength = line.Length - index;

                    continuing = line.EndsWith("_");
                    if (!continuing)
                    {
                        commentBuilder.Append(line.Substring(index, commentLength).TrimStart());
                        var selection = new Selection(startLine + 1, startColumn + 1, i + 1, line.Length + 1);

                        var result = new CommentNode(commentBuilder.ToString(), new QualifiedSelection(qualifiedName, selection));
                        commentBuilder.Clear();

                        yield return(result);
                    }
                    else
                    {
                        // ignore line continuations in comment text:
                        commentBuilder.Append(line.Substring(index, commentLength).TrimStart());
                    }
                }
            }
        }
Exemple #30
0
 public Node Read(string xmlString)
 {
     Node node = null;
     if (xmlString.Contains("?xml"))
     {
         node = new XmlDeclarationNode {Name = "Declaration", Value = xmlString};
     }
     else if (xmlString.Contains("<!--"))
     {
         node = new CommentNode {Name = "Comment", Value = xmlString.Substring(4, xmlString.Length - 7)};
     }else if (xmlString.Contains("\\"))
     {
         node = new CommentNode {Name = "ScriptComment", Value = xmlString.Substring(2, xmlString.Length - 2)};
     }
     else if (xmlString.Contains("<Item>"))
     {
         node = new TextNode {Name = "Text", Value = xmlString.Substring(6, xmlString.Length - 13)};
     }else if (xmlString.ToLower().Contains("<script>"))
     {
         node = new TextNode {Name = "script", Value = xmlString.Substring(8, xmlString.Length - 17)};
     }
     return node;
 }
 public void VisitCommentNode(CommentNode comment)
 {
     // no op
 }
Exemple #32
0
 public ToDoItem(string markerText, CommentNode comment)
 {
     _description = comment.CommentText;
     _selection   = comment.QualifiedSelection;
     _type        = markerText;
 }
Exemple #33
0
    public CefCallbackFunction(CefStructType parent, StructCategory category, string name, CefConfigNode cefConfig, Parser.SignatureNode sd, ApiTypeBuilder api, CommentNode comments)
    {
        Name          = name;
        this.Parent   = parent;
        this.Comments = comments;
        if (cefConfig == null)
        {
            CefConfig = new CefConfigNode();
        }
        else
        {
            CefConfig = cefConfig;
        }

        if (category == StructCategory.Client)
        {
            m_callMode     = CfxCallMode.Callback;
            this.Signature = Signature.Create(SignatureType.ClientCallback, CefName, CefConfig, CallMode, sd, api);
        }
        else
        {
            m_callMode     = CfxCallMode.FunctionCall;
            this.Signature = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, sd, api);
        }
    }
 protected abstract void Visit(CommentNode commentNode);
Exemple #35
0
 protected override void Visit(CommentNode commentNode)
 {
 }
Exemple #36
0
        internal void AddComment(string text)
        {
            if (this.closed)
            {
#pragma warning disable 618
                Fx.Assert("Cannot add data to a closed document");
#pragma warning restore 618
                throw new InvalidOperationException();
            }
            if (this.current == null)
            {
#pragma warning disable 618
                Fx.Assert("Operation is invalid on an empty document");
#pragma warning restore 618
                throw new InvalidOperationException();
            }
            CommentNode node = new CommentNode(text, this.CurrentElement);
            this.VerifySize(node);
            this.CurrentElement.Add(node);
        }
Exemple #37
0
        private Node parseComment()
        {
            Token token = expect(typeof (Comment));

            CommentNode node;
            if (peek() is Indent)
            {
                node = new BlockCommentNode();
                node.setBlock(block());
            }
            else
            {
                node = new CommentNode();
            }
            node.setBuffered(token.isBuffer());
            node.setLineNumber(token.getLineNumber());
            node.setFileName(filename);
            node.setValue(token.getValue());

            return node;
        }
 public void VisitCommentNode(CommentNode comment)
 {
     throw new NotImplementedException();
 }