Overview | Index by: file name | procedure name | procedure call | annotation

tcldoc_scanner.tcl Annotations

Created from tcldoc_scanner.tcl
Handles scanning of file-level and procedure-level comments. Identifies the various tags (@author, @return, etc) and formats them suitably for the file's annotation page. Also identifies one-line summary for the item and adds it to the global summary table. This file is parsed by fickle to create the actual scanner.
Version:
1.0
Author:
Jason Tang (tang@jtang.org)

Procedure Summary
add_file_annotation { header }
          Given the file-level comment (with //# markings removed) scans it for tags.
add_proc_annotation { header procname procargs procline }
          Given a procedure-level comment scans it for tags.
BEGIN { new_state {prefix yy} }
          BEGIN followed by the name of a start condition places the scanner in the corresponding start condition.
ECHO { {s {}} }
          ECHO copies yytext to the scanner's output if no arguments are given.
get_summary { text }
          Determines the summary line given the file/procedure information.
input { }
          input() reads the next character from the input stream.
interp_link { text tag }
          Helper function to the scanner that takes the arguments to a @link or the third form of @see and splits it into its component parts.
new_annotation { dest basename annothtmlname docroot }
          Flushes internal tables in preparation for writing a new annotation file.
unput { c }
          unput(c) puts the character c back onto the input stream.
write_annotation { }
          Actually writes the annotation file to disk at the location specified in a previous call to new_annotation.
YY_FLUSH_BUFFER { }
          YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the next time the scanner attempts to match a token, it will first refill the buffer using YY_INPUT.
YY_INPUT { buf result max_size }
          The nature of how it gets its input can be controlled by defining the YY_INPUT macro.
yy_pop_state { }
          Pops off the top of the state stack; if the stack is now empty, then pushes the state "INITIAL".
yy_push_state { new_state }
          Pushes the current start condition onto the top of the start condition stack and switches to new_state as though you had used BEGIN new_state.
yy_scan_string { str }
          yy_scan_string sets up input buffers for scanning in-memory strings instead of files.
yy_top_state { }
          Returns the top of the stack without altering the stack's contents.
yyless { n }
          Returns all but the first n characters of the current token back to the input stream, where they will be rescanned when the scanner looks for the next match.
yylex { }
          Whenever yylex() is called, it scans tokens from the global input file yyin (which defaults to stdin).
yyrestart { new_file }
          yyrestart(new_file) may be called to point yyin at the new input file.
yywrap { }
          If yywrap() returns false (zero), then it is assumed that the function has gone ahead and set up yyin to point to another input file, and scanning continues.

Procedure Detail

add_file_annotation

proc add_file_annotation { header }
Given the file-level comment (with //# markings removed) scans it for tags. Generates the HTML code suitable for writing to the file's annotation page. Adds a one-line summary for the file to the global summary table.
Parameters:
header - a contiguous block of comments sans hash marks
Defined in:
tcldoc_scanner.tcl, line 462

add_proc_annotation

proc add_proc_annotation { header procname procargs procline }
Given a procedure-level comment scans it for tags. Generates the HTML code suitable for writing to the file's annotation page. Adds a one-line summary for the procedure to the global summary table.
Parameters:
header - a contiguous block of comments sans hash marks
procname - name of the procedure being scanned
procargs - a flattened list of arguments to the procedure
procline - line number for procedure declaration within its source file
Defined in:
tcldoc_scanner.tcl, line 515

BEGIN

proc BEGIN { new_state {prefix yy} }
BEGIN followed by the name of a start condition places the scanner in the corresponding start condition. . . .Until the next BEGIN action is executed, rules with the given start condition will be active and rules with other start conditions will be inactive. If the start condition is inclusive, then rules with no start conditions at all will also be active. If it is exclusive, then only rules qualified with the start condition will be active. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 176

ECHO

proc ECHO { {s {}} }
ECHO copies yytext to the scanner's output if no arguments are given. The scanner writes its ECHO output to the yyout global (default, stdout), which may be redefined by the user simply by assigning it to some other channel. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 38

get_summary

proc get_summary { text }
Determines the summary line given the file/procedure information. A summary is the first sentence (text ending with a period and followed by whitespace), excluding all HTML tags.
Parameters:
text - Text from a comment block (either file or procedure level) from which to determine summary.
Returns:
Calculated summary.
Defined in:
tcldoc_scanner.tcl, line 664

input

proc input {  }
input() reads the next character from the input stream. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 121

interp_link

proc interp_link { text tag }
Helper function to the scanner that takes the arguments to a @link or the third form of @see and splits it into its component parts. For the name portion attempts to resolve the procedure name as per the rules described in the Tcldoc manual. Checks if there is an optional label; if not then set the label equal to the name. Finally adds the results of the interpretation to the current tag being scanned.
Parameters:
text - tag text to scan
tag - name of tag being scanned.
Defined in:
tcldoc_scanner.tcl, line 589

new_annotation

proc new_annotation { dest basename annothtmlname docroot }
Flushes internal tables in preparation for writing a new annotation file. This function must be called before using any other procedure within this file.
Parameters:
dest - I/O channel to write annotations
basename - name of source Tcl file being annotate
annothtmlname - name of file to where annotations are being written
docroot - documents root directory
Defined in:
tcldoc_scanner.tcl, line 447

unput

proc unput { c }
unput(c) puts the character c back onto the input stream. It will be the next character scanned. The following action will take the current token and cause it to be rescanned enclosed in parentheses. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 100

write_annotation

proc write_annotation {  }
Actually writes the annotation file to disk at the location specified in a previous call to new_annotation. If new_annotation has not been called yet then behavior is undetermined.
See Also:
new_annotation
Defined in:
tcldoc_scanner.tcl, line 625

YY_FLUSH_BUFFER

proc YY_FLUSH_BUFFER {  }
YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the next time the scanner attempts to match a token, it will first refill the buffer using YY_INPUT. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 50

YY_INPUT

proc YY_INPUT { buf result max_size }
The nature of how it gets its input can be controlled by defining the YY_INPUT macro. YY_INPUT's calling sequence is "YY_INPUT(buf,result,max_size)". Its action is to place up to max_size characters in the character array buf and return in the integer variable result either the number of characters read or the constant YY_NULL (0 on Unix systems) to indicate EOF. The default YY_INPUT reads from the global file-pointer "yyin". -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 75

yy_pop_state

proc yy_pop_state {  }
Pops off the top of the state stack; if the stack is now empty, then pushes the state "INITIAL". -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 155

yy_push_state

proc yy_push_state { new_state }
Pushes the current start condition onto the top of the start condition stack and switches to new_state as though you had used BEGIN new_state. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 148

yy_scan_string

proc yy_scan_string { str }
yy_scan_string sets up input buffers for scanning in-memory strings instead of files. Note that switching input sources does not change the start condition. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 91

yy_top_state

proc yy_top_state {  }
Returns the top of the stack without altering the stack's contents. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 164

yyless

proc yyless { n }
Returns all but the first n characters of the current token back to the input stream, where they will be rescanned when the scanner looks for the next match. yytext and yyleng are adjusted appropriately. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 111

yylex

proc yylex {  }
Whenever yylex() is called, it scans tokens from the global input file yyin (which defaults to stdin). It continues until it either reaches an end-of-file (at which point it returns the value 0) or one of its actions executes a return statement. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 206

yyrestart

proc yyrestart { new_file }
yyrestart(new_file) may be called to point yyin at the new input file. The switch-over to the new file is immediate (any previously buffered-up input is lost). Note that calling yyrestart with yyin as an argument thus throws away the current input buffer and continues scanning the same input file. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 62

yywrap

proc yywrap {  }
If yywrap() returns false (zero), then it is assumed that the function has gone ahead and set up yyin to point to another input file, and scanning continues. If it returns true (non-zero), then the scanner terminates, returning 0 to its caller. Note that in either case, the start condition remains unchanged; it does not revert to INITIAL. -- from the flex(1) man page
Defined in:
tcldoc_scanner.tcl, line 29

Overview | Index by: file name | procedure name | procedure call | annotation
File generated 2021-01-02 at 05:27.