Class Blitz
java.lang.Object
de.bottlecaps.markup.Blitz
The Markup Blitz main class. It provides static methods for parser
generation and the main method for command line execution.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Parsergenerate(String grammar, Blitz.Option... blitzOptions) Generate a parser from an Invisible XML grammar in ixml notation.static ParsergenerateFromXml(InputStream xml, Blitz.Option... blitzOptions) Generate a parser from an Invisible XML grammar in XML, passed as an InputStream.static ParsergenerateFromXml(String xml, Blitz.Option... blitzOptions) Generate a parser from an Invisible XML grammar in XML, passed as a String.static StringReturn the ixml grammar as a string.static voidProcess 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.static StringnormalizeEol(String input) Normalize line endings to be just LF, similar to XML End-of-Line Handling.static URLConvert a file name string or URL string to a URL object.static StringurlContent(URL url) Get the content behind a URL as a string.private static voidusage(int exitCode)
-
Field Details
-
IXML_GRAMMAR_RESOURCE
-
-
Constructor Details
-
Blitz
public Blitz()
-
-
Method Details
-
generate
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 XMLblitzOptions- 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 XMLblitzOptions- 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
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
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
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
-
ixmlGrammar
-