tokens static method

List<String> tokens()

Method to generate the list of tokens for SignWriting symbols.

Implementation

static List<String> tokens() {
  List<String> boxSymbols = ["B", "L", "M", "R"]; // Box symbols

  List<String> baseSymbols = [];
  // Generating base symbols using hexadecimal values
  for (int i = 0x10; i <= 0x38; i++) {
    for (int j = 0x0; j <= 0xf; j++) {
      String baseSymbol = "S${i.toRadixString(16)}${j.toRadixString(16)}";
      if (baseSymbol != "S38c" &&
          baseSymbol != "S38d" &&
          baseSymbol != "S38e" &&
          baseSymbol != "S38f") {
        baseSymbols.add(baseSymbol);
      }
    }
  }

  List<String> rows = [];
  // Generating row symbols using hexadecimal values
  for (int j = 0x0; j <= 0xf; j++) {
    rows.add("r${j.toRadixString(16)}");
  }

  List<String> cols = ["c0", "c1", "c2", "c3", "c4", "c5"]; // Column symbols

  List<String> positions = [];
  // Generating position symbols from 250 to 750
  for (int p = 250; p <= 750; p++) {
    positions.add("p$p");
  }

  // Combining all token categories and returning a flattened list
  return [boxSymbols, baseSymbols, rows, cols, positions]
      .expand((element) => element)
      .toList();
}