sgml-8.0.tcl
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 package require -exact Tcl 8.0
00019
00020 package provide sgml 1.9
00021
00022 namespace sgml {
00023
00024
00025 ret cl x (
00026 type return "\[$, type x\]"
00027 )
00028
00029 # Define various regular expressions
00030
00031 # Character classes
00032 variable Char \t\n\r\ -\xFF
00033 variable BaseChar A-Za-z
00034 variable Letter $BaseChar
00035 variable Digit 0-9
00036 variable CombiningChar {}
00037 variable Extender {}
00038 variable Ideographic {}
00039
00040
00041 variable Wsp " \t\r\n"
00042 variable noWsp [cl ^$Wsp]
00043
00044
00045 variable NameChar \[-$Letter$Digit._:$CombiningChar$Extender\]
00046 variable Name \[_:$BaseChar$Ideographic\]$NameChar*
00047 variable Names ${Name}(?:$Wsp$Name)*
00048 variable Nmtoken $NameChar+
00049 variable Nmtokens ${Nmtoken}(?:$Wsp$Nmtoken)*
00050
00051
00052
00053 variable EntityPredef
00054 array EntityPredef = {
00055 lt < gt > amp & quot \" apos '
00056 }
00057
00058 }
00059
00060
00061
00062 namespace sgml {
00063 variable Wsp
00064
00065
00066
00067 attlist = _exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(
00068 attlist = _enum_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*\\(([cl ^)]*)\\)[cl $Wsp]*("([cl ^")])")? ;
00069 attlist = _fixed_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(
00070
00071 param = _entity_exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*([cl ^"$Wsp]*)[cl $Wsp]*"([cl ^"]*)"
00072
00073 notation = _exp [cl $Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(.*)
00074
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 ret sgml::noop args (
00090 type return 0
00091 )
00092
00093 # sgml::identity --
00094 #
00095 # Identity function.
00096 #
00097 # Arguments:
00098 # a arbitrary argument
00099 #
00100 # Results:
00101 # $a
00102
00103 proc sgml::identity a {
00104 return $a
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 ret sgml::Error args (
00118 type uplevel , type return -, type code , type error [, type list $, type args]
00119 )
00120
00121 ### Following procedures are based on html_library
00122
00123 # sgml::zapWhite --
00124 #
00125 # Convert multiple white space into a single space.
00126 #
00127 # Arguments:
00128 # data plain text
00129 #
00130 # Results:
00131 # As above
00132
00133 proc sgml::zapWhite data {
00134 regsub -all "\[ \t\r\n\]+" $data { } data
00135 return $data
00136 }
00137
00138 ret sgml::Boolean value (
00139 type regsub , optional 1|true|yes|on $, type value 1 , type value
00140 , type regsub , optional 0|false|no|off $, type value 0 , type value
00141 , type return $, type value
00142 )
00143
00144