summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorEricFromCanada <eric3knibbe@gmail.com>2014-11-17 10:34:42 -0500
committerEricFromCanada <eric3knibbe@gmail.com>2014-11-17 10:34:42 -0500
commit5b43bc04ba5e7287bc36d6e0f50b2e7797c58d3e (patch)
treea1ddf3a033ac31679d0cbf5930bfa8486508104c /external
parent79824687b0b2d1555ff4f13e454cc89d421a62ba (diff)
downloadpygments-5b43bc04ba5e7287bc36d6e0f50b2e7797c58d3e.tar.gz
improvements for Lasso builtins generator
updating & sorting Lasso builtins file
Diffstat (limited to 'external')
-rwxr-xr-xexternal/lasso-builtins-generator-9.lasso116
1 files changed, 67 insertions, 49 deletions
diff --git a/external/lasso-builtins-generator-9.lasso b/external/lasso-builtins-generator-9.lasso
index 6a619106..d199ed50 100755
--- a/external/lasso-builtins-generator-9.lasso
+++ b/external/lasso-builtins-generator-9.lasso
@@ -4,9 +4,9 @@
Builtins Generator for Lasso 9
This is the shell script that was used to extract Lasso 9's built-in keywords
- and generate most of the _lassobuiltins.py file. When run, it creates a file
- named "lassobuiltins-9.py" containing the types, traits, methods, and members
- of the currently-installed version of Lasso 9.
+ and generate most of the _lasso_builtins.py file. When run, it creates a file
+ containing the types, traits, methods, and members of the currently-installed
+ version of Lasso 9.
A list of tags in Lasso 8 can be generated with this code:
@@ -29,14 +29,14 @@
*/
output("This output statement is required for a complete list of methods.")
-local(f) = file("lassobuiltins-9.py")
+local(f) = file("_lasso_builtins-9.py")
#f->doWithClose => {
-#f->openWrite
+#f->openTruncate
#f->writeString('# -*- coding: utf-8 -*-
"""
- pygments.lexers._lassobuiltins
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ pygments.lexers._lasso_builtins
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Built-in Lasso types, traits, methods, and members.
@@ -46,18 +46,19 @@ local(f) = file("lassobuiltins-9.py")
')
-lcapi_loadModules
+// Load and register contents of $LASSO9_MASTER_HOME/LassoModules/
+database_initialize
// Load all of the libraries from builtins and lassoserver
// This forces all possible available types and methods to be registered
local(srcs =
- tie(
+ (:
dir(sys_masterHomePath + 'LassoLibraries/builtins/')->eachFilePath,
dir(sys_masterHomePath + 'LassoLibraries/lassoserver/')->eachFilePath
)
)
-with topLevelDir in #srcs
+with topLevelDir in delve(#srcs)
where not #topLevelDir->lastComponent->beginsWith('.')
do protect => {
handle_error => {
@@ -67,38 +68,53 @@ do protect => {
stdoutnl('Loaded: ' + #topLevelDir)
}
+email_initialize
+log_initialize
+session_initialize
+
local(
- typesList = list(),
- traitsList = list(),
- unboundMethodsList = list(),
- memberMethodsList = list()
+ typesList = set(),
+ traitsList = set(),
+ unboundMethodsList = set(),
+ memberMethodsList = set()
)
// types
with type in sys_listTypes
-where #typesList !>> #type
+where not #type->asString->endsWith('$') // skip threads
do {
#typesList->insert(#type)
- with method in #type->getType->listMethods
- let name = #method->methodName
- where not #name->asString->endsWith('=') // skip setter methods
- where #name->asString->isAlpha(1) // skip unpublished methods
- where #memberMethodsList !>> #name
- do #memberMethodsList->insert(#name)
}
// traits
with trait in sys_listTraits
where not #trait->asString->beginsWith('$') // skip combined traits
-where #traitsList !>> #trait
do {
#traitsList->insert(#trait)
+}
+
+// member methods
+with type in #typesList
+do {
+ with method in #type->getType->listMethods
+ where #method->typeName == #type // skip inherited methods
+ let name = #method->methodName
+ where not #name->asString->endsWith('=') // skip setter methods
+ where #name->asString->isAlpha(1) // skip unpublished methods
+ do {
+ #memberMethodsList->insert(#name)
+ }
+}
+with trait in #traitsList
+do {
with method in tie(#trait->getType->provides, #trait->getType->requires)
+ where #method->typeName == #trait // skip inherited methods
let name = #method->methodName
where not #name->asString->endsWith('=') // skip setter methods
where #name->asString->isAlpha(1) // skip unpublished methods
- where #memberMethodsList !>> #name
- do #memberMethodsList->insert(#name)
+ do {
+ #memberMethodsList->insert(#name)
+ }
}
// unbound methods
@@ -108,36 +124,38 @@ where not #name->asString->endsWith('=') // skip setter methods
where #name->asString->isAlpha(1) // skip unpublished methods
where #typesList !>> #name
where #traitsList !>> #name
-where #unboundMethodsList !>> #name
-do #unboundMethodsList->insert(#name)
-
-#f->writeString("BUILTINS = {
- 'Types': [
-")
-with t in #typesList
-do !#t->asString->endsWith('$') ? #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
-
-#f->writeString(" ],
- 'Traits': [
-")
-with t in #traitsList
-do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
-
-#f->writeString(" ],
- 'Unbound Methods': [
-")
-with t in #unboundMethodsList
-do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
+do {
+ #unboundMethodsList->insert(#name)
+}
-#f->writeString(" ]
+// write to file
+with i in (:
+ pair(#typesList, "BUILTINS = {
+ 'Types': (
+"),
+ pair(#traitsList, " ),
+ 'Traits': (
+"),
+ pair(#unboundMethodsList, " ),
+ 'Unbound Methods': (
+"),
+ pair(#memberMethodsList, " )
}
MEMBERS = {
- 'Member Methods': [
+ 'Member Methods': (
")
-with t in #memberMethodsList
-do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
+)
+do {
+ #f->writeString(#i->second)
+ with t in (#i->first)
+ let ts = #t->asString
+ do {
+ #ts->lowercase
+ #f->writeString(" '"+#ts+"',\n")
+ }
+}
-#f->writeString(" ]
+#f->writeString(" )
}
")