// Path: aesh/src/main/java/org/aesh/extensions/highlight/scanner/PlainScanner.java
// public class PlainScanner implements Scanner {
//    private static final Pattern ALL = Pattern.compile(".*", Pattern.DOTALL);
// 
//    // Never match a File, only match by default if no one else does. Handled in Scanner.Factory
//    public static final Type TYPE = new Type("PLAIN", (Pattern)null);
// 
//    @Override
//    public Type getType() {
//       return TYPE;
//    }
// 
//    @Override
//    public void scan(StringScanner source, Encoder encoder, Map<String, Object> options) {
//       MatchResult m = source.scan(ALL);
//       if (m != null) {
//          encoder.textToken(m.group(), TokenType.plain);
//       }
//    }
// 
// }


import org.aesh.extensions.highlight.scanner.PlainScanner;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;
            this.registry = new LinkedHashMap<String, Scanner>();
        }

        private static Factory instance() {
            if (factory == null) {
                factory = new Factory();
            }
            return factory;
        }

        public static void registrer(Class<? extends Scanner> scanner) {
            Scanner scannerInst = create(scanner);
            instance().registry.put(scannerInst.getType().getName(), scannerInst);
        }

        public static Scanner byType(String typeName) {
            for (Scanner scanner : instance().registry.values()) {
                if (scanner.getType().getName().equalsIgnoreCase(typeName)) {
                    return scanner;
                }
            }
            return null;
        }

        public static Scanner byFileName(String fileName) {
            for (Scanner scanner : instance().registry.values()) {
                if (scanner.getType().supports(fileName)) {
                    return scanner;
                }
            }
// Path: aesh/src/main/java/org/aesh/extensions/highlight/scanner/PlainScanner.java
// public class PlainScanner implements Scanner {
//    private static final Pattern ALL = Pattern.compile(".*", Pattern.DOTALL);
// 
//    // Never match a File, only match by default if no one else does. Handled in Scanner.Factory
//    public static final Type TYPE = new Type("PLAIN", (Pattern)null);
// 
//    @Override
//    public Type getType() {
//       return TYPE;
//    }
// 
//    @Override
//    public void scan(StringScanner source, Encoder encoder, Map<String, Object> options) {
//       MatchResult m = source.scan(ALL);
//       if (m != null) {
//          encoder.textToken(m.group(), TokenType.plain);
//       }
//    }
// 
// }


// Path: aesh/src/main/java/org/aesh/extensions/highlight/Scanner.java
import org.aesh.extensions.highlight.scanner.PlainScanner;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;

            this.registry = new LinkedHashMap<String, Scanner>();
        }

        private static Factory instance() {
            if (factory == null) {
                factory = new Factory();
            }
            return factory;
        }

        public static void registrer(Class<? extends Scanner> scanner) {
            Scanner scannerInst = create(scanner);
            instance().registry.put(scannerInst.getType().getName(), scannerInst);
        }

        public static Scanner byType(String typeName) {
            for (Scanner scanner : instance().registry.values()) {
                if (scanner.getType().getName().equalsIgnoreCase(typeName)) {
                    return scanner;
                }
            }
            return null;
        }

        public static Scanner byFileName(String fileName) {
            for (Scanner scanner : instance().registry.values()) {
                if (scanner.getType().supports(fileName)) {
                    return scanner;
                }
            }
            return instance().registry.get(PlainScanner.TYPE);