scheme expression typos

svn: r14565

original commit: da4742700bbe8c680c0ef4ba7875d5b32b384005
This commit is contained in:
Eli Barzilay 2009-04-20 08:20:19 +00:00
parent 712ece9ead
commit 8ebb17fb2d

View File

@ -12,7 +12,7 @@
Starts tokenizing the buffer for coloring and parenthesis matching. Starts tokenizing the buffer for coloring and parenthesis matching.
token-sym-style will be passed the first return symbol from get-token @scheme[token-sym-style] will be passed the first return symbol from @scheme[get-token]
and should return the style-name that the token should be colored. and should return the style-name that the token should be colored.
get-token takes an input port and returns the next token as 5 values: get-token takes an input port and returns the next token as 5 values:
@ -22,11 +22,11 @@
component of the token and may be used as such in the future.} component of the token and may be used as such in the future.}
@item{ @item{
A symbol describing the type of the token. This symbol is transformed A symbol describing the type of the token. This symbol is transformed
into a style-name via the token-sym->style argument. The symbols into a style-name via the @scheme[token-sym->style] argument. The symbols
'white-space and 'comment have special meaning and should always be @scheme['white-space] and @scheme['comment] have special meaning and should always be
returned for white space and comment tokens respectively. The symbol returned for white space and comment tokens respectively. The symbol
@scheme['no-color] can be used to indicate that although the token is not white @scheme['no-color] can be used to indicate that although the token is not white
space, it should not be colored. The symbol 'eof must be used to space, it should not be colored. The symbol @scheme['eof] must be used to
indicate when all the tokens have been consumed.} indicate when all the tokens have been consumed.}
@item{ @item{
A symbol indicating how the token should be treated by the paren A symbol indicating how the token should be treated by the paren
@ -36,7 +36,7 @@
@item{ @item{
The ending position of the token.}] The ending position of the token.}]
get-token will usually be implemented with a lexer using the @scheme[get-token] will usually be implemented with a lexer using the
@scheme[parser-tools/lex] library. @scheme[parser-tools/lex] library.
get-token must obey the following invariants: get-token must obey the following invariants:
@itemize[ @itemize[
@ -44,7 +44,7 @@
Every position in the buffer must be accounted for in exactly one Every position in the buffer must be accounted for in exactly one
token.} token.}
@item{ @item{
The token returned by get-token must rely only on the contents of the The token returned by @scheme[get-token] must rely only on the contents of the
input port argument. This means that the tokenization of some part of input port argument. This means that the tokenization of some part of
the input cannot depend on earlier parts of the input.} the input cannot depend on earlier parts of the input.}
@item{ @item{
@ -57,14 +57,14 @@
the buffer look like: the buffer look like:
@verbatim{" 1 2 3"} @verbatim{" 1 2 3"}
would result in a single string token modifying previous tokens. To would result in a single string token modifying previous tokens. To
handle these situations, get-token must treat the first line as a handle these situations, @scheme[get-token] must treat the first line as a
single token.}] single token.}]
@scheme[pairs] is a list of different kinds of matching parens. The second @scheme[pairs] is a list of different kinds of matching parens. The second
value returned by get-token is compared to this list to see how the value returned by get-token is compared to this list to see how the
paren matcher should treat the token. An example: Suppose pairs is paren matcher should treat the token. An example: Suppose pairs is
@scheme['((|(| |)|) (|[| |]|) (begin end))]. This means that there @scheme['((|(| |)|) (|[| |]|) (begin end))]. This means that there
are three kinds of parens. Any token which has 'begin as its second are three kinds of parens. Any token which has @scheme['begin] as its second
return value will act as an open for matching tokens with 'end. return value will act as an open for matching tokens with 'end.
Similarly any token with @scheme['|]|] will act as a closing match for Similarly any token with @scheme['|]|] will act as a closing match for
tokens with @scheme['|[|]. When trying to correct a mismatched tokens with @scheme['|[|]. When trying to correct a mismatched
@ -75,7 +75,7 @@
Stops coloring and paren matching the buffer. Stops coloring and paren matching the buffer.
If clear-colors is true all the text in the buffer will have it's If @scheme[clear-colors] is true all the text in the buffer will have its
style set to Standard. style set to Standard.
} }
@defmethod*[(((force-stop-colorer (stop? boolean?)) void))]{ @defmethod*[(((force-stop-colorer (stop? boolean?)) void))]{
@ -83,7 +83,7 @@
Intended for debugging purposes only. Intended for debugging purposes only.
stop? determines whether the system is being forced to stop or allowed @scheme[stop?] determines whether the system is being forced to stop or allowed
to wake back up. to wake back up.
} }
@defmethod*[(((is-stopped?) boolean?))]{ @defmethod*[(((is-stopped?) boolean?))]{
@ -96,13 +96,11 @@
and and
@method[color:text<%> thaw-colorer]. @method[color:text<%> thaw-colorer].
} }
@defmethod*[(((freeze-colorer) void))]{ @defmethod*[(((freeze-colorer) void))]{
Keep the text tokenized and paren matched, but stop altering the colors. Keep the text tokenized and paren matched, but stop altering the colors.
@scheme[freeze-colorer] will not return until the coloring/tokenization of the
freeze-colorer will not return until the coloring/tokenization of the
entire text is brought up-to-date. It must not be called on a locked entire text is brought up-to-date. It must not be called on a locked
text. text.
} }
@ -110,13 +108,13 @@
Start coloring a frozen buffer again. Start coloring a frozen buffer again.
If recolor? is @scheme[#t], the text is re-colored. If it is If @scheme[recolor?] is @scheme[#t], the text is re-colored. If it is
@scheme[#f] the text is not recolored. When recolor? is @scheme[#t], @scheme[#f] the text is not recolored. When @scheme[recolor?] is @scheme[#t],
retokenize? controls how the text is recolored. @scheme[#f] causes @scheme[retokenize?] controls how the text is recolored. @scheme[#f] causes
the text to be entirely re-colored before thaw-colorer returns using the text to be entirely re-colored before thaw-colorer returns using
the existing tokenization. @scheme[#t] causes the entire text to be the existing tokenization. @scheme[#t] causes the entire text to be
retokenized and recolored from scratch. This will happen in the retokenized and recolored from scratch. This will happen in the
background after the call to thaw-colorer returns. background after the call to @scheme[thaw-colorer] returns.
} }
@defmethod*[(((reset-region (start natural-number?) (end (union (quote end) natural-number?))) void))]{ @defmethod*[(((reset-region (start natural-number?) (end (union (quote end) natural-number?))) void))]{
@ -134,19 +132,16 @@
@defmethod*[(((skip-whitespace (position natural-number?) (direction (symbols (quote forward) (quote backward))) (comments? boolean?)) natural-number?))]{ @defmethod*[(((skip-whitespace (position natural-number?) (direction (symbols (quote forward) (quote backward))) (comments? boolean?)) natural-number?))]{
Returns the next non-whitespace character. Returns the next non-whitespace character.
Starts from position and skips whitespace in the direction indicated Starts from position and skips whitespace in the direction indicated
by direction. If comments? is true, comments are skipped as well as by direction. If @scheme[comments?] is true, comments are skipped as well as
whitespace. skip-whitespace determines whitespaces and comments by whitespace. skip-whitespace determines whitespaces and comments by
comparing the token type to 'white-space and 'comment. comparing the token type to @scheme['white-space] and @scheme['comment].
Must only be called while the tokenizer is started. Must only be called while the tokenizer is started.
} }
@defmethod*[(((backward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{ @defmethod*[(((backward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{
Skip all consecutive whitespaces and comments (using @scheme[skip-whitespace])
Skip all consecutive whitespaces and comments (using skip-whitespace)
immediately preceding the position. If the token at this position is immediately preceding the position. If the token at this position is
a close, return the position of the matching open, or @scheme[#f] if a close, return the position of the matching open, or @scheme[#f] if
there is none. If the token was an open, return @scheme[#f]. For any there is none. If the token was an open, return @scheme[#f]. For any
@ -163,9 +158,7 @@
} }
@defmethod*[(((forward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{ @defmethod*[(((forward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{
Skip all consecutive whitespaces and comments (using @scheme[skip-whitespace])
Skip all consecutive whitespaces and comments (using skip-whitespace)
immediately following position. If the token at this position is an immediately following position. If the token at this position is an
open, return the position of the matching close, or @scheme[#f] if open, return the position of the matching close, or @scheme[#f] if
there is none. For any other token, return the end of that token. there is none. For any other token, return the end of that token.
@ -174,12 +167,11 @@
} }
@defmethod*[(((insert-close-paren (position natural-number?) (char char?) (flash? boolean?) (fixup? boolean?)) void))]{ @defmethod*[(((insert-close-paren (position natural-number?) (char char?) (flash? boolean?) (fixup? boolean?)) void))]{
Position is the place to put the parenthesis and char is the Position is the place to put the parenthesis and char is the
parenthesis to be added. If fixup? is true, the right kind of closing parenthesis to be added. If @scheme[fixup?] is true, the right kind of closing
parenthesis will be chosen from the pairs list kept last passed to parenthesis will be chosen from the pairs list kept last passed to
start-colorer, otherwise char will be inserted, even if it is not the @scheme[start-colorer], otherwise char will be inserted, even if it is not the
right kind. If flash? is true the matching open parenthesis will be right kind. If @scheme[flash?] is true the matching open parenthesis will be
flashed. flashed.
} }
@defmethod*[(((classify-position (position natural-number?)) symbol?))]{ @defmethod*[(((classify-position (position natural-number?)) symbol?))]{
@ -218,7 +210,7 @@
@defmixin[color:text-mode-mixin (mode:surrogate-text<%>) (color:text-mode<%>)]{ @defmixin[color:text-mode-mixin (mode:surrogate-text<%>) (color:text-mode<%>)]{
This mixin adds coloring functionality to the mode. This mixin adds coloring functionality to the mode.
@defconstructor[((get-token lexer default-lexer) (token-sym->style (token $rightarrow$ string) |scheme(λ (x) "Standard"))|) (matches (listof (list/c symbol? symbol?)) null))]{ @defconstructor[((get-token lexer default-lexer) (token-sym->style (token $rightarrow$ string) @scheme[(λ (x) "Standard")])|) (matches (listof (list/c symbol? symbol?)) null))]{
The arguments are passed to The arguments are passed to
@method[color:text<%> start-colorer]. @method[color:text<%> start-colorer].