GfmlLxr.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. XOWA: the XOWA Offline Wiki Application
  3. Copyright (C) 2012-2017 gnosygnu@gmail.com
  4. XOWA is licensed under the terms of the General Public License (GPL) Version 3,
  5. or alternatively under the terms of the Apache License Version 2.0.
  6. You may use XOWA according to either of these licenses as is most appropriate
  7. for your project on a case-by-case basis.
  8. The terms of each license can be found in the source code repository:
  9. GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
  10. Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
  11. */
  12. package gplx.gfml;
  13. import gplx.core.texts.*; /*CharStream*/
  14. import gplx.frameworks.evts.Gfo_evt_itm;
  15. import gplx.types.basics.lists.Hash_adp;
  16. import gplx.types.basics.lists.Hash_adp_;
  17. public interface GfmlLxr extends Gfo_evt_itm {
  18. String Key();
  19. String[] Hooks();
  20. GfmlTkn CmdTkn();
  21. void CmdTkn_set(GfmlTkn val); // needed for lxr pragma
  22. GfmlTkn MakeTkn(CharStream stream, int hookLength);
  23. GfmlLxr SubLxr();
  24. void SubLxr_Add(GfmlLxr... lexer);
  25. }
  26. class GfmlLxrRegy {
  27. public int Count() {return hash.Len();}
  28. public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
  29. public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.GetByOrNull(key);}
  30. Hash_adp hash = Hash_adp_.New();
  31. }