Class RegExUtil

java.lang.Object
com.e1c.langtool.storage.regex.RegExUtil

public class RegExUtil extends Object
The RegEx Utility class.
  • Field Details

  • Method Details

    • createRegExFile

      public static RegExFile createRegExFile(TranslateLanguage language, org.eclipse.core.resources.IFile file, String segment)
    • generateComment

      public static String generateComment(String segment)
      Generate comment for RegEx file.
      Parameters:
      segment - the segment
      Returns:
      the comment for RegEx file
    • getRegExFilePath

      public static org.eclipse.core.resources.IFile getRegExFilePath(org.eclipse.core.resources.IFile source, TranslateLanguage language, String segment)
      Gets the RegEx file path.
      Parameters:
      source - the source
      language - the language
      segment - the segment
      Returns:
      the RegEx file path
    • getNamedGroupCandidates

      public static Set<String> getNamedGroupCandidates(String regex)
      Gets the named group candidates from the RegEx string.
      Parameters:
      regex - the RegEx string
      Returns:
      the named group candidates
    • getRegExGroups

      public static List<String> getRegExGroups(RegExItem item)
      Gets the RegEx groups by the item and it's test string.
      Parameters:
      item - the item
      Returns:
      the RegEx groups
    • getRegExGroups

      public static List<String> getRegExGroups(RegExItem item, Matcher matcher)
      Gets the RegEx groups by the item and given external matcher.
      Parameters:
      item - the item
      matcher - the matcher
      Returns:
      the RegEx groups
    • getGroupPresentation

      public static String getGroupPresentation(String group)
      Gets the group presentation.
       "group" -> "${group}"
       
      Parameters:
      group - the group name
      Returns:
      the group presentation
    • getGroupNameFromPresentation

      public static String getGroupNameFromPresentation(String group)
      Gets the group name from presentation.
        "${group}" -> "group"
       
      Parameters:
      group - the group
      Returns:
      the group name from presentation, or null if group presentation is not valid
    • getGroupSource

      public static String getGroupSource(Matcher matcher, String groupName)
      Gets the group source string.
      Parameters:
      matcher - the matcher
      groupName - the group presentation name
      Returns:
      the group source
    • saveRegExSettings

      public static void saveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException
      Throws:
      IOException
    • saveRegExSettings

      public static byte[] saveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, com.google.common.hash.HashFunction hashFunction, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException
      Throws:
      IOException
    • loadSettings

      public static RegExSettings loadSettings(org.eclipse.core.resources.IFile file)