Files changed (1)
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
+ 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
+"A parser that parses either P or Q."| p0 <CombinatorialParser> q0 <CombinatorialParser> pfun <[^CombinatorialParser]> qfun <[^CombinatorialParser]> |)
+equals the specified token, it is indistiguishable from it, and we can just return token as the result of the
+"A special parser used for inputs that need to be rapidly scanned over. It differs from its superclass in that it actually collects the characters it scans, in case they are needed (e.g., for pretty printers).
+Ideally,we should not have to do this, but until we do proper optimization by compiling combinators, this will have to suffice. It provides a marked improvement in performance, By using such parsers for comments, whitespace and strings, the overall performance of the Newqueak parser improved by a factor of 2 or so."| comment |)
+If parsing fails, it is the caller''s responsibility to set the input stream back to its original position
+flatten the resulting parser tree, while ',' is; this achieved by overriding ',' in SequentialParser to do the flattening.
+"Return a parser that accepts one or more repetitions of what the receiver accepts. Denoted by the postfix + in BNF"
+"Utility for the common case of a list with separators. The separators are discarded, as they are usually only used to guide parsing and
+"Utility for the common case of a list with separators, allowing for an optional appearance of the separator at the end. The separators are discarded, as they are usually only used to guide parsing and
+"Return a parser that accepts zero or more repetitions of what the receiver accepts. Denoted by the postfix * in BNF"
+"We tweak the classic formulation by wrapping it in a parser that takes care to avoid returning nil.
+production; it is verbose and error prone. In the case of star, it is better to return an empty list
+"Design note: It seems tempting to define a combinator, 'token', that returns a tokenized version of its receiver. Alas, this doesn't work out, since tokenization relies on concepts of whitespace and comment, which are often specific to a given grammar. Hence, the combinator needs to be aan operation of the grammar, not of a specific production."
+"As an optimization, we process whitespace with a dedicated scanning parser. Of course, this regrettable, and Perhaps Squeak specific, but it is a significant win."
+"A parser that only succeeds at the end of the input. This addresses a common problem with combinator parsers. If there is garbage at the end of the input, no production matches it. Consequently, the parsers backtrack to the point where the legal input was consumed, without giving an error message about the junk at the end.")
+"A parser that implements the 'not' combinator, as in Ford's PEGs. It contains a parser p, and succeeds if p fails and vice versa. It does not move the input forward if it succeeds."| p <CombinatorialParser> = aParser. |)
+"This class defines a context that is shared among a set of combinatorial parsers during a parse. The context can be used to manage information on parsing errors: rather than always report the latest failure that occurred, we can report the one that occurred deepest in the input stream, or implement some other policy - as long as we can record what failures took place.
+"Parses a given symbol. One could derive this as an alternation of character parsers, but the derivation is more verbose than defining it directly, and less efficient, so why bother?"| symbol |)
+"Used to transform the output of another parser. A wrapping parser accepts exactly the same input as the wrapped
+parser does, and performs the same error handling. The only differenceis that it takes the output of the wrapped
+parser and passes it on to a wrapper block which uses it to produce a new result, which is the output of the wrapping
+The output type of the wrapped parser, S, is also the input to the wrapper. The output type of the wrapper is the output of this