Class Blitz

java.lang.Object
de.bottlecaps.markup.Blitz

public class Blitz extends Object
The Markup Blitz main class. It provides static methods for parser generation and the main method for command line execution.
  • Field Details

  • Constructor Details

    • Blitz

      public Blitz()
  • Method Details

    • generate

      public static Parser generate(String grammar, Blitz.Option... blitzOptions) throws BlitzException
      Generate a parser from an Invisible XML grammar in ixml notation.
      Parameters:
      grammar - the Invisible XML grammar in ixml notation.
      blitzOptions - options for use at generation time and parsing time
      Returns:
      the generated parser
      Throws:
      BlitzException - if any error is detected while generating the parser
    • generateFromXml

      public static Parser generateFromXml(InputStream xml, Blitz.Option... blitzOptions) throws BlitzException
      Generate a parser from an Invisible XML grammar in XML, passed as an InputStream.
      Parameters:
      xml - the Invisible XML grammar in XML
      blitzOptions - options for use at generation time and parsing time
      Returns:
      the generated parser
      Throws:
      BlitzException - if any error is detected while generating the parser
    • generateFromXml

      public static Parser generateFromXml(String xml, Blitz.Option... blitzOptions) throws BlitzException
      Generate a parser from an Invisible XML grammar in XML, passed as a String.
      Parameters:
      xml - the Invisible XML grammar in XML
      blitzOptions - options for use at generation time and parsing time
      Returns:
      the generated parser
      Throws:
      BlitzException - if any error is detected while generating the parser
    • main

      public static void main(String[] args) throws IOException
      Process a command line in order to generate a parser from an Invisible XML grammar, in ixml notation, and parse some input using the generated parser. Write the resulting XML to standard output. Grammars and inputs must be presented in UTF-8 encoding, and the XML output is in UTF-8, too.
      Parameters:
      args - command line arguments
      Throws:
      IOException - if any input cannot be accessed
    • usage

      private static void usage(int exitCode)
    • urlContent

      public static String urlContent(URL url) throws IOException
      Get the content behind a URL as a string.
      Parameters:
      url - the URL
      Returns:
      the string
      Throws:
      IOException - if the content cannot be accessed
    • normalizeEol

      public static String normalizeEol(String input)
      Normalize line endings to be just LF, similar to XML End-of-Line Handling. This is necessary when reading resources from this project, when it was checked out on Windows using the default Git configuration (which is core.autocrlf=true on Windows).
      Parameters:
      input - string to be normalized
      Returns:
      the normalized string
    • url

      public static URL url(String input)
      Convert a file name string or URL string to a URL object.
      Parameters:
      input - the string
      Returns:
      the URL
    • ixmlGrammar

      public static String ixmlGrammar()
      Return the ixml grammar as a string.
      Returns:
      the ixml grammar