Save
This commit is contained in:
20
Convention/[RScript]/Matcher/BreakMatcher.cs
Normal file
20
Convention/[RScript]/Matcher/BreakMatcher.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Convention.RScript.Matcher
|
||||
{
|
||||
public class BreakMatcher : IRSentenceMatcher
|
||||
{
|
||||
public bool Match(string expression, ref RScriptSentence sentence)
|
||||
{
|
||||
Regex LabelRegex = new(@"^break\(\s*(.+)\s*\)$");
|
||||
var LabelMatch = LabelRegex.Match(expression);
|
||||
if (LabelMatch.Success)
|
||||
{
|
||||
sentence.mode = RScriptSentence.Mode.Label;
|
||||
sentence.content = LabelMatch.Groups[1].Value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user