Example #1
0
        /// <summary>
        /// Constrctor
        /// </summary>
        /// <param name="font"></param>
        public EfsRecognizer(Font font)
        {
            RegularFont = font;

            Pattern commentPattern = new Pattern(RegularFont, "//.*$")
            {
                Color = Color.Green
            };
            Pattern holeInTemplatePattern = new Pattern(RegularFont, "<[a-zA-Z\\b]+>")
            {
                Color = Color.OrangeRed
            };
            Pattern integerPattern = new Pattern(RegularFont, "\\b(?:[0-9]*\\.)?[0-9]+\\b")
            {
                Color = Color.BlueViolet
            };
            Pattern stringPattern = new Pattern(RegularFont, "\'[^\']*\'")
            {
                Color = Color.BlueViolet
            };
            ConstantPattern constantPattern = new ConstantPattern(RegularFont, QualifiedName)
            {
                Color = Color.BlueViolet
            };
            Pattern keywordPattern = new ListPattern(RegularFont, Keywords)
            {
                FontStyle = FontStyle.Bold
            };
            Pattern modelElementPattern = new ListPattern(RegularFont, ModelElements)
            {
                FontStyle = FontStyle.Bold | FontStyle.Underline
            };
            Pattern compoundModelElementPattern = new ListPattern(RegularFont, CompoundModelElements)
            {
                FontStyle = FontStyle.Bold | FontStyle.Underline
            };
            TypePattern typePattern = new TypePattern(RegularFont, QualifiedName)
            {
                Color = Color.Blue
            };

            Patterns = new List <Pattern>
            {
                commentPattern,
                holeInTemplatePattern,
                keywordPattern,
                modelElementPattern,
                compoundModelElementPattern,
                typePattern,
                integerPattern,
                stringPattern,
                constantPattern,
            };
        }
        /// <summary>
        /// Constrctor
        /// </summary>
        /// <param name="font"></param>
        public EfsRecognizer(Font font)
        {
            RegularFont = font;

            Pattern commentPattern = new Pattern(RegularFont, "//.*$")
            {
                Color = Color.Green
            };
            Pattern holeInTemplatePattern = new Pattern(RegularFont, "<[a-zA-Z\\b]+>")
            {
                Color = Color.OrangeRed
            };
            Pattern integerPattern = new Pattern(RegularFont, "\\b(?:[0-9]*\\.)?[0-9]+\\b")
            {
                Color = Color.BlueViolet
            };
            Pattern stringPattern = new Pattern(RegularFont, "\'[^\']*\'")
            {
                Color = Color.BlueViolet
            };
            ConstantPattern constantPattern = new ConstantPattern(RegularFont, QualifiedName)
            {
                Color = Color.BlueViolet
            };
            Pattern keywordPattern = new ListPattern(RegularFont, Keywords)
            {
                FontStyle = FontStyle.Bold
            };
            Pattern modelElementPattern = new ListPattern(RegularFont, ModelElements)
            {
                FontStyle = FontStyle.Bold | FontStyle.Underline
            };
            TypePattern typePattern = new TypePattern(RegularFont, QualifiedName)
            {
                Color = Color.Blue
            };

            Patterns = new List<Pattern>
            {
                commentPattern,
                holeInTemplatePattern,
                keywordPattern,
                modelElementPattern,
                typePattern,
                integerPattern,
                stringPattern,
                constantPattern,
            };
        }