test_class.file: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/GoModTest.java
test_class.identifier: GoModTest
test_case.body: @Test
    public void testModule() {
      assertModules(GoMod.from("module (example.com/hello) // huzzaa"), "example.com/hello");
      assertModules(GoMod.from("module (\n"
              + "example.com/hello // some\n"
              + "  \"sss.gid/fsdsd\"   \n"
              + ") // huzzaa"), "example.com/hello", "sss.gid/fsdsd");
      assertModules(GoMod.from("module (example.com/hello) // huzzaa"), "example.com/hello");
      assertModules(GoMod.from("module example.com/hello"), "example.com/hello");
      assertModules(GoMod.from("module example.com/hello\n"), "example.com/hello");
      assertModules(GoMod.from("module example.com/hello // huzzaa"), "example.com/hello");
      assertModules(GoMod.from("\n   \n    module \"example.com/hello\" // huzzaa"), "example.com/hello");
      assertModules(GoMod.from("module \"example.com/hello\""), "example.com/hello");
      assertModules(GoMod.from("module \"example.com/hello\"\n"), "example.com/hello");
      assertModules(GoMod.from("module \"example.com/hello\" // huzzaa"), "example.com/hello");
    }
test_case.class_method_signature: GoModTest.testModule()
test_case.full_signature: @Test public void testModule()
test_case.identifier: testModule
test_case.invocations: assertModules from assertModules from assertModules from assertModules from assertModules from assertModules from assertModules from assertModules from assertModules from assertModules from
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testModule()
focal_class.declarator: TOKENIZER = Pattern.compile("(\\/\\/|\\\"[^\\\"]+\\\"|[<>=\\w.+\\-/]+|[<>=-]+|\\(|\\)|[\\s\\n]+)")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern TOKENIZER = Pattern.compile("(\\/\\/|\\\"[^\\\"]+\\\"|[<>=\\w.+\\-/]+|[<>=-]+|\\(|\\)|[\\s\\n]+)");
focal_class.type: Pattern
focal_class.var_name: TOKENIZER
focal_class.declarator: items
focal_class.modifier: private final
focal_class.original_string: private final List<GoModItem> items;
focal_class.type: List<GoModItem>
focal_class.var_name: items
focal_class.file: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/GoMod.java
focal_class.identifier: GoMod
focal_class.class_method_signature: GoMod.quoteIfHasSpace(@Nonnull final String str)
focal_class.full_signature: @Nonnull private static String quoteIfHasSpace(@Nonnull final String str)
focal_class.identifier: quoteIfHasSpace
focal_class.modifiers: @Nonnull private static
focal_class.parameters: (@Nonnull final String str)
focal_class.return: String
focal_class.signature: String quoteIfHasSpace(@Nonnull final String str)
focal_class.class_method_signature: GoMod.ensureNoQuoting(@Nonnull final String text)
focal_class.full_signature: @Nonnull private static String ensureNoQuoting(@Nonnull final String text)
focal_class.identifier: ensureNoQuoting
focal_class.modifiers: @Nonnull private static
focal_class.parameters: (@Nonnull final String text)
focal_class.return: String
focal_class.signature: String ensureNoQuoting(@Nonnull final String text)
focal_class.class_method_signature: GoMod.extractModuleInfo(@Nonnull @MustNotContainNull final List<String> tokens, @Nonnull @MustNotContainNull final String... separators)
focal_class.full_signature: @Nonnull @MustNotContainNull private static List<ModuleInfo> extractModuleInfo(@Nonnull @MustNotContainNull final List<String> tokens, @Nonnull @MustNotContainNull final String... separators)
focal_class.identifier: extractModuleInfo
focal_class.modifiers: @Nonnull @MustNotContainNull private static
focal_class.parameters: (@Nonnull @MustNotContainNull final List<String> tokens, @Nonnull @MustNotContainNull final String... separators)
focal_class.return: List<ModuleInfo>
focal_class.signature: List<ModuleInfo> extractModuleInfo(@Nonnull @MustNotContainNull final List<String> tokens, @Nonnull @MustNotContainNull final String... separators)
focal_class.class_method_signature: GoMod.equals(@Nullable final Object that)
focal_class.full_signature: @Override public boolean equals(@Nullable final Object that)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (@Nullable final Object that)
focal_class.return: boolean
focal_class.signature: boolean equals(@Nullable final Object that)
focal_class.class_method_signature: GoMod.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: GoMod.from(@Nonnull final String str)
focal_class.full_signature: @Nonnull public static GoMod from(@Nonnull final String str)
focal_class.identifier: from
focal_class.modifiers: @Nonnull public static
focal_class.parameters: (@Nonnull final String str)
focal_class.return: GoMod
focal_class.signature: GoMod from(@Nonnull final String str)
focal_class.class_method_signature: GoMod.GoMod(@Nonnull @MustNotContainNull final List<GoModItem> items)
focal_class.full_signature: private  GoMod(@Nonnull @MustNotContainNull final List<GoModItem> items)
focal_class.identifier: GoMod
focal_class.modifiers: private
focal_class.parameters: (@Nonnull @MustNotContainNull final List<GoModItem> items)
focal_class.signature:  GoMod(@Nonnull @MustNotContainNull final List<GoModItem> items)
focal_class.class_method_signature: GoMod.addItem(@Nonnull final GoModItem item)
focal_class.full_signature: @Nonnull public GoMod addItem(@Nonnull final GoModItem item)
focal_class.identifier: addItem
focal_class.modifiers: @Nonnull public
focal_class.parameters: (@Nonnull final GoModItem item)
focal_class.return: GoMod
focal_class.signature: GoMod addItem(@Nonnull final GoModItem item)
focal_class.class_method_signature: GoMod.find(@Nonnull final Class<T> klass)
focal_class.full_signature: @Nonnull @MustNotContainNull public List<T> find(@Nonnull final Class<T> klass)
focal_class.identifier: find
focal_class.modifiers: @Nonnull @MustNotContainNull public
focal_class.parameters: (@Nonnull final Class<T> klass)
focal_class.return: List<T>
focal_class.signature: List<T> find(@Nonnull final Class<T> klass)
focal_class.class_method_signature: GoMod.size()
focal_class.full_signature: public int size()
focal_class.identifier: size
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int size()
focal_class.class_method_signature: GoMod.toString()
focal_class.full_signature: @Nonnull @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Nonnull @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: GoMod.hasReplaceFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.full_signature: public boolean hasReplaceFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.identifier: hasReplaceFor
focal_class.modifiers: public
focal_class.parameters: (@Nonnull final String moduleName, @Nullable final String version)
focal_class.return: boolean
focal_class.signature: boolean hasReplaceFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.class_method_signature: GoMod.hasRequireFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.full_signature: public boolean hasRequireFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.identifier: hasRequireFor
focal_class.modifiers: public
focal_class.parameters: (@Nonnull final String moduleName, @Nullable final String version)
focal_class.return: boolean
focal_class.signature: boolean hasRequireFor(@Nonnull final String moduleName, @Nullable final String version)
focal_class.class_method_signature: GoMod.getModule()
focal_class.full_signature: @Nullable public String getModule()
focal_class.identifier: getModule
focal_class.modifiers: @Nullable public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getModule()
focal_method.body: @Nonnull
      public static GoMod from(@Nonnull final String str) {
          final List<GoModItem> foundItems = new ArrayList<>();
  
          final Matcher matcher = TOKENIZER.matcher(str);
  
          ParserState state = ParserState.FIND;
  
          boolean findEol = false;
          boolean bracket = false;
  
          final List<String> tokenList = new ArrayList<>();
  
          String customTokenName = null;
  
          while (matcher.find()) {
              final String token = matcher.group(1);
              if (findEol) {
                  if (token.contains("\n")) {
                      findEol = false;
                      state = bracket ? state : ParserState.FIND;
                  }
              } else {
                  switch (state) {
                      case FIND: {
                          tokenList.clear();
                          switch (token) {
                              case "module": {
                                  state = ParserState.MODULE;
                              }
                              break;
                              case "exclude": {
                                  state = ParserState.EXCLUDE;
                              }
                              break;
                              case "replace": {
                                  state = ParserState.REPLACE;
                              }
                              break;
                              case "require": {
                                  state = ParserState.REQUIRE;
                              }
                              break;
                              default: {
                                  if ("//".equals(token)) {
                                      findEol = true;
                                  } else if (!token.trim().isEmpty()) {
                                      state = ParserState.CUSTOM;
                                      customTokenName = token;
                                  }
                              }
                              break;
                          }
                      }
                      break;
                      case CUSTOM: {
                          if ("//".equals(token)) {
                              if (!bracket) {
                                  foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0])));
                                  foundItems.clear();
                                  customTokenName = null;
                                  state = ParserState.FIND;
                              }
                          } else {
                              if ("(".equals(token)) {
                                  if (bracket) {
                                      throw new IllegalArgumentException("Duplicated opening bracket in " + state);
                                  }
                                  bracket = true;
                              } else if (")".equals(token)) {
                                  if (!bracket) {
                                      throw new IllegalArgumentException("Unexpected closing bracket in " + state);
                                  }
                                  bracket = false;
                                  foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0])));
                                  foundItems.clear();
                                  customTokenName = null;
                                  state = ParserState.FIND;
                              } else if (token.contains("\n")) {
                                  if (!bracket) {
                                      state = ParserState.FIND;
                                      foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0])));
                                  }
                              } else {
                                  if (!token.trim().isEmpty()) {
                                      tokenList.add(token);
                                  }
                              }
                          }
                      }
                      break;
                      case MODULE:
                      case EXCLUDE:
                      case REPLACE:
                      case REQUIRE: {
                          if ("(".equals(token)) {
                              if (bracket) {
                                  throw new IllegalArgumentException("Duplicated opening bracket in " + state);
                              }
                              if (!tokenList.isEmpty()) {
                                  throw new IllegalArgumentException("Unexpected tokens " + tokenList + " before bracket in " + state);
                              }
                              bracket = true;
                          } else {
                              final boolean processTokenList;
                              ParserState nextState = state;
  
                              if (")".equals(token)) {
                                  if (!bracket) {
                                      throw new IllegalArgumentException("Unexpected closing bracket in " + state);
                                  }
                                  bracket = false;
                                  processTokenList = !tokenList.isEmpty();
                                  nextState = ParserState.FIND;
                              } else if ("//".equals(token)) {
                                  findEol = true;
                                  processTokenList = !bracket || !tokenList.isEmpty();
                                  nextState = bracket ? state : ParserState.FIND;
                              } else if (token.contains("\n")) {
                                  processTokenList = !bracket || !tokenList.isEmpty();
                                  nextState = bracket ? state : ParserState.FIND;
                              } else {
                                  if (!token.trim().isEmpty()) {
                                      tokenList.add(ensureNoQuoting(token));
                                  }
                                  processTokenList = false;
                              }
  
                              if (processTokenList) {
                                  switch (state) {
                                      case MODULE: {
                                          final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                                          tokenList.clear();
                                          while (!moduleInfos.isEmpty()) {
                                              foundItems.add(new GoModule(moduleInfos.remove(0)));
                                          }
                                      }
                                      break;
                                      case REQUIRE: {
                                          final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                                          tokenList.clear();
                                          while (!moduleInfos.isEmpty()) {
                                              foundItems.add(new GoRequire(moduleInfos.remove(0)));
                                          }
                                      }
                                      break;
                                      case EXCLUDE: {
                                          final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                                          tokenList.clear();
                                          while (!moduleInfos.isEmpty()) {
                                              foundItems.add(new GoExclude(moduleInfos.remove(0)));
                                          }
                                      }
                                      break;
                                      case REPLACE: {
                                          final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList, "=>");
                                          tokenList.clear();
                                          while (!moduleInfos.isEmpty()) {
                                              final ModuleInfo from = moduleInfos.remove(0);
                                              if (moduleInfos.isEmpty()) {
                                                  throw new IllegalArgumentException("Can't find target in replace");
                                              }
                                              final ModuleInfo to = moduleInfos.remove(0);
                                              foundItems.add(new GoReplace(from, to));
                                          }
                                      }
                                      break;
                                      default:
                                          throw new Error("Unexpected: " + state);
                                  }
                              }
  
                              state = nextState;
                          }
                      }
                      break;
                  }
              }
          }
  
          if (!tokenList.isEmpty()) {
              switch (state) {
                  case MODULE: {
                      final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                      tokenList.clear();
                      while (!moduleInfos.isEmpty()) {
                          foundItems.add(new GoModule(moduleInfos.remove(0)));
                      }
                  }
                  break;
                  case REQUIRE: {
                      final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                      tokenList.clear();
                      while (!moduleInfos.isEmpty()) {
                          foundItems.add(new GoRequire(moduleInfos.remove(0)));
                      }
                  }
                  break;
                  case EXCLUDE: {
                      final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList);
                      tokenList.clear();
                      while (!moduleInfos.isEmpty()) {
                          foundItems.add(new GoExclude(moduleInfos.remove(0)));
                      }
                  }
                  break;
                  case REPLACE: {
                      final List<ModuleInfo> moduleInfos = extractModuleInfo(tokenList, "=>");
                      tokenList.clear();
                      while (!moduleInfos.isEmpty()) {
                          final ModuleInfo from = moduleInfos.remove(0);
                          if (moduleInfos.isEmpty()) {
                              throw new IllegalArgumentException("Can't find target in replace");
                          }
                          final ModuleInfo to = moduleInfos.remove(0);
                          foundItems.add(new GoReplace(from, to));
                      }
                  }
                  break;
                  case CUSTOM: {
                      foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0])));
                  }
                  break;
                  default:break;
              }
          }
  
          return new GoMod(foundItems);
      }
focal_method.class_method_signature: GoMod.from(@Nonnull final String str)
focal_method.full_signature: @Nonnull public static GoMod from(@Nonnull final String str)
focal_method.identifier: from
focal_method.invocations: matcher find group contains clear equals isEmpty trim equals add toArray clear equals equals add toArray clear contains add toArray isEmpty trim add equals isEmpty equals isEmpty equals isEmpty contains isEmpty isEmpty trim add ensureNoQuoting extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty remove isEmpty remove add isEmpty extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty add remove extractModuleInfo clear isEmpty remove isEmpty remove add add toArray
focal_method.modifiers: @Nonnull public static
focal_method.parameters: (@Nonnull final String str)
focal_method.return: GoMod
focal_method.signature: GoMod from(@Nonnull final String str)