Debian Codegraph @

external/lasso-builtins-generator-9.lasso

raw
1 #!/usr/bin/lasso9
2
3 /*
4 Builtins Generator for Lasso 9
5
6 This is the shell script that was used to extract Lasso 9's built-in keywords
7 and generate most of the _lasso_builtins.py file. When run, it creates a file
8 containing the types, traits, methods, and members of the currently-installed
9 version of Lasso 9.
10
11 A list of tags in Lasso 8 can be generated with this code:
12
13 <?LassoScript
14 local('l8tags' = list,
15 'l8libs' = array('Cache','ChartFX','Client','Database','File','HTTP',
16 'iCal','Lasso','Link','List','PDF','Response','Stock','String',
17 'Thread','Valid','WAP','XML'));
18 iterate(#l8libs, local('library'));
19 local('result' = namespace_load(#library));
20 /iterate;
21 iterate(tags_list, local('i'));
22 #l8tags->insert(string_removeleading(#i, -pattern='_global_'));
23 /iterate;
24 #l8tags->sort;
25 iterate(#l8tags, local('i'));
26 string_lowercase(#i)+"<br>";
27 /iterate;
28
29 */
30
31 output("This output statement is required for a complete list of methods.")
32 local(f) = file("_lasso_builtins-9.py")
33 #f->doWithClose => {
34
35 #f->openTruncate
36 #f->writeString('# -*- coding: utf-8 -*-
37 """
38 pygments.lexers._lasso_builtins
39 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
41 Built-in Lasso types, traits, methods, and members.
42
43 :copyright: Copyright 2006-'+date->year+' by the Pygments team, see AUTHORS.
44 :license: BSD, see LICENSE for details.
45 """
46
47 ')
48
49 // Load and register contents of $LASSO9_MASTER_HOME/LassoModules/
50 database_initialize
51
52 // Load all of the libraries from builtins and lassoserver
53 // This forces all possible available types and methods to be registered
54 local(srcs =
55 (:
56 dir(sys_masterHomePath + '/LassoLibraries/builtins/')->eachFilePath,
57 dir(sys_masterHomePath + '/LassoLibraries/lassoserver/')->eachFilePath
58 )
59 )
60
61 with topLevelDir in delve(#srcs)
62 where not #topLevelDir->lastComponent->beginsWith('.')
63 do protect => {
64 handle_error => {
65 stdoutnl('Unable to load: ' + #topLevelDir + ' ' + error_msg)
66 }
67 library_thread_loader->loadLibrary(#topLevelDir)
68 stdoutnl('Loaded: ' + #topLevelDir)
69 }
70
71 email_initialize
72 log_initialize
73 session_initialize
74
75 local(
76 typesList = set(),
77 traitsList = set(),
78 unboundMethodsList = set(),
79 memberMethodsList = set()
80 )
81
82 // types
83 with type in sys_listTypes
84 where not #type->asString->endsWith('$') // skip threads
85 do {
86 #typesList->insert(#type)
87 }
88
89 // traits
90 with trait in sys_listTraits
91 where not #trait->asString->beginsWith('$') // skip combined traits
92 do {
93 #traitsList->insert(#trait)
94 }
95
96 // member methods
97 with type in #typesList
98 do {
99 with method in #type->getType->listMethods
100 where #method->typeName == #type // skip inherited methods
101 let name = #method->methodName
102 where not #name->asString->endsWith('=') // skip setter methods
103 where #name->asString->isAlpha(1) // skip unpublished methods
104 do {
105 #memberMethodsList->insert(#name)
106 }
107 }
108 with trait in #traitsList
109 do {
110 with method in #trait->getType->provides
111 where #method->typeName == #trait // skip inherited methods
112 let name = #method->methodName
113 where not #name->asString->endsWith('=') // skip setter methods
114 where #name->asString->isAlpha(1) // skip unpublished methods
115 do {
116 #memberMethodsList->insert(#name)
117 }
118 }
119
120 // unbound methods
121 with method in sys_listUnboundMethods
122 let name = #method->methodName
123 where not #name->asString->endsWith('=') // skip setter methods
124 where #name->asString->isAlpha(1) // skip unpublished methods
125 where #typesList !>> #name
126 where #traitsList !>> #name
127 do {
128 #unboundMethodsList->insert(#name)
129 }
130
131 // write to file
132 with i in (:
133 pair(#typesList, "BUILTINS = {
134 'Types': (
135 "),
136 pair(#traitsList, " ),
137 'Traits': (
138 "),
139 pair(#unboundMethodsList, " ),
140 'Unbound Methods': (
141 "),
142 pair(#memberMethodsList, " )
143 }
144 MEMBERS = {
145 'Member Methods': (
146 ")
147 )
148 do {
149 #f->writeString(#i->second)
150 with t in (#i->first)
151 let ts = #t->asString
152 order by #ts
153 do {
154 #f->writeString(" '"+#ts->lowercase&asString+"',\n")
155 }
156 }
157
158 #f->writeString(" )
159 }
160 ")
161
162 }