diff options
author | 2017-09-03 10:51:44 +0200 | |
---|---|---|
committer | 2017-09-04 11:23:17 +0200 | |
commit | a6d3f52fef62955b6b25a3832440f041a93bc5e2 (patch) | |
tree | c6d20779e7cd3558c51bf986fb15a1d1e4bfdf77 /third_party/java/jopt-simple/src/site | |
parent | 663df9d96f10a2dd0fa8a85b4aac39cd2cc368fb (diff) |
Remove third_party/java/jopt-simple/src/{site,test}.
They are unused and the tests depend on Joda Time which I'm going to
remove.
Also document the removal in the package's README.bazel.md.
Change-Id: I7b0ee89718bfc2cffcc60a8262cf53dbf9035669
Diffstat (limited to 'third_party/java/jopt-simple/src/site')
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/acknowledgments.apt | 90 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/changes.apt | 385 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/developer.apt | 48 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/download.apt.vm | 26 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/examples.apt | 462 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/apt/index.apt | 71 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/resources/css/prettify.css | 49 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/resources/images/jopt-simple-logo.png | bin | 7147 -> 0 bytes | |||
-rw-r--r-- | third_party/java/jopt-simple/src/site/resources/scripts/prettify.js | 1602 | ||||
-rw-r--r-- | third_party/java/jopt-simple/src/site/site.xml | 20 |
10 files changed, 0 insertions, 2753 deletions
diff --git a/third_party/java/jopt-simple/src/site/apt/acknowledgments.apt b/third_party/java/jopt-simple/src/site/apt/acknowledgments.apt deleted file mode 100644 index ec35ed7e19..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/acknowledgments.apt +++ /dev/null @@ -1,90 +0,0 @@ - --------------- - Acknowledgments - --------------- - - Thanks to the following people who have offered constructive feedback, support, contribution, - and/or praise for JOpt Simple: - - * Paul Armstrong - - * Guillaume Aubert - - * David Beckingsale - - * Jochen Bedersdorfer - - * Louis Bergelson - - * Ryan Breidenbach - - * Erik Broes - - * Carlos Cadete - - * Laurent Caillette - - * Matthew Daniel - - * Hans Dockter - - * Kevin C. Dorff - - * Adam Fisk - - * Raymund F\u00FCl\u00F6p - - * Dave Jarvis - - * Paul King - - * El Kodus - - * Alexander Kriegisch - - * Zachary Kurmas - - * Henning Luebbers - - * Derek Mahar - - * Bruno Mascret - - * Antoine Neveux - - * Christian Ohr - - * Michael Osipov - - * Brian Oxley (binkley) - - * Andrew Parker - - * Julien Ponge - - * Rob Reed - - * Mark Reinhold - - * Alex Renger - - * Andrew Robinson - - * Jonathan Shook - - * Jason Smith - - * Emils Solmanis - - * Leo Uzcategui - - * Alan van Dam - - * Douglas Wegscheid - - * Chris K Wensel - - * Ashley Williams - - * Daniel Yokomizo - - [] diff --git a/third_party/java/jopt-simple/src/site/apt/changes.apt b/third_party/java/jopt-simple/src/site/apt/changes.apt deleted file mode 100644 index 2bc0d7d9c6..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/changes.apt +++ /dev/null @@ -1,385 +0,0 @@ - ---------- - Change Log - ---------- - -Changes in version 5.0.3 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/96} gh-96}} so that - options that take an argument but don't change the argument type from - <<<String>>> still show a <<<String>>> type indicator in the default - option help. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/104} gh-104}} so - that <<<EnumConverter>>> performs case-insensitive matching against arguments - of options. Thanks to Martin Paljak for this. - -Changes in version 5.0.2 - - * Made some package-private abstract classes become public classes - with package-private constructors. This makes it possible to call some methods - from Kotlin that were previously inaccessible. Thanks to Mirko Friedenhagen - for this. - -Changes in version 5.0.1 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/92} gh-92}} so that - in the event that <<<printHelpOn()>>> is called more than once, the output - is not duplicated. - -Changes in version 5.0 - - * Abandoning JDKs prior to 7. All source is Java 7-compatible, and bytecode is compiled to 1.7 - version. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/51} gh-51}} by adding - <<<OptionSpecBuilder.availableIf()>>> and <<<OptionSpecBuilder.availableUnless()>>>. Thanks - to Christian Ohr for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/70} gh-70}} by adding - <<<EnumConverter>>> and <<<PathConverter>>>. Thanks to Christian Ohr for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/88} gh-88}} by adding - an <<<OptionParser>>> constructor to allow suppression of option abbreviations. - Thanks to Louis Bergelson for this. - -Changes in version 4.10 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/85} gh-85}} - by correcting the description column width consumption of the built-in - help formatter. - -Changes in version 4.9 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/79} gh-79}} - by correcting the behavior of <<<OptionException.multipleOptionString>>> - when handling options with synonyms. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/72} gh-72}} - by externalizing some of the literal strings in <<<BuiltinHelpFormatter>>> - into resource bundles. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/76} gh-76}} - by modifying the behavior of <<<OptionalArgumentOptionSpec>>> so that if - the argument following the option does not "look like" an option but can - be converted to the option argument's type, treat the argument as the argument - of the option. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/68} gh-68}} - by modifying <<<BuiltinHelpFormatter>>> to be more extensible and documenting - the behavior of the newly accessible methods. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/73} gh-73}} - by correcting the behavior of <<<OptionSet.specs()>>> to remove all instances - of the non-option argument spec. - -Changes in version 4.8 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/65} gh-65}} - by modifying the build file to create a JAR with OSGi metadata. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/63} gh-63}} - by externalizing exception messages into resource bundles. - Currently, we ship only with messages for locale "en_US". - Translations for other locales are more than welcome. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/58} gh-58}} by - rewriting exception messaging to clarify synonymous options. - Synonyms are be separated by slashes (/); lists of distinct options will - be separated by commas (,) in square brackets ([]). - -Changes in version 4.7 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/57} gh-57}} by admitting - the underscore as a legal option character. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/53} gh-53}} by correcting - <<<OptionSet.hasOptions()>>> to answer correctly for no switches. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/56} gh-56}} by correcting - the default help formatting not to use a <<<Set>>> for rows of output, - but <<<List>>>. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/59} gh-59}} by relaxing - the return type of <<<ValueConverter.valueType()>>>. - -Changes in version 4.6 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/31} gh-31}} by offering - <<<OptionSpecBuilder.requiredUnless()>>>. Thanks to Christian Ohr for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/38} gh-38}} by offering - <<<OptionParser.recognizedOptions()>>>. Thanks to Antoine Neveux for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/35} gh-35}} by offering - <<<OptionSet.asMap()>>>. Thanks to Brian Oxley for this. - -Changes in version 4.5 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/17} gh-17}} by offering - <<<OptionParser.nonOptions()>>> and <<<NonOptionArgumentSpec>>>. - - * Resolved {{{https://github.com/pholser/jopt-simple/pull/27} gh-27}} by offering - <<<OptionParser.allowsUnrecognizedOptions()>>>. Thanks to Erik Broes for this. - -Changes in version 4.4 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/16} gh-16}} by offering - <<<BuiltinHelpFormatter>>> that allows configuration of overall row width and - column separator width. Thanks to Ryan Breidenbach for contributing code to this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/12} gh-12}} by offering - <<<OptionSpecBuilder.requiredIf()>>>. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/22} gh-22}}. Thanks to - El Kodus for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/19} gh-19}}. Thanks to - El Kodus for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/14} gh-14}} by offering - <<<AbstractOptionSpec.forHelp()>>>. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/13} gh-13}} by offering - <<<ArgumentAcceptingOptionSpec.withValuesSeparatedBy(String)>>>. - - * Added <<<InetAddressValueConverter>>>. Thanks to Raymund F\u00FCl\u00F6p for this. - -Changes in version 4.3 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/9} gh-9}} by offering - <<<OptionSet.specs()>>>, which gives a list of the specs corresponding to the - options detected on a parse, in the order in which the options occurred on the - command line. - -Changes in version 4.2 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/8} gh-8}} by offering - <<<ArgumentAcceptingOptionSpec.defaultsTo(V[])>>> in addition to - <<<ArgumentAcceptingOptionSpec.defaultsTo(V, V...)>>>. - - * Removing some internal unused classes and methods. - -Changes in version 4.1 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/7} gh-7}} by allowing short option - clusters to contain options which can accept arguments. When such an option is encountered, - the remaining characters in the cluster are treated as the argument to the option. Thanks to - Alan van Dam for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/6} gh-6}} with general improvements - to the project's site. Thanks to Michael Osipov for this. - -Changes in version 4.0 - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/4} gh-4}} by adding method - <<<OptionParser.formatHelpWith(HelpFormatter)>>> to allow programmers to influence what - help is printed with <<<OptionParser.printHelpOn()>>>. A <<<HelpFormatter>>> is handed a - map, keyed by option text, whose values are <<<OptionDescriptor>>>s that describe the - options the parser has been configured with. - - * Added method <<<OptionSet.hasOptions()>>>. Thanks to Michael Osipov for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/pull/3} gh-3}} by using - <<<SimpleDateFormat.toPattern()>>> rather than <<<SimpleDateFormat.toLocalizedPattern()>>> - in <<<DateConverter>>>. Thanks to Michael Osipov for this. - - * Resolved {{{https://github.com/pholser/jopt-simple/issues/5} gh-5}} by allowing primitive - <<<Class>>> objects whose wrapper types are considered "value types" for purposes of - <<<ArgumentAcceptingOptionSpec.ofType()>>> in place of the wrapper classes. Thanks to - Daniel Yokomizo for suggesting this. - -Changes in version 3.3 - - * Resolved {{{https://github.com/pholser/jopt-simple/pull/1} gh-1}} by adding method - <<<required()>>> to class <<<ArgumentAcceptingOptionSpec>>>, to allow callers to indicate - that a given option must be present on the command line. Thanks to Emils Solmanis for - adding this. - -Changes in version 3.2 - - * Added method <<<defaultsTo()>>> to class <<<ArgumentAcceptingOptionSpec>>>, to allow - callers to specify default values for arguments of options. These influence the return - values of <<<OptionSpec.value(s)()>>> and <<<OptionSet.value(s)Of()>>>. Default values - also show up in the help screen entries for their options. This serves to resolve - {{{https://sourceforge.net/tracker/?func=detail&aid=2484524&group_id=125731&atid=703508} feature - request 2484524}}. - - * Fixed a problem whereby the empty string, a string consisting solely of whitespace, or a - string with embedded whitespace weren't being properly recognized as arguments of options - when they should have. - - * Resolved {{{https://sourceforge.net/tracker/?func=detail&aid=2793762&group_id=125731&atid=703508} feature - request 2793762}}, having to do with improving the behavior of embedded newlines in option - descriptions in help screens. - -Changes in version 3.1 - - * Added method <<<withValuesConvertedBy()>>> to class <<<ArgumentAcceptingOptionSpec>>>, - to allow callers to specify converters or validators that transform arguments of - options into instances of specific Java types. This is useful for types which do not - meet the requirements of <<<ofType()>>>. - - * Added classes <<<DateConverter>>> and <<<RegexMatcher>>> as examples of useful - argument converters. - -Changes in version 3.0.1 - - * Dependency on {{{http://ant.apache.org} Ant}} more appropriately test-scoped in the - {{{http://maven.apache.org} Maven}} POM. That way, if you use JOpt Simple with Maven, - you don't download Ant unnecessarily. - -Changes in version 3.0 - - * Version 3.0 supports Java 5 and greater only. If you need to use JOpt Simple in a - pre-Java-5 environment, use the latest 2.x release. - - * Where appropriate, existing API calls have been updated to use Java generics. - - * Extracted and surfaced interface <<<OptionSpec>>>. <<<OptionSpec>>>s returned by - the fluent interface methods can be used to retrieve arguments of the options they - represent in a type-safe manner. - - * Removed all previously deprecated methods. - - * Added methods to <<<OptionSet>>> to allow detection of options and retrieval of - option arguments using instances of <<<OptionSpec>>>. - - * Converted tests to JUnit 4. - - * Switched to MIT License. - - * Relaxing some <<<List>>> parameter types and return types of methods to - <<<Collection>>>. - - * <<<OptionArgumentConversionException>>> no longer drops the original cause on the - floor; hence <<<OptionException>>> can now be created with a cause. - - * {{{http://maven.apache.org} Maven}}-ized the project web site. - - * Overhauled the examples page. - -Changes in version 2.4.1 - - * Fixed {{{https://sourceforge.net/tracker/index.php?func=detail&aid=2018262&group_id=125731&atid=703505} bug 2018262}}. - -Changes in version 2.4 - - * Added the <<<acceptsAll()>>> method to class <<<OptionParser>>>. Options passed to - a given invocation of this method are treated as synonymous, so that each gives the - same answer when given as the argument to the methods <<<has()>>>, <<<valuesOf()>>>, - etc. on <<<OptionSet>>>. - - * Surfaced the class <<<KeyValuePair>>>. This class can be very handy as a value - type for arguments whose values take on the form <<<key=value>>>, such as the <<<-D>>> - arguments to JVMs. - - * Fixed {{{https://sourceforge.net/tracker/index.php?func=detail&aid=1932577&group_id=125731&atid=703505} bug 1932577}}. - - * Added method <<<withValuesSeparatedBy()>>> to class <<<ArgumentAcceptingOptionSpec>>>, - to allow callers to specify multiple values for an option as a single argument with - values separated by a given character. - - * Method <<<ofType()>>> on class <<<ArgumentAcceptingOptionSpec>>> now returns self - rather than <<<void>>>. - - * Deprecated another "get for get's sake": <<<OptionParser.setPosixlyCorrect()>>> - It is replaced with a less Java-beany-looking method. - - * Cleaned up the help screens produced by <<<OptionParser.printHelpOn()>>> so they are - rendered as two 40-character columns, with long space-broken values split across lines - as needed. - - * Fixed {{{https://sourceforge.net/tracker/index.php?func=detail&aid=1956418&group_id=125731&atid=703505} bug 1956418}}. - -Changes in version 2.3.6 - - * No changes to code; just getting {{{http://maven.apache.org} Maven}} to do releases - with its plugins. - -Changes in version 2.3.3 - - * Deprecated method <<<OptionSet.wasDetected()>>> in favor of <<<OptionSet.has()>>> -- - the new name seems to read better. - - * <<<OptionException>>>s now override <<<getMessage()>>> sensibly, so that if a caller - wants to handle the exception by catching it and displaying a message from the - exception, she can do so and get satisfactory results. - - * {{{http://maven.apache.org} Maven}}-ized project's build. - - * Minor internal changes. - -Changes in version 2.3.2 - - * Minor internal changes. - -Changes in version 2.3.1 - - * Fixed a bug with POSIX-ly correct parsers. It was previously thought that POSIX-ly - correct parsers should signal end of options when they detect an argument that does - not lexically look like an option and could not be an argument of a previous option, - required or optional. Such parsers now signal end of options when they detect an - argument that does not lexically look like an option, and is not an argument of a - previous option with a required argument. If you want such an argument to be treated - as the argument of a preceding option whose argument is optional, you can still get - this behavior by appending the argument to the option, either with abutting syntax - (<<<-d/tmp>>>) or key-value syntax (<<<-d=/tmp>>>). - -Changes in version 2.3 - - * No feature changes in this release; but this release can now be used with JDK 1.3. - Previous releases could be used only with JDK 1.4 or newer. - -Changes in version 2.2 - - * Removed all previously deprecated methods. - - * Re-clarified the contract of the one-arg <<<String>>> constructor of - <<<OptionParser>>>: the constructor now raises <<<NullPointerException>>> if its - argument is <<<null>>>. This is the convention for Java library methods which receive - illegal <<<null>>> parameters. - -Changes in version 2.1 - - * Introduced a facility for <<<OptionParser>>>s to print a help screen, which - describes the options they accept. - - * Added the ability to provide descriptions of options and their arguments when - configuring an <<<OptionParser>>>. These descriptions are printed in the - aforementioned help screens. - - * Clarified the contract of the one-arg <<<String>>> constructor of <<<OptionParser>>>: - the constructor raises <<<IllegalArgumentException>>> if its argument is <<<null>>>. - - * Deprecated <<<OptionParser.noArg()>>>, <<<OptionParser.requiredArg()>>>, and - <<<OptionParser.optionalArg()>>>. - - * Deprecated some "gets for gets' sake": <<<OptionException.getOption()>>>, - <<<OptionSet.getNonOptionArguments()>>>. They are replaced with less - Java-beany-looking methods. - -Changes in version 2.0 - - * Introduced a "fluent interface" API for specifying options for an <<<OptionParser>>> - to recognize. The old methods for option specification still work--you need not - convert to the new methods. - - * Added the ability to specify that option arguments should be converted to specific - types. You can do this either with the old option specification methods or with the - new fluent interface API. - - * Deprecated <<<OptionParser.requiresArg()>>> in favor of - <<<OptionParser.requiredArg()>>> -- the new name seems to read better. - -Version 1.0 - - * First major release. - - * Includes concrete classes <<<OptionParser>>> and <<<OptionSet>>>. - - * Supports POSIX <<<getopt()>>> and GNU <<<getopt_long()>>> command line syntax. - - * No type conversion on option arguments, they are all treated as <<<String>>>s. - - * Methods <<<noArg()>>>, <<<requiredArg()>>>, and <<<optionalArg()>>> tell an - <<<OptionParser>>> what options to recognize. diff --git a/third_party/java/jopt-simple/src/site/apt/developer.apt b/third_party/java/jopt-simple/src/site/apt/developer.apt deleted file mode 100644 index 59d5d82d5a..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/developer.apt +++ /dev/null @@ -1,48 +0,0 @@ - -------------- - Developer Docs - -------------- - -Help for developing JOpt Simple - - This page has notes and hints for contributing to JOpt Simple, mostly around getting started and style questions. - -* Code Style - - Style is important. Why? Chiefly to aid merges. Reformatting code makes merging more difficult. When needing to reformat unchanged code, please do so on a separate commit with a clear commit message indicating a non-code change. - - In general use the Eclipse formatter (there is a plugin for IntelliJ IDEA). See <<<jopt-simple-eclipse-formatting.xml>>> and <<<jopt-simple.importorder>>> in the project root. - - The ultimate arbiter of good style is Paul Holser. - -** Braces - - * Yes: - -+----+ -for (int i = 0; i < 10; ++i) { - if (i < 5) - println(i); -} -+----+ - - * No: - -+----+ -for (int i = 0; i < 10; ++i) - if (i < 5) - println(i); -+----+ - -* {{Building}} - - There are no integration tests. Your typical command line is: - -+----+ -$ mvn clean test -+----+ - - Before pushing commits, please check that the site fully builds: - -+----+ -$ mvn clean post-site -+----+ diff --git a/third_party/java/jopt-simple/src/site/apt/download.apt.vm b/third_party/java/jopt-simple/src/site/apt/download.apt.vm deleted file mode 100644 index dde9015f5e..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/download.apt.vm +++ /dev/null @@ -1,26 +0,0 @@ - -------- - Download - -------- - - Releases of JOpt Simple are synced to the central Maven repository. Declare a - dependency element in your POM like so: - -+--------------------------------------------- -... -<dependencies> - ... - <dependency> - <groupId>net.sf.jopt-simple</groupId> - <artifactId>jopt-simple</artifactId> - <version>${project.version}</version> - </dependency> - ... -</dependencies> -... -+--------------------------------------------- - - If you're not using Maven, you can still download the newer releases from the Maven - repository manually, {{{http://repo1.maven.org/maven2/net/sf/jopt-simple/jopt-simple} here}}. - - You can find older releases at - {{{http://sourceforge.net/project/showfiles.php?group_id=125731} SourceForge}}. diff --git a/third_party/java/jopt-simple/src/site/apt/examples.apt b/third_party/java/jopt-simple/src/site/apt/examples.apt deleted file mode 100644 index 3b43dee995..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/examples.apt +++ /dev/null @@ -1,462 +0,0 @@ - ----------------- - Examples of Usage - ----------------- - -Preamble - - The simplicity in JOpt "Simple" arises from two guiding principles: - - * Stick as often as possible to supporting conventional Unix option syntaxes. - - * Keep the surface area of the published API as small and simple as possible. - - [] - - To the first principle: You will not see support in JOpt Simple for option "groups", - alternative option prefixes (<<<+>>>, <<</>>>), enforced multiplicity of option - arguments, etc. JOpt Simple believes you can create a useful and understandable CLI - without all that stuff. If you feel as though you need any of those features, there - are lots of other choices out there. The author of JOpt Simple believes you'll want - to leverage its easy configuration, parsing, and option interrogation APIs instead of - using more feature-laden, but perhaps more confusing libraries. - - To the second principle: JOpt Simple will make every attempt to keep the API free - of clutter. The API is well factored, making it intuitive to use, and the entire - library is well tested, making it more reliable and predictable. If you cannot look - at the Javadoc and quickly get a sense of what you need to do to use JOpt Simple, - then JOpt Simple has failed. So by all means, let the author know what needs - improved. - - With that said, let's take a tour through JOpt Simple's features. - -Options - - JOpt Simple supports short options and long options, using a syntax that attempts to - take from the best of POSIX <<<getopt()>>> and GNU <<<getopt_long()>>>. - -* Short Options - - Short options begin with a single hyphen (<<<->>>) followed by a single letter or - digit, or question mark (<<<?>>>), or dot (<<<.>>>). - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - When you construct an <<<OptionParser>>> with a string of short option characters, - you configure that parser to recognize the options with those characters. - -** Arguments of Options - - Short options can accept single arguments. The argument can be made required or - optional. When you construct an <<<OptionParser>>> with a string of short option - characters, append a single colon (<<<:>>>) to an option character to configure - that option to require an argument. Append two colons (<<<::>>>) to an option - character to configure that option to accept an optional argument. Append an - asterisk (<<<*>>>) to an option character, but before any "argument" indicators, - to configure that option as a "help" option. - - The syntax of the option specification string given to the <<<OptionParser>>> - constructor should look familiar to you if you have used GNU's <<<getopt()>>> - before. - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_WITH_ARGUMENTS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -*** Specifying Arguments for a Short Option on the Command Line - - A short option's argument can occur: - - * in the position on the command line after the option - - * right up against the option - - * right up against the option separated by an equals sign (<<<=>>>) - - [] - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_WITH_ARGUMENT_POSITIONING_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -*** Multiple Arguments for a Single Option - - To specify <n> arguments for a single option, specify the option <n> times on the - command line, once for each argument. JOpt Simple reports the arguments given to the - option in the order in which they were encountered on the command line. - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_WITH_MULTIPLE_ARGUMENTS_FOR_SINGLE_OPTION_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Clustering Short Options - - Short options can be <clustered> in a single argument. - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_CLUSTERING_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - If one of the short options can accept an argument, the remaining characters are interpreted - as the argument for that option. - -+---------------------------------------------------------------------------------------- -@SHORT_OPTIONS_CLUSTERING_WITH_ARGUMENT_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -* Long Options/Fluent Interface - - Long options begin with two hyphens (<<<-->>>), followed by multiple letters, - digits, hyphens, question marks, or dots. A hyphen cannot be the first character of - a long option specification when configuring the parser. - - Whereas short options can be configured using a constructor argument to - <<<OptionParser>>>, both long and short options can be configured using a "fluent - interface" API, that enables some very descriptive and powerful features. - -+---------------------------------------------------------------------------------------- -@LONG_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Arguments of Options - - Like short options, long options can accept single arguments. The argument can be - made required or optional. Use the methods <<<withRequiredArg()>>> and - <<<withOptionalArg()>>> on the return value of <<<OptionParser.accepts()>>> to signal - that an option takes a required or optional argument. - -+---------------------------------------------------------------------------------------- -@LONG_OPTIONS_WITH_ARGUMENTS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Abbreviating Long Options - - Notice in the example above that the command line uses abbreviations of command line - options. You can abbreviate options so long as the abbreviation is unambiguous. - Even though you can abbreviate the options on the command line, you cannot address - the <<<OptionSet>>> using those abbreviations. You can use a special constructor - for the <<<OptionParser>>> that turns off abbreviation matching. - -** Using Single Hyphen on Long Options - - As demonstrated in the example above, you can use a single hyphen instead of a - double hyphen to specify a long option -- but be careful that doing so doesn't - introduce ambiguity. - -*** Specifying Arguments for a Long Option on the Command Line - - A long option's argument can occur: - - * in the position on the command line after the option - - * right up against the option separated by an equals sign (<<<=>>>) - - [] - -+---------------------------------------------------------------------------------------- -@LONG_OPTIONS_WITH_ARGUMENT_POSITIONING_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -*** Multiple Arguments for a Single Option - - Specify multiple arguments for a long option in the same manner as for short options - (see above). - -** Alternative Form of Long Options - - The option <<<-W>>> is reserved. If you tell the parser to recognize alternative - long options, then it will treat, for example, <<<-W foo=bar>>> as the long option - <<<foo>>> with argument bar, as though you had written <<<--foo=bar>>>. - - You can specify <<<-W>>> as a valid short option, or use it as an abbreviation for a - long option, but recognizing alternative long options will always supersede this - behavior. - - To recognize alternative long options, either construct an <<<OptionParser>>> with a - string of short option characters containing the sequence <<<W;>>> (a capital W - followed by a semicolon), or call the method - <<<OptionParser.recognizeAlternativeLongOptions()>>>. - -+---------------------------------------------------------------------------------------- -@ALTERNATIVE_LONG_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -* Other Features - -** Converting Option Arguments to Other Types - - Without action other than the <<<with*Arg()>>> methods, arguments of options are - returned as <<<String>>>s. For backwards compatibility, - <<<OptionSet.valueOf(String)>>> and <<<OptionSet.valuesOf(String)>>> return - <<<Object>>> and <<<List<?>>>>, respectively, so to get the values out as - <<<String>>>s, you will need to downcast the results of those methods. - - You can tell JOpt Simple to convert the arguments of options to different Java types - via the <<<ofType()>>> method on the return value of <<<with*Arg()>>>. The - <<<Class>>> argument of <<<ofType()>>> must represent a Java class that has either: - - * a <<<public static>>> method called <<<valueOf()>>> which accepts a single - <<<String>>> argument and whose return type is the type itself, or - - * a <<<public>>> constructor which takes a single <<<String>>> argument. - - [] - - If the class has both, the <<<valueOf()>>> method is used. - - Note that <<<enum>>>s have a <<<valueOf()>>> method. - -+---------------------------------------------------------------------------------------- -@OPTION_ARGUMENT_VALUE_TYPE_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - Another way to convert arguments of options is to specify a converter object via - <<<withValuesConvertedBy()>>>. This is useful when the desired type for the arguments - does not meet the requirements that <<<ofType()>>> sets forth. Such objects may not - perform any "conversion" at all, but rather can validate that arguments conform to - certain restrictions before passing through as-is. - - You can also do this for the non-option arguments of your command line, if you desire - to treat them all as a single type. - -+---------------------------------------------------------------------------------------- -@OPTION_ARGUMENT_CONVERTER_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Retrieving Arguments of Options in a Type-Safe Manner - - In the previous examples, we have been discarding the return values of the methods - of JOpt Simple's fluent interface. If instead you retain them in variables of type - <<<OptionSpec>>>, you can use them to retrieve arguments of options in a type-safe - manner. - - You can also do this for the non-option arguments of your command line, if you desire - to treat them all as a single type. - -+---------------------------------------------------------------------------------------- -@TYPESAFE_OPTION_ARGUMENT_RETRIEVAL_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Exporting Options and Arguments to other Code - - As an integration aid for other libraries, you can use <<<OptionSet.asMap()>>> to - obtain a mapping of <<<OptionSpec>>> to option values, for example to create a - properties map of options. - - Here is sample code to create properties whose keys have a common prefix. The key is - choosen as the first non-short option: - -+---------------------------------------------------------------------------------------- -@EXPORTING_OPTIONS_AND_ARGUMENTS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Default Values for Option Arguments - - Often it is convenient to specify default values for the arguments of certain - command line options. To do this, call the <<<defaultsTo()>>> method. - -+---------------------------------------------------------------------------------------- -@DEFAULT_VALUES_FOR_OPTION_ARGUMENTS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - You can see that <<<defaultsTo()>>> should relieve you of the burden of having to - check <<<has()>>> and/or <<<hasArgument()>>> on an <<<OptionSet>>> for a given option, - and has no bearing on the return values of those methods. Specifying a default value - for an option with a required argument does not mean that you can elide an argument for - the option on the command line. - - The type of values <<<defaultsTo()>>> expects is dictated by the class given by a - previous call to <<<ofType()>>> or <<<withValuesConvertedBy()>>>; if no such call has - been made, the type is <<<String>>>. - -** "Required" Options - - You can indicate that a given option must be present on the command line via the - <<<required()>>> method. Only options that accept arguments can be made "required". - - An option designated as a "help" option via <<<forHelp()>>>, when present on the - command line, causes missing "required" options not to reject the command line. - -+---------------------------------------------------------------------------------------- -@REQUIRED_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** "Required" Dependent Options - - You can indicate that a given option must be present on the command line if some - other option is present on the command line via the <<<requiredIf()>>> method. - Any option can be made "required if". - - An option designated as a "help" option via <<<forHelp()>>>, when present on the - command line, causes missing "required if" options not to reject the command line. - -+---------------------------------------------------------------------------------------- -@REQUIRED_IF_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - You can also indicate that a given option must be present on the command line if some - other option is NOT present on the command line via the <<<requiredUnless()>>> method. - Any option can be made "required unless", but, to avoid potential conflicts, it should - not be "required if" at the same time. - -+---------------------------------------------------------------------------------------- -@REQUIRED_UNLESS_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** "Available" Dependent Options - - Similarly to <<<requiredIf()>>> and <<<requiredUnless()>>>, you can indicate that a - given option can be present on the command line only if/unless some other option is - present on the command line, via the <<<availableIf()>>> and <<<availableUnless()>>> - methods. - - -** Synonyms of Options - - Sometimes it is useful to allow many different options to share the same meaning in - the program that uses them. To specify that options are to be treated as synonymous, - use the <<<acceptsAll()>>> method of <<<OptionParser>>>. - -+---------------------------------------------------------------------------------------- -@OPTION_SYNONYM_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Concise Specification of Multiple Arguments for an Option - - Another way to specify multiple arguments for an option is to tell the parser to - treat a single argument containing multiple delimited values as multiple arguments - for the option using the <<<withValuesSeparatedBy()>>> method. - -+---------------------------------------------------------------------------------------- -@MULTIPLE_DELIMITED_ARGUMENTS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Signalling End of Options - - An argument consisting only of two hyphens (<<<-->>>) signals that the remaining - arguments are to be treated as non-options. - - An argument consisting only of a single hyphen is considered a non-option argument - (though it can be an argument of an option). Many Unix programs treat single hyphens - as stand-ins for the standard input or standard output stream. - -*** Non-Option Arguments - - Any arguments which are not options or arguments of options can be retrieved via - method <<<nonOptionArguments()>>> on <<<OptionSet>>>. If the double hyphen is an - argument, it is ignored and is not a non-option argument. - -+---------------------------------------------------------------------------------------- -@SIGNALLING_END_OF_OPTIONS_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** "POSIX-ly Correct"-ness - - By default, as with GNU <<<getopt()>>>, JOpt Simple allows intermixing of options and - non-options. If, however, the parser has been created to be "POSIX-ly correct", then - the first argument that does not look lexically like an option, and is not a required - argument of a preceding option, signals the end of options. You can still bind - optional arguments to their options using the abutting (for short options) or - <<<=>>> syntax. - - Unlike GNU <<<getopt()>>>, JOptSimple does not honor the environment variable - <<<POSIXLY_CORRECT>>>. "POSIX-ly correct" parsers are configured by either: - - * using the method <<<OptionParser.posixlyCorrect()>>> - - * using the <<<OptionParser>>> constructor with an argument whose first character is - a plus sign (<<<+>>>) - - [] - -+---------------------------------------------------------------------------------------- -@POSIXLY_CORRECT_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -** Special Optional Argument Handling - - If the parser detects an option whose argument is optional, and the next argument - "looks like" an option, that argument is not treated as the argument to the option, - but as a potentially valid option. If, on the other hand, the optional argument is - typed as a derivative of <<<Number>>>, then that argument is treated as the negative - number argument of the option, even if the parser recognizes the corresponding numeric - option. - -+---------------------------------------------------------------------------------------- -@SPECIAL_OPTIONAL_ARGUMENT_HANDLING_EXAMPLE@ -+---------------------------------------------------------------------------------------- - -Generating Command Line Help - - When you call method <<<OptionParser.printHelpOn()>>>, JOpt Simple will write a - help screen (80-column width) describing all the options it is configured with, - along with types of option arguments, whether the option is required (in angle - brackets) or optional (in square brackets), etc. To give an option a description, - use <<<OptionParser.accepts*()>>> with a description argument. To give an option - argument a description, use <<<describedAs()>>> on the return value of - <<<with*Arg()>>>. - -+---------------------------------------------------------------------------------------- -@HELP_SCREEN_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - Here is what the help screen looks like for the example above: - -+---------------------------------------------------------------------------------------- -@HELP_SCREEN_EXAMPLE_HELP@ -+---------------------------------------------------------------------------------------- - - If you want to create your own help screen, give method - <<<OptionParser.formatHelpWith()>>> a <<<HelpFormatter>>> that builds the help screen - as a String. When you call <<<OptionParser.printHelpOn()>>>, JOpt Simple will use - your <<<HelpFormatter>>> to produce the help and write it to the given stream. - - For example, this program: - -+---------------------------------------------------------------------------------------- -@HELP_FORMATTER_EXAMPLE@ -+---------------------------------------------------------------------------------------- - - yields the following output: - -+---------------------------------------------------------------------------------------- -@HELP_FORMATTER_EXAMPLE_OUTPUT@ -+---------------------------------------------------------------------------------------- - -Handling Exceptions - - JOpt Simple's classes raise some derivative of <<<OptionException>>> if they encounter - problems during parsing. These exceptions are unchecked, so you don't have to do - anything with such an exception if you don't want to. The rationale behind this - decision is that you will most likely be invoking JOpt Simple's functionality from a - <<<main()>>> method or very near to it, where a failure such as unrecognized arguments - can just stop down the JVM and yield a stack trace without much user or programmer - inconvenience. So, without any exception handling at all, a user would see something - like this: - -+---------------------------------------------------------------------------------------- -@EXAMPLE_STACK_TRACE@ -+---------------------------------------------------------------------------------------- - - If you want to handle the exception yourself, you can catch <<<OptionException>>> in - your code, and do whatever you please with the contents of the exception, perhaps - using the help generation facility. - -* Suppressing <<<UnrecognizedOptionException>>> - - Sometimes you want to ignore unrecognized options on the command line. - - For example, you might be interested in handling only a part of the arguments given. - Or you might want to pass on options to another program and not bother the user with - providing two hyphens (<<<-->>>) to indicate the end of known options. Or maybe - you want to provide future forwards/backwards compatibility when you foresee passing - in new options to old code (or old code invoking new code with "old" arguments). - - You can achieve this by using the method <<<OptionParser.allowsUnrecognizedOptions()>>>. - When you call this method, then any unrecognized options handed to <<<parse()>>> are - treated as non-option arguments, rather than causing an exception to be raised. - -+---------------------------------------------------------------------------------------- -@UNRECOGNIZED_OPTIONS_ALLOWED_EXAMPLE@ -+---------------------------------------------------------------------------------------- diff --git a/third_party/java/jopt-simple/src/site/apt/index.apt b/third_party/java/jopt-simple/src/site/apt/index.apt deleted file mode 100644 index 88c2af858d..0000000000 --- a/third_party/java/jopt-simple/src/site/apt/index.apt +++ /dev/null @@ -1,71 +0,0 @@ - ----------- - JOpt Simple - ----------- - - JOpt Simple is a Java library for parsing command line options, such as those you - might pass to an invocation of <<<javac>>>. - - In the interest of striving for simplicity, as closely as possible JOpt Simple - attempts to honor the command line option syntaxes of - {{{http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html} POSIX <<<getopt()>>>}} - and - GNU {{{http://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html} <<<getopt_long()>>>}}. - It also aims to make option parser configuration and retrieval of options and their - arguments simple and expressive, without being overly clever. - - Here are some libraries that perform the same duties as JOpt Simple: - - * {{{http://jargs.sourceforge.net} JArgs}} - - * {{{http://jakarta.apache.org/commons/cli/} Jakarta Commons CLI}} - - * {{{http://te-code.sourceforge.net/} TE-Code}} has a command line parsing library. - - * {{{http://www.cs.ubc.ca/spider/lloyd/java/argparser.html} argparser}} - - * {{{http://www.urbanophile.com/arenn/hacking/download.html} Java port of GNU getopt}} - - * {{{https://args4j.dev.java.net/} Args4J}} - - * {{{http://www.martiansoftware.com/jsap/} JSAP}} - - * {{{http://clajr.sourceforge.net} CLAJR}} - - * {{{http://ostermiller.org/utils/CmdLn.html} CmdLn}} - - * {{{http://jewelcli.sourceforge.net} JewelCli}} - - * {{{http://jcommando.sourceforge.net} JCommando}} - - * {{{http://code.google.com/p/parse-cmd/} parse-cmd}} - - * {{{http://jcommander.org} JCommander}} - - * {{{http://types.cs.washington.edu/plume-lib/api/plume/Options.html} plume-lib Options}} - - [] - - I hope you'll agree that JOpt Simple tops them all in ease of use and cleanliness of - code (although I admire JewelCli quite a bit). - - I'd love to hear your constructive {{{mailto:pholser@alumni.rice.edu} feedback}}, - especially suggestions for improvements to the library or the site! If your project - is using JOpt Simple, do let me know. - -Projects Using JOpt Simple - - Here are some we know of or have known of: - - * {{{http://openjdk.java.net/} OpenJDK}}. - From {{{http://weblogs.java.net/blog/mreinhold/} Mark Reinhold}}: "I thought you might - be interested to know that we're using your jopt-simple library in the open-source - Java Development Kit. Thanks for writing such a nice little library! It's far - cleaner than any of the other alternatives out there." - - * {{{http://www.gradle.org/} Gradle}} - - * {{{http://natbraille.free.fr} NATBraille}} - - * {{{https://minecraft.net} Minecraft}} - - [] diff --git a/third_party/java/jopt-simple/src/site/resources/css/prettify.css b/third_party/java/jopt-simple/src/site/resources/css/prettify.css deleted file mode 100644 index f8c7db2a96..0000000000 --- a/third_party/java/jopt-simple/src/site/resources/css/prettify.css +++ /dev/null @@ -1,49 +0,0 @@ -/* Pretty printing styles. Used with prettify.js. */ - -.str { color: #080; } -.kwd { color: #008; } -.com { color: #800; } -.typ { color: #606; } -.lit { color: #066; } -.pun { color: #660; } -.pln { color: #000; } -.tag { color: #008; } -.atn { color: #606; } -.atv { color: #080; } -.dec { color: #606; } - -pre.prettyprint { - padding: 2px; - border: 1px solid #888; -} - -@media print { - .str { color: #060; } - - .kwd { - color: #006; - font-weight: bold; - } - - .com { - color: #600; - font-style: italic; - } - - .typ { - color: #404; - font-weight: bold; - } - - .lit { color: #044; } - .pun { color: #440; } - .pln { color: #000; } - - .tag { - color: #006; - font-weight: bold; - } - - .atn { color: #404; } - .atv { color: #060; } -} diff --git a/third_party/java/jopt-simple/src/site/resources/images/jopt-simple-logo.png b/third_party/java/jopt-simple/src/site/resources/images/jopt-simple-logo.png Binary files differdeleted file mode 100644 index 4a3f707d7a..0000000000 --- a/third_party/java/jopt-simple/src/site/resources/images/jopt-simple-logo.png +++ /dev/null diff --git a/third_party/java/jopt-simple/src/site/resources/scripts/prettify.js b/third_party/java/jopt-simple/src/site/resources/scripts/prettify.js deleted file mode 100644 index de1e07ffd3..0000000000 --- a/third_party/java/jopt-simple/src/site/resources/scripts/prettify.js +++ /dev/null @@ -1,1602 +0,0 @@ -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview - * some functions for browser-side pretty printing of code contained in html. - * - * The lexer should work on a number of languages including C and friends, - * Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. - * It works passably on Ruby, PHP and Awk and a decent subset of Perl, but, - * because of commenting conventions, doesn't work on Smalltalk, Lisp-like, or - * CAML-like languages. - * - * If there's a language not mentioned here, then I don't know it, and don't - * know whether it works. If it has a C-like, Bash-like, or XML-like syntax - * then it should work passably. - * - * Usage: - * 1) include this source file in an html page via - * <script type="text/javascript" src="/path/to/prettify.js"></script> - * 2) define style rules. See the example page for examples. - * 3) mark the <pre> and <code> tags in your source with class=prettyprint. - * You can also use the (html deprecated) <xmp> tag, but the pretty printer - * needs to do more substantial DOM manipulations to support that, so some - * css styles may not be preserved. - * That's it. I wanted to keep the API as simple as possible, so there's no - * need to specify which language the code is in. - * - * Change log: - * cbeust, 2006/08/22 - * Java annotations (start with "@") are now captured as literals ("lit") - */ - -var PR_keywords = {}; -/** initialize the keyword list for our target languages. */ -(function () { - var CPP_KEYWORDS = "abstract bool break case catch char class const " + - "const_cast continue default delete deprecated dllexport dllimport do " + - "double dynamic_cast else enum explicit extern false float for friend " + - "goto if inline int long mutable naked namespace new noinline noreturn " + - "nothrow novtable operator private property protected public register " + - "reinterpret_cast return selectany short signed sizeof static " + - "static_cast struct switch template this thread throw true try typedef " + - "typeid typename union unsigned using declaration, directive uuid " + - "virtual void volatile while typeof"; - var CSHARP_KEYWORDS = "as base by byte checked decimal delegate descending " + - "event finally fixed foreach from group implicit in interface internal " + - "into is lock null object out override orderby params readonly ref sbyte " + - "sealed stackalloc string select uint ulong unchecked unsafe ushort var"; - var JAVA_KEYWORDS = "package synchronized boolean implements import throws " + - "instanceof transient extends final strictfp native super"; - var JSCRIPT_KEYWORDS = "debugger export function with NaN Infinity"; - var PERL_KEYWORDS = "require sub unless until use elsif BEGIN END"; - var PYTHON_KEYWORDS = "and assert def del elif except exec global lambda " + - "not or pass print raise yield False True None"; - var RUBY_KEYWORDS = "then end begin rescue ensure module when undef next " + - "redo retry alias defined"; - var SH_KEYWORDS = "done fi"; - - var KEYWORDS = [CPP_KEYWORDS, CSHARP_KEYWORDS, JAVA_KEYWORDS, - JSCRIPT_KEYWORDS, PERL_KEYWORDS, PYTHON_KEYWORDS, - RUBY_KEYWORDS, SH_KEYWORDS]; - for ( var k = 0; k < KEYWORDS.length; k++ ) { - var kw = KEYWORDS[k].split(' '); - for ( var i = 0; i < kw.length; i++ ) { - if ( kw[i] ) { - PR_keywords[kw[i]] = true; - } - } - } -}).call(this); - -// token style names. correspond to css classes -/** token style for a string literal */ -var PR_STRING = 'str'; -/** token style for a keyword */ -var PR_KEYWORD = 'kwd'; -/** token style for a comment */ -var PR_COMMENT = 'com'; -/** token style for a type */ -var PR_TYPE = 'typ'; -/** token style for a literal value. e.g. 1, null, true. */ -var PR_LITERAL = 'lit'; -/** token style for a punctuation string. */ -var PR_PUNCTUATION = 'pun'; -/** token style for a punctuation string. */ -var PR_PLAIN = 'pln'; - -/** token style for an sgml tag. */ -var PR_TAG = 'tag'; -/** token style for a markup declaration such as a DOCTYPE. */ -var PR_DECLARATION = 'dec'; -/** token style for embedded source. */ -var PR_SOURCE = 'src'; -/** token style for an sgml attribute name. */ -var PR_ATTRIB_NAME = 'atn'; -/** token style for an sgml attribute value. */ -var PR_ATTRIB_VALUE = 'atv'; - -/** the number of characters between tab columns */ -var PR_TAB_WIDTH = 8; - -/** the position of the end of a token during. A division of a string into - * n tokens can be represented as a series n - 1 token ends, as long as - * runs of whitespace warrant their own token. - * @private - */ -function PR_TokenEnd( end, style ) { - if ( undefined === style ) { - throw new Error('BAD'); - } - if ( 'number' != typeof(end) ) { - throw new Error('BAD'); - } - this.end = end; - this.style = style; -} -PR_TokenEnd.prototype.toString = function () { - return '[PR_TokenEnd ' + this.end + - (this.style ? ':' + this.style : '') + ']'; -}; - -/** a chunk of text with a style. These are used to represent both the output - * from the lexing functions as well as intermediate results. - * @constructor - * @param token the token text - * @param style one of the token styles defined in designdoc-template, or null - * for a styleless token, such as an embedded html tag. - * @private - */ -function PR_Token( token, style ) { - if ( undefined === style ) { - throw new Error('BAD'); - } - this.token = token; - this.style = style; -} - -PR_Token.prototype.toString = function () { - return '[PR_Token ' + this.token + (this.style ? ':' + this.style : '') + ']'; -}; - -/** a helper class that decodes common html entities used to escape special - * characters in source code. - * @constructor - * @private - */ -function PR_DecodeHelper() { - this.next = 0; - this.ch = '\0'; -} - -var PR_NAMED_ENTITIES = { - 'lt': '<', - 'gt': '>', - 'quot': '"', - 'apos': "'", - 'amp': '&' // reencoding requires that & always be decoded properly -}; - -PR_DecodeHelper.prototype.decode = function ( s, i ) { - var next = i + 1; - var ch = s.charAt(i); - if ( '&' === ch ) { - var semi = s.indexOf(';', next); - if ( semi >= 0 && semi < next + 4 ) { - var entityName = s.substring(next, semi); - var decoded = null; - if ( entityName.charAt(0) === '#' ) { // check for numeric entity - var ch1 = entityName.charAt(1); - var charCode; - if ( ch1 === 'x' || ch1 === 'X' ) { // like   - charCode = parseInt(entityName.substring(2), 16); - } - else { // like   - charCode = parseInt(entityName.substring(1), 10); - } - if ( !isNaN(charCode) ) { - decoded = String.fromCharCode(charCode); - } - } - if ( !decoded ) { - decoded = PR_NAMED_ENTITIES[entityName.toLowerCase()]; - } - if ( decoded ) { - ch = decoded; - next = semi + 1; - } - else { // skip over unrecognized entity - next = i + 1; - ch = '\0'; - } - } - } - this.next = next; - this.ch = ch; - return this.ch; -}; - -// some string utilities -function PR_isWordChar( ch ) { - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); -} - -function PR_isIdentifierStart( ch ) { - return PR_isWordChar(ch) || ch == '_' || ch == '$' || ch == '@'; -} - -function PR_isIdentifierPart( ch ) { - return PR_isIdentifierStart(ch) || PR_isDigitChar(ch); -} - -function PR_isSpaceChar( ch ) { - return "\t \r\n".indexOf(ch) >= 0; -} - -function PR_isDigitChar( ch ) { - return ch >= '0' && ch <= '9'; -} - -function PR_trim( s ) { - var i = 0, j = s.length - 1; - while ( i <= j && PR_isSpaceChar(s.charAt(i)) ) { - ++i; - } - while ( j > i && PR_isSpaceChar(s.charAt(j)) ) { - --j; - } - return s.substring(i, j + 1); -} - -function PR_startsWith( s, prefix ) { - return s.length >= prefix.length && prefix == s.substring(0, prefix.length); -} - -function PR_endsWith( s, suffix ) { - return s.length >= suffix.length && - suffix == s.substring(s.length - suffix.length, s.length); -} - -/** true iff prefix matches the first prefix characters in chars[0:len]. - * @private - */ -function PR_prefixMatch( chars, len, prefix ) { - if ( len < prefix.length ) { - return false; - } - for ( var i = 0, n = prefix.length; i < n; ++i ) { - if ( prefix.charAt(i) != chars[i] ) { - return false; - } - } - return true; -} - -/** like textToHtml but escapes double quotes to be attribute safe. */ -function PR_attribToHtml( str ) { - return str.replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/\"/g, '"') - .replace(/\xa0/, ' '); -} - -/** escapest html special characters to html. */ -function PR_textToHtml( str ) { - return str.replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/\xa0/g, ' '); -} - -/** is the given node's innerHTML normally unescaped? */ -function PR_isRawContent( node ) { - return 'XMP' == node.tagName; -} - -var PR_innerHtmlWorks = null; -function PR_getInnerHtml( node ) { - // inner html is hopelessly broken in Safari 2.0.4 when the content is - // an html description of well formed XML and the containing tag is a PRE - // tag, so we detect that case and emulate innerHTML. - if ( null == PR_innerHtmlWorks ) { - var testNode = document.createElement('PRE'); - testNode.appendChild( - document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')); - PR_innerHtmlWorks = !/</.test(testNode.innerHTML); - } - - if ( PR_innerHtmlWorks ) { - var content = node.innerHTML; - // XMP tags contain unescaped entities so require special handling. - if ( PR_isRawContent(node) ) { - content = PR_textToHtml(content); - } - return content; - } - - var out = []; - for ( var child = node.firstChild; child; child = child.nextSibling ) { - PR_normalizedHtml(child, out); - } - return out.join(''); -} - -/** - * walks the DOM returning a properly escaped version of innerHTML. - */ -function PR_normalizedHtml( node, out ) { - switch ( node.nodeType ) { - case 1: // an element - var name = node.tagName.toLowerCase(); - out.push('\074', name); - for ( var i = 0; i < node.attributes.length; ++i ) { - var attr = node.attributes[i]; - if ( !attr.specified ) { - continue; - } - out.push(' '); - PR_normalizedHtml(attr, out); - } - out.push('>'); - for ( var child = node.firstChild; child; child = child.nextSibling ) { - PR_normalizedHtml(child, out); - } - if ( node.firstChild || !/^(?:br|link|img)$/.test(name) ) { - out.push('<\/', name, '>'); - } - break; - case 2: // an attribute - out.push(node.name.toLowerCase(), '="', PR_attribToHtml(node.value), '"'); - break; - case 3: case 4: // text - out.push(PR_textToHtml(node.nodeValue)); - break; - } -} - -/** expand tabs to spaces - * @param {Array} chunks PR_Tokens possibly containing tabs - * @param {Number} tabWidth number of spaces between tab columns - * @return {Array} chunks with tabs replaced with spaces - */ -function PR_expandTabs( chunks, tabWidth ) { - var SPACES = ' '; - - var charInLine = 0; - var decodeHelper = new PR_DecodeHelper(); - - var chunksOut = [] - for ( var chunkIndex = 0; chunkIndex < chunks.length; ++chunkIndex ) { - var chunk = chunks[chunkIndex]; - if ( chunk.style == null ) { - chunksOut.push(chunk); - continue; - } - - var s = chunk.token; - var pos = 0; - // index of last character output - var out = []; - - // walk over each character looking for tabs and newlines. - // On tabs, expand them. On newlines, reset charInLine. - // Otherwise increment charInLine - for ( var charIndex = 0, n = s.length; charIndex < n; - charIndex = decodeHelper.next ) { - decodeHelper.decode(s, charIndex); - var ch = decodeHelper.ch; - - switch ( ch ) { - case '\t': - out.push(s.substring(pos, charIndex)); - // calculate how much space we need in front of this part - // nSpaces is the amount of padding -- the number of spaces needed to - // move us to the next column, where columns occur at factors of - // tabWidth. - var nSpaces = tabWidth - (charInLine % tabWidth); - charInLine += nSpaces; - for ( ; nSpaces >= 0; nSpaces -= SPACES.length ) { - out.push(SPACES.substring(0, nSpaces)); - } - pos = decodeHelper.next; - break; - case '\n': case '\r': - charInLine = 0; - break; - default: - ++charInLine; - } - } - out.push(s.substring(pos)); - chunksOut.push(new PR_Token(out.join(''), chunk.style)); - } - return chunksOut -} - -/** split markup into chunks of html tags (style null) and - * plain text (style {@link #PR_PLAIN}). - * - * @param {String} s html. - * @return {Array} of PR_Tokens of style PR_PLAIN, and null. - * @private - */ -function PR_chunkify( s ) { - // The below pattern matches one of the following - // (1) /[^<]+/ : A run of characters other than '<' - // (2) /<\/?[a-zA-Z][^>]*>/ : A probably tag that should not be highlighted - // (3) /</ : A '<' that does not begin a larger chunk. Treated as 1 - var chunkPattern = /(?:[^<]+|<\/?[a-zA-Z][^>]*>|<)/g; - // since the pattern has the 'g' modifier and defines no capturing groups, - // this will return a list of all chunks which we then classify and wrap as - // PR_Tokens - var matches = s.match(chunkPattern); - var chunks = []; - if ( matches ) { - var lastChunk = null; - for ( var i = 0, n = matches.length; i < n; ++i ) { - var chunkText = matches[i]; - var style; - if ( chunkText.length < 2 || chunkText.charAt(0) !== '<' ) { - if ( lastChunk && lastChunk.style === PR_PLAIN ) { - lastChunk.token += chunkText; - continue; - } - style = PR_PLAIN; - } - else { // a tag - style = null; - } - lastChunk = new PR_Token(chunkText, style); - chunks.push(lastChunk); - } - } - return chunks; -} - -/** walk the tokenEnds list and the chunk list in parallel to generate a list - * of split tokens. - * @private - */ -function PR_splitChunks( chunks, tokenEnds ) { - var tokens = []; - // the output - - var ci = 0; - // index into chunks - // position of beginning of amount written so far in absolute space. - var posAbs = 0; - // position of amount written so far in chunk space - var posChunk = 0; - - // current chunk - var chunk = new PR_Token('', null); - - for ( var ei = 0, ne = tokenEnds.length, lastEnd = 0; ei < ne; ++ei ) { - var tokenEnd = tokenEnds[ei]; - var end = tokenEnd.end; - if ( end === lastEnd ) { - continue; - } // skip empty regions - - var tokLen = end - posAbs; - var remainingInChunk = chunk.token.length - posChunk; - while ( remainingInChunk <= tokLen ) { - if ( remainingInChunk > 0 ) { - tokens.push( - new PR_Token(chunk.token.substring(posChunk, chunk.token.length), - null == chunk.style ? null : tokenEnd.style)); - } - posAbs += remainingInChunk; - posChunk = 0; - if ( ci < chunks.length ) { - chunk = chunks[ci++]; - } - - tokLen = end - posAbs; - remainingInChunk = chunk.token.length - posChunk; - } - - if ( tokLen ) { - tokens.push( - new PR_Token(chunk.token.substring(posChunk, posChunk + tokLen), - tokenEnd.style)); - posAbs += tokLen; - posChunk += tokLen; - } - } - - return tokens; -} - -/** splits markup tokens into declarations, tags, and source chunks. - * @private - */ -function PR_splitMarkup( chunks ) { - // A state machine to split out declarations, tags, etc. - // This state machine deals with absolute space in the text, indexed by k, - // and position in the current chunk, indexed by pos and tokenStart to - // generate a list of the ends of tokens. - // Absolute space is calculated by considering the chunks as appended into - // one big string, as they were before being split. - - // Known failure cases - // Server side scripting sections such as <?...?> in attributes. - // i.e. <span class="<? foo ?>"> - // Handling this would require a stack, and we don't use PHP. - - // The output: a list of pairs of PR_TokenEnd instances - var tokenEnds = []; - - var state = 0; - // FSM state variable - var k = 0; - // position in absolute space of the start of the current chunk - var tokenStart = -1; - // the start of the current token - - // Try to find a closing tag for any open <style> or <script> tags - // We can't do this at a later stage because then the following case - // would fail: - // <script>document.writeln('<!--');</script> - - // We use tokenChars[:tokenCharsI] to accumulate the tag name so that we - // can check whether to enter into a no scripting section when the tag ends. - var tokenChars = new Array(12); - var tokenCharsI = 0; - // if non null, the tag prefix that we need to see to break out. - var endScriptTag = null; - var decodeHelper = new PR_DecodeHelper(); - - for ( var ci = 0, nc = chunks.length; ci < nc; ++ci ) { - var chunk = chunks[ci]; - if ( PR_PLAIN != chunk.style ) { - k += chunk.token.length; - continue; - } - - var s = chunk.token; - var pos = 0; - // the position past the last character processed so far in s - - for ( var i = 0, n = s.length; i < n; /* i = next at bottom */ ) { - decodeHelper.decode(s, i); - var ch = decodeHelper.ch; - var next = decodeHelper.next; - - var tokenStyle = null; - switch ( state ) { - case 0: - if ( '<' == ch ) { - state = 1; - } - break; - case 1: - tokenCharsI = 0; - if ( '/' == ch ) { // only consider close tags if we're in script/style - state = 7; - } - else if ( null == endScriptTag ) { - if ( '!' == ch ) { - state = 2; - } - else if ( PR_isWordChar(ch) ) { - state = 8; - } - else if ( '?' == ch ) { - state = 9; - } - else if ( '%' == ch ) { - state = 11; - } - else if ( '<' != ch ) { - state = 0; - } - } - else if ( '<' != ch ) { - state = 0; - } - break; - case 2: - if ( '-' == ch ) { - state = 4; - } - else if ( PR_isWordChar(ch) ) { - state = 3; - } - else if ( '<' == ch ) { - state = 1; - } - else { - state = 0; - } - break; - case 3: - if ( '>' == ch ) { - state = 0; - tokenStyle = PR_DECLARATION; - } - break; - case 4: - if ( '-' == ch ) { - state = 5; - } - break; - case 5: - if ( '-' == ch ) { - state = 6; - } - break; - case 6: - if ( '>' == ch ) { - state = 0; - tokenStyle = PR_COMMENT; - } - else if ( '-' == ch ) { - state = 6; - } - else { - state = 4; - } - break; - case 7: - if ( PR_isWordChar(ch) ) { - state = 8; - } - else if ( '<' == ch ) { - state = 1; - } - else { - state = 0; - } - break; - case 8: - if ( '>' == ch ) { - state = 0; - tokenStyle = PR_TAG; - } - break; - case 9: - if ( '?' == ch ) { - state = 10; - } - break; - case 10: - if ( '>' == ch ) { - state = 0; - tokenStyle = PR_SOURCE; - } - else if ( '?' != ch ) { - state = 9; - } - break; - case 11: - if ( '%' == ch ) { - state = 12; - } - break; - case 12: - if ( '>' == ch ) { - state = 0; - tokenStyle = PR_SOURCE; - } - else if ( '%' != ch ) { - state = 11; - } - break; - } - - if ( tokenCharsI < tokenChars.length ) { - tokenChars[tokenCharsI++] = ch.toLowerCase(); - } - if ( 1 == state ) { - tokenStart = k + i; - } - i = next; - if ( tokenStyle != null ) { - if ( null != tokenStyle ) { - if ( endScriptTag ) { - if ( PR_prefixMatch(tokenChars, tokenCharsI, endScriptTag) ) { - endScriptTag = null; - } - } - else { - if ( PR_prefixMatch(tokenChars, tokenCharsI, 'script') ) { - endScriptTag = '/script'; - } - else if ( PR_prefixMatch(tokenChars, tokenCharsI, 'style') ) { - endScriptTag = '/style'; - } - else if ( PR_prefixMatch(tokenChars, tokenCharsI, 'xmp') ) { - endScriptTag = '/xmp'; - } - } - // disallow the tag if endScriptTag is set and this was not an open - // tag. - if ( endScriptTag && tokenCharsI && '/' == tokenChars[0] ) { - tokenStyle = null; - } - } - if ( null != tokenStyle ) { - tokenEnds.push(new PR_TokenEnd(tokenStart, PR_PLAIN)); - tokenEnds.push(new PR_TokenEnd(k + next, tokenStyle)); - } - } - } - k += chunk.token.length; - } - tokenEnds.push(new PR_TokenEnd(k, PR_PLAIN)); - - return tokenEnds; -} - -/** splits the given string into comment, string, and "other" tokens. - * @return {Array} of PR_Tokens with style in - * (PR_STRING, PR_COMMENT, PR_PLAIN, null) - * The result array may contain spurious zero length tokens. Ignore them. - * - * @private - */ -function PR_splitStringAndCommentTokens( chunks ) { - // a state machine to split out comments, strings, and other stuff - var tokenEnds = []; - // positions of ends of tokens in absolute space - var state = 0; - // FSM state variable - var delim = -1; - // string delimiter - var k = 0; - // absolute position of beginning of current chunk - - for ( var ci = 0, nc = chunks.length; ci < nc; ++ci ) { - var chunk = chunks[ci]; - var s = chunk.token; - if ( PR_PLAIN == chunk.style ) { - var decodeHelper = new PR_DecodeHelper(); - var last = -1; - var next; - for ( var i = 0, n = s.length; i < n; last = i,i = next ) { - decodeHelper.decode(s, i); - var ch = decodeHelper.ch; - next = decodeHelper.next; - if ( 0 == state ) { - if ( ch == '"' || ch == '\'' || ch == '`' ) { - tokenEnds.push(new PR_TokenEnd(k + i, PR_PLAIN)); - state = 1; - delim = ch; - } - else if ( ch == '/' ) { - state = 3; - } - else if ( ch == '#' ) { - tokenEnds.push(new PR_TokenEnd(k + i, PR_PLAIN)); - state = 4; - } - } - else if ( 1 == state ) { - if ( ch == delim ) { - state = 0; - tokenEnds.push(new PR_TokenEnd(k + next, PR_STRING)); - } - else if ( ch == '\\' ) { - state = 2; - } - } - else if ( 2 == state ) { - state = 1; - } - else if ( 3 == state ) { - if ( ch == '/' ) { - state = 4; - tokenEnds.push(new PR_TokenEnd(k + last, PR_PLAIN)); - } - else if ( ch == '*' ) { - state = 5; - tokenEnds.push(new PR_TokenEnd(k + last, PR_PLAIN)); - } - else { - state = 0; - // next loop will reenter state 0 without same value of i, so - // ch will be reconsidered as start of new token. - next = i; - } - } - else if ( 4 == state ) { - if ( ch == '\r' || ch == '\n' ) { - state = 0; - tokenEnds.push(new PR_TokenEnd(k + i, PR_COMMENT)); - } - } - else if ( 5 == state ) { - if ( ch == '*' ) { - state = 6; - } - } - else if ( 6 == state ) { - if ( ch == '/' ) { - state = 0; - tokenEnds.push(new PR_TokenEnd(k + next, PR_COMMENT)); - } - else if ( ch != '*' ) { - state = 5; - } - } - } - } - k += s.length; - } - var endTokenType; - switch ( state ) { - case 1: case 2: - endTokenType = PR_STRING; - break; - case 4: case 5: case 6: - endTokenType = PR_COMMENT; - break; - default: - endTokenType = PR_PLAIN; - break; - } - // handle unclosed token which can legally happen for line comments (state 4) - tokenEnds.push(new PR_TokenEnd(k, endTokenType)); - // a token ends at the end - - return PR_splitChunks(chunks, tokenEnds); -} - -/** used by lexSource to split a non string, non comment token. - * @private - */ -function PR_splitNonStringNonCommentToken( s, outlist ) { - var pos = 0; - var state = 0; - - var decodeHelper = new PR_DecodeHelper(); - var next; - for ( var i = 0; i <= s.length; i = next ) { - if ( i == s.length ) { - // nstate will not be equal to state, so it will append the token - nstate = -2; - next = i + 1; - } - else { - decodeHelper.decode(s, i); - next = decodeHelper.next; - var ch = decodeHelper.ch; - - // the next state. - // if set to -1 then it will cause a reentry to state 0 without consuming - // another character. - var nstate = state; - - switch ( state ) { - case 0: // whitespace state - if ( PR_isIdentifierStart(ch) ) { - nstate = 1; - } - else if ( PR_isDigitChar(ch) ) { - nstate = 2; - } - else if ( !PR_isSpaceChar(ch) ) { - nstate = 3; - } - if ( nstate && pos < i ) { - var t = s.substring(pos, i); - outlist.push(new PR_Token(t, PR_PLAIN)); - pos = i; - } - break; - case 1: // identifier state - if ( !PR_isIdentifierPart(ch) ) { - nstate = -1; - } - break; - case 2: // number literal state - // handle numeric literals like - // 0x7f 300UL 100_000 - - // this does not treat floating point values as a single literal - // 0.1 and 3e-6 - // are each split into multiple tokens - if ( !(PR_isDigitChar(ch) || PR_isWordChar(ch) || ch == '_') ) { - nstate = -1; - } - break; - case 3: // punctuation state - if ( PR_isIdentifierStart(ch) || PR_isDigitChar(ch) || - PR_isSpaceChar(ch) ) { - nstate = -1; - } - break; - } - } - - if ( nstate != state ) { - if ( nstate < 0 ) { - if ( i > pos ) { - var t = s.substring(pos, i); - var wordDecodeHelper = new PR_DecodeHelper(); - wordDecodeHelper.decode(t, 0); - var ch0 = wordDecodeHelper.ch; - var isSingleCharacter = wordDecodeHelper.next == t.length; - var style; - if ( PR_isIdentifierStart(ch0) ) { - if ( PR_keywords[t] ) { - style = PR_KEYWORD; - } - else if ( ch0 === '@' ) { - style = PR_LITERAL; - } - else { - // Treat any word that starts with an uppercase character and - // contains at least one lowercase character as a type, or - // ends with _t. - // This works perfectly for Java, pretty well for C++, and - // passably for Python. The _t catches C structs. - var isType = false; - if ( ch0 >= 'A' && ch0 <= 'Z' ) { - for ( var j = wordDecodeHelper.next; - j < t.length; j = wordDecodeHelper.next ) { - wordDecodeHelper.decode(t, j); - var ch1 = wordDecodeHelper.ch; - if ( ch1 >= 'a' && ch1 <= 'z' ) { - isType = true; - break; - } - } - if ( !isType && !isSingleCharacter && - t.substring(t.length - 2) == '_t' ) { - isType = true; - } - } - style = isType ? PR_TYPE : PR_PLAIN; - } - } - else if ( PR_isDigitChar(ch0) ) { - style = PR_LITERAL; - } - else if ( !PR_isSpaceChar(ch0) ) { - style = PR_PUNCTUATION; - } - else { - style = PR_PLAIN; - } - pos = i; - outlist.push(new PR_Token(t, style)); - } - - state = 0; - if ( nstate == -1 ) { - // don't increment. This allows us to use state 0 to redispatch based - // on the current character. - next = i; - continue; - } - } - state = nstate; - } - } - -} - -/** split a group of chunks of markup. - * @private - */ -function PR_tokenizeMarkup( chunks ) { - if ( !(chunks && chunks.length) ) { - return chunks; - } - - var tokenEnds = PR_splitMarkup(chunks); - return PR_splitChunks(chunks, tokenEnds); -} - -/** split tags attributes and their values out from the tag name, and - * recursively lex source chunks. - * @private - */ -function PR_splitTagAttributes( tokens ) { - var tokensOut = []; - var state = 0; - var stateStyle = PR_TAG; - var delim = null; - // attribute delimiter for quoted value state. - var decodeHelper = new PR_DecodeHelper(); - for ( var ci = 0; ci < tokens.length; ++ci ) { - var tok = tokens[ci]; - if ( PR_TAG == tok.style ) { - var s = tok.token; - var start = 0; - for ( var i = 0; i < s.length; /* i = next at bottom */ ) { - decodeHelper.decode(s, i); - var ch = decodeHelper.ch; - var next = decodeHelper.next; - - var emitEnd = null; - // null or position of end of chunk to emit. - var nextStyle = null; - // null or next value of stateStyle - if ( ch == '>' ) { - if ( PR_TAG != stateStyle ) { - emitEnd = i; - nextStyle = PR_TAG; - } - } - else { - switch ( state ) { - case 0: - if ( '<' == ch ) { - state = 1; - } - break; - case 1: - if ( PR_isSpaceChar(ch) ) { - state = 2; - } - break; - case 2: - if ( !PR_isSpaceChar(ch) ) { - nextStyle = PR_ATTRIB_NAME; - emitEnd = i; - state = 3; - } - break; - case 3: - if ( '=' == ch ) { - emitEnd = i; - nextStyle = PR_TAG; - state = 5; - } - else if ( PR_isSpaceChar(ch) ) { - emitEnd = i; - nextStyle = PR_TAG; - state = 4; - } - break; - case 4: - if ( '=' == ch ) { - state = 5; - } - else if ( !PR_isSpaceChar(ch) ) { - emitEnd = i; - nextStyle = PR_ATTRIB_NAME; - state = 3; - } - break; - case 5: - if ( '"' == ch || '\'' == ch ) { - emitEnd = i; - nextStyle = PR_ATTRIB_VALUE; - state = 6; - delim = ch; - } - else if ( !PR_isSpaceChar(ch) ) { - emitEnd = i; - nextStyle = PR_ATTRIB_VALUE; - state = 7; - } - break; - case 6: - if ( ch == delim ) { - emitEnd = next; - nextStyle = PR_TAG; - state = 2; - } - break; - case 7: - if ( PR_isSpaceChar(ch) ) { - emitEnd = i; - nextStyle = PR_TAG; - state = 2; - } - break; - } - } - if ( emitEnd ) { - if ( emitEnd > start ) { - tokensOut.push( - new PR_Token(s.substring(start, emitEnd), stateStyle)); - start = emitEnd; - } - stateStyle = nextStyle; - } - i = next; - } - if ( s.length > start ) { - tokensOut.push(new PR_Token(s.substring(start, s.length), stateStyle)); - } - } - else { - if ( tok.style ) { - state = 0; - stateStyle = PR_TAG; - } - tokensOut.push(tok); - } - } - return tokensOut; -} - -/** identify regions of markup that are really source code, and recursivley - * lex them. - * @private - */ -function PR_splitSourceNodes( tokens ) { - var tokensOut = []; - // when we see a <script> tag, store '/' here so that we know to end the - // source processing - var endScriptTag = null; - var decodeHelper = new PR_DecodeHelper(); - - var sourceChunks = null; - - for ( var ci = 0, nc = tokens.length; /* break below */; ++ci ) { - var tok; - - if ( ci < nc ) { - tok = tokens[ci]; - if ( null == tok.style ) { - tokens.push(tok); - continue; - } - } - else if ( !endScriptTag ) { - break; - } - else { - // else pretend there's an end tag so we can gracefully handle - // unclosed source blocks - tok = new PR_Token('', null); - } - - var s = tok.token; - - if ( null == endScriptTag ) { - if ( PR_SOURCE == tok.style ) { - // split off any starting and trailing <?, <% - if ( '<' == decodeHelper.decode(s, 0) ) { - decodeHelper.decode(s, decodeHelper.next); - if ( '%' == decodeHelper.ch || '?' == decodeHelper.ch ) { - endScriptTag = decodeHelper.ch; - tokensOut.push(new PR_Token(s.substring(0, decodeHelper.next), - PR_TAG)); - s = s.substring(decodeHelper.next, s.length); - } - } - } - else if ( PR_TAG == tok.style ) { - if ( '<' == decodeHelper.decode(s, 0) && - '/' != s.charAt(decodeHelper.next) ) { - var tagContent = s.substring(decodeHelper.next).toLowerCase(); - // FIXME(msamuel): this does not mirror exactly the code in - // in PR_splitMarkup that defers splitting tags inside script and - // style blocks. - if ( PR_startsWith(tagContent, 'script') || - PR_startsWith(tagContent, 'style') || - PR_startsWith(tagContent, 'xmp') ) { - endScriptTag = '/'; - } - } - } - } - - if ( null != endScriptTag ) { - var endTok = null; - if ( PR_SOURCE == tok.style ) { - if ( endScriptTag == '%' || endScriptTag == '?' ) { - var pos = s.lastIndexOf(endScriptTag); - if ( pos >= 0 && '>' == decodeHelper.decode(s, pos + 1) && - s.length == decodeHelper.next ) { - endTok = new PR_Token(s.substring(pos, s.length), PR_TAG); - s = s.substring(0, pos); - } - } - if ( null == sourceChunks ) { - sourceChunks = []; - } - sourceChunks.push(new PR_Token(s, PR_PLAIN)); - } - else if ( PR_PLAIN == tok.style ) { - if ( null == sourceChunks ) { - sourceChunks = []; - } - sourceChunks.push(tok); - } - else if ( PR_TAG == tok.style ) { - // if it starts with </ then it must be the end tag. - if ( '<' == decodeHelper.decode(tok.token, 0) && - tok.token.length > decodeHelper.next && - '/' == decodeHelper.decode(tok.token, decodeHelper.next) ) { - endTok = tok; - } - else { - tokensOut.push(tok); - } - } - else if ( ci >= nc ) { - // force the token to close - endTok = tok; - } - else { - if ( sourceChunks ) { - sourceChunks.push(tok); - } - else { - // push remaining tag and attribute tokens from the opening tag - tokensOut.push(tok); - } - } - if ( endTok ) { - if ( sourceChunks ) { - var sourceTokens = PR_lexSource(sourceChunks); - tokensOut.push(new PR_Token('<span class=embsrc>', null)); - for ( var si = 0, ns = sourceTokens.length; si < ns; ++si ) { - tokensOut.push(sourceTokens[si]); - } - tokensOut.push(new PR_Token('</span>', null)); - sourceChunks = null; - } - if ( endTok.token ) { - tokensOut.push(endTok); - } - endScriptTag = null; - } - } - else { - tokensOut.push(tok); - } - } - return tokensOut; -} - -/** splits the quotes from an attribute value. - * ['"foo"'] -> ['"', 'foo', '"'] - * @private - */ -function PR_splitAttributeQuotes( tokens ) { - var firstPlain = null, lastPlain = null; - for ( var i = 0; i < tokens.length; ++i ) { - if ( PR_PLAIN == tokens[i].style ) { - firstPlain = i; - break; - } - } - for ( var i = tokens.length; --i >= 0; ) { - if ( PR_PLAIN == tokens[i].style ) { - lastPlain = i; - break; - } - } - if ( null == firstPlain ) { - return tokens; - } - - var decodeHelper = new PR_DecodeHelper(); - var fs = tokens[firstPlain].token; - var fc = decodeHelper.decode(fs, 0); - if ( '"' != fc && '\'' != fc ) { - return tokens; - } - var fpos = decodeHelper.next; - - var ls = tokens[lastPlain].token; - var lpos = ls.lastIndexOf('&'); - if ( lpos < 0 ) { - lpos = ls.length - 1; - } - var lc = decodeHelper.decode(ls, lpos); - if ( lc != fc || decodeHelper.next != ls.length ) { - lc = null; - lpos = ls.length; - } - - var tokensOut = []; - for ( var i = 0; i < firstPlain; ++i ) { - tokensOut.push(tokens[i]); - } - tokensOut.push(new PR_Token(fs.substring(0, fpos), PR_ATTRIB_VALUE)); - if ( lastPlain == firstPlain ) { - tokensOut.push(new PR_Token(fs.substring(fpos, lpos), PR_PLAIN)); - } - else { - tokensOut.push(new PR_Token(fs.substring(fpos, fs.length), PR_PLAIN)); - for ( var i = firstPlain + 1; i < lastPlain; ++i ) { - tokensOut.push(tokens[i]); - } - if ( lc ) { - tokens.push(new PR_Token(ls.substring(0, lpos), PR_PLAIN)); - } - else { - tokens.push(tokens[lastPlain]); - } - } - if ( lc ) { - tokensOut.push(new PR_Token(ls.substring(lpos, ls.length), PR_PLAIN)); - } - for ( var i = lastPlain + 1; i < tokens.length; ++i ) { - tokensOut.push(tokens[i]); - } - return tokensOut; -} - -/** identify attribute values that really contain source code and recursively - * lex them. - * @private - */ -function PR_splitSourceAttributes( tokens ) { - var tokensOut = []; - - var sourceChunks = null; - var inSource = false; - var name = ''; - - for ( var ci = 0, nc = tokens.length; ci < nc; ++ci ) { - var tok = tokens[ci]; - var outList = tokensOut; - if ( PR_TAG == tok.style ) { - if ( inSource ) { - inSource = false; - name = ''; - if ( sourceChunks ) { - tokensOut.push(new PR_Token('<span class=embsrc>', null)); - var sourceTokens = - PR_lexSource(PR_splitAttributeQuotes(sourceChunks)); - for ( var si = 0, ns = sourceTokens.length; si < ns; ++si ) { - tokensOut.push(sourceTokens[si]); - } - tokensOut.push(new PR_Token('</span>', null)); - sourceChunks = null; - } - } - else if ( name && tok.token.indexOf('=') >= 0 ) { - var nameLower = name.toLowerCase(); - if ( PR_startsWith(nameLower, 'on') || 'style' == nameLower ) { - inSource = true; - } - } - else { - name = ''; - } - } - else if ( PR_ATTRIB_NAME == tok.style ) { - name += tok.token; - } - else if ( PR_ATTRIB_VALUE == tok.style ) { - if ( inSource ) { - if ( null == sourceChunks ) { - sourceChunks = []; - } - outList = sourceChunks; - tok = new PR_Token(tok.token, PR_PLAIN); - } - } - else { - if ( sourceChunks ) { - outList = sourceChunks; - } - } - outList.push(tok); - } - return tokensOut; -} - -/** returns a list of PR_Token objects given chunks of source code. - * - * This code treats ", ', and ` as string delimiters, and \ as a string escape. - * It does not recognize perl's qq() style strings. It has no special handling - * for double delimiter escapes as in basic, or tje tripled delimiters used in - * python, but should work on those regardless although in those cases a single - * string literal may be broken up into multiple adjacent string literals. - * - * It recognizes C, C++, and shell style comments. - * - * @param chunks PR_Tokens with style in (null, PR_PLAIN) - */ -function PR_lexSource( chunks ) { - // split into strings, comments, and other. - // We do this because strings and comments are easily recognizable and can - // contain stuff that looks like other tokens, so we want to mark those early - // so we don't recurse into them. - var tokens = PR_splitStringAndCommentTokens(chunks); - - // split non comment|string tokens on whitespace and word boundaries - var tokensOut = []; - for ( var i = 0; i < tokens.length; ++i ) { - var tok = tokens[i]; - if ( PR_PLAIN === tok.style ) { - PR_splitNonStringNonCommentToken(tok.token, tokensOut); - continue; - } - tokensOut.push(tok); - } - - return tokensOut; -} - -/** returns a list of PR_Token objects given a string of markup. - * - * This code assumes that < tokens are html escaped, but " are not. - * It will do a resonable job with <, but will not recognize an " - * as starting a string. - * - * This code recognizes a number of constructs. - * <!-- ... --> comment - * <!\w ... > declaration - * <\w ... > tag - * </\w ... > tag - * <?...?> embedded source - * &[#\w]...; entity - * - * It does not recognizes %foo; entities. - * - * It will recurse into any <style>, <script>, and on* attributes using - * PR_lexSource. - */ -function PR_lexMarkup( chunks ) { - // This function works as follows: - // 1) Start by splitting the markup into text and tag chunks - // Input: String s - // Output: List<PR_Token> where style in (PR_PLAIN, null) - // 2) Then split the text chunks further into comments, declarations, - // tags, etc. - // After each split, consider whether the token is the start of an - // embedded source section, i.e. is an open <script> tag. If it is, - // find the corresponding close token, and don't bother to lex in between. - // Input: List<String> - // Output: List<PR_Token> with style in (PR_TAG, PR_PLAIN, PR_SOURCE, null) - // 3) Finally go over each tag token and split out attribute names and values. - // Input: List<PR_Token> - // Output: List<PR_Token> where style in - // (PR_TAG, PR_PLAIN, PR_SOURCE, NAME, VALUE, null) - var tokensOut = PR_tokenizeMarkup(chunks); - tokensOut = PR_splitTagAttributes(tokensOut); - tokensOut = PR_splitSourceNodes(tokensOut); - tokensOut = PR_splitSourceAttributes(tokensOut); - return tokensOut; -} - -/** - * classify the string as either source or markup and lex appropriately. - * @param {String} html - */ -function PR_lexOne( html ) { - var chunks = PR_expandTabs(PR_chunkify(html), PR_TAB_WIDTH); - - // treat it as markup if the first non whitespace character is a < and the - // last non-whitespace character is a > - var isMarkup = false; - for ( var i = 0; i < chunks.length; ++i ) { - if ( PR_PLAIN == chunks[i].style ) { - if ( PR_startsWith(PR_trim(chunks[i].token), '<') ) { - for ( var j = chunks.length; --j >= 0; ) { - if ( PR_PLAIN == chunks[j].style ) { - isMarkup = PR_endsWith(PR_trim(chunks[j].token), '>'); - break; - } - } - } - break; - } - } - - return isMarkup ? PR_lexMarkup(chunks) : PR_lexSource(chunks); -} - -/** pretty print a chunk of code. - * - * @param s code as html - * @return code as html, but prettier - */ -function prettyPrintOne( s ) { - try { - var tokens = PR_lexOne(s); - var out = []; - var lastStyle = null; - for ( var i = 0; i < tokens.length; i++ ) { - var t = tokens[i]; - if ( t.style != lastStyle ) { - if ( lastStyle != null ) { - out.push('</span>'); - } - if ( t.style != null ) { - out.push('<span class=', t.style, '>'); - } - lastStyle = t.style; - } - var html = t.token; - if ( null != t.style ) { - // This interacts badly with some wikis which introduces paragraph tags - // into pre blocks for some strange reason. - // It's necessary for IE though which seems to lose the preformattedness - // of <pre> tags when their innerHTML is assigned. - // http://stud3.tuwien.ac.at/~e0226430/innerHtmlQuirk.html - html = html - .replace(/(\r\n?|\n| ) /g, '$1 ') - .replace(/\r\n?|\n/g, '<br>'); - } - out.push(html); - } - if ( lastStyle != null ) { - out.push('</span>'); - } - return out.join(''); - } - catch ( e ) { - if ( 'console' in window ) { - console.log(e); - console.trace(); - } - return s; - } -} - -/** find all the < pre > and < code > tags in the DOM with class=prettyprint and - * prettify them. - */ -function prettyPrint() { - // fetch a list of nodes to rewrite - var codeSegments = [ - document.getElementsByTagName('pre'), - document.getElementsByTagName('code'), - document.getElementsByTagName('xmp') ]; - var elements = []; - for ( var i = 0; i < codeSegments.length; ++i ) { - for ( var j = 0; j < codeSegments[i].length; ++j ) { - elements.push(codeSegments[i][j]); - } - } - codeSegments = null; - - // the loop is broken into a series of continuations to make sure that we - // don't make the browser unresponsive when rewriting a large page. - var k = 0; - - function doWork() { - var endTime = new Date().getTime() + 250; - for ( ; k < elements.length && new Date().getTime() < endTime; k++ ) { - var cs = elements[k]; - if ( cs.className && cs.className.indexOf('prettyprint') >= 0 ) { - - // make sure this is not nested in an already prettified element - var nested = false; - for ( var p = cs.parentNode; p != null; p = p.parentNode ) { - if ( (p.tagName == 'pre' || p.tagName == 'code' || - p.tagName == 'xmp') && - p.className && p.className.indexOf('prettyprint') >= 0 ) { - nested = true; - break; - } - } - if ( !nested ) { - // fetch the content as a snippet of properly escaped HTML. - // Firefox adds newlines at the end. - var content = PR_getInnerHtml(cs); - content = content.replace(/(?:\r\n?|\n)$/, ''); - - // do the pretty printing - var newContent = prettyPrintOne(content); - - // push the prettified html back into the tag. - if ( !PR_isRawContent(cs) ) { - // just replace the old html with the new - cs.innerHTML = newContent; - } - else { - // we need to change the tag to a <pre> since <xmp>s do not allow - // embedded tags such as the span tags used to attach styles to - // sections of source code. - var pre = document.createElement('PRE'); - for ( var i = 0; i < cs.attributes.length; ++i ) { - var a = cs.attributes[i]; - if ( a.specified ) { - pre.setAttribute(a.name, a.value); - } - } - pre.innerHTML = newContent; - // remove the old - cs.parentNode.replaceChild(pre, cs); - } - } - } - } - if ( k < elements.length ) { - // finish up in a continuation - setTimeout(doWork, 250); - } - } - - doWork(); -} diff --git a/third_party/java/jopt-simple/src/site/site.xml b/third_party/java/jopt-simple/src/site/site.xml deleted file mode 100644 index 8dafe09e18..0000000000 --- a/third_party/java/jopt-simple/src/site/site.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="JOpt Simple - a Java command line parsing library"> - <bannerLeft> - <name>JOpt Simple</name> - <src>images/jopt-simple-logo.png</src> - <href>http://pholser.github.com/jopt-simple/</href> - </bannerLeft> - <body> - <menu name="JOpt Simple"> - <item name="Overview" href="index.html"/> - <item name="Download" href="download.html"/> - <item name="Examples" href="examples.html"/> - <item name="Change Log" href="changes.html"/> - <item name="Javadoc" href="apidocs/index.html"/> - <item name="Developer Docs" href="developer.html"/> - <item name="Acknowledgements" href="acknowledgments.html"/> - </menu> - <menu ref="reports"/> - </body> -</project> |