Beispiel #1
0
        public static MatchCollection Match(string text, SyntaxMatch match)
        {
            switch (match)
            {
            case SyntaxMatch.Keywords:
                return(Regex.Matches(text, keywords));

            case SyntaxMatch.Methods:
                return(Regex.Matches(text, methods));

            case SyntaxMatch.LxTypes:
                return(Regex.Matches(text, lxTypes));

            case SyntaxMatch.Types:
                return(Regex.Matches(text, types));

            case SyntaxMatch.Comments:
                return(Regex.Matches(text, comments, RegexOptions.Multiline));

            case SyntaxMatch.Strings:
                return(Regex.Matches(text, strings));

            case SyntaxMatch.Numbers:
                return(Regex.Matches(text, numbers));
            }

            return(null);
        }
Beispiel #2
0
 protected abstract void Inspect(SkriptFile file, int line, AbstractFileNode node, SyntaxMatch match);
Beispiel #3
0
 protected virtual bool CanInspect(SkriptFile file, int line, AbstractFileNode node, SyntaxMatch match)
 {
     return(true);
 }
Beispiel #4
0
        protected override void Inspect(SkriptFile file, int line, AbstractFileNode node, SyntaxMatch match)
        {
            var cancelEvent = node.GetSyntaxNode <EffCancelEvent>();

            if (cancelEvent == null)
            {
                return;
            }

            if (node.RootParentSyntax?.Element is SkriptEvent @event && [email protected])
            {
                AddProblem(DiagnosticSeverity.Error,
                           $"This event can't be {(!cancelEvent.ToCancel ? "un" : "")}cancelled.", node);
            }
        }
 public FunctionSignatureFileNode(FunctionSignature signature) : base(signature)
 {
     MatchedSyntax = new SyntaxMatch(SignatureElements.FunctionSignature, signature.ParseResult);
 }
 public BaseSyntaxNode(AbstractFileNode node, SyntaxMatch match)
 {
     Node  = node;
     Match = match;
 }
Beispiel #7
0
 public EffCancelEvent(AbstractFileNode node, SyntaxMatch match) : base(node, match)
 {
     ToCancel = match.PatternIndex == 0;
     ContainsDefiniteArticle = match.Result.Context.Matches.Any(c => c.RawContent.ToLower() == "the");
 }