Jan Pieter Kunst <[EMAIL PROTECTED]> wrote on Wednesday, September 27, 2006:
>On 9/27/06, Eric Landmann <[EMAIL PROTECTED]> wrote:
>> Douglas Holschuh <[EMAIL PROTECTED]> wrote on Tuesday, September 26, 2006:
>>
>> >So, who's going to write the tutorial on compiled language modules?
>> >Seth?
>> >(Yeah, I know, some people are never satisfied :)
>> >
>> >Doug
>> >
>> >On Sep 25, 2006, at 3:39 PM, Jim Correia wrote:
>> >
>> >> Codeless Language Modules can only fold functions.
>> >>
>> >> A compiled language module can define auto-fold ranges for whatever
>> >> syntax elements it likes.
>>
>> There is a community of Lasso developers that would really benefit from code
>> folding. It seems that to get the
>most functionality we would need a compiled language module to handle all the
>various aspects of the language. So
>here's a vote for a Lasso compiled language module (I know there are others
>out there...).
>>
>
>Wouldn't it be possible to just define the elements that you wish to
>fold as 'functions' in a CLM?
Lasso allows definition of what it calls "Custom Tags" and "Custom Types",
which are in some respects similar to PHP functions. These can named whatever
the coder chooses, and can be created in a separate file for loading when the
server process starts, or these can be done within the contents of a Lasso
file. It would be handy to have code folding points at all of the major
structures of the language. Is what you suggest flexible enough to allow for
these? Here is an example of Lasso code to create a custom tag to output a
formatted error message:
<?Lassoscript
// Show Error Custom Tag
If: !(Lasso_TagExists:'Show_Error');
Define_Tag: 'Show_Error',
-Required = 'ErrNum',
-Required = 'PosColor',
-Required = 'NegColor',
-Required = 'BgColor',
-Optional = 'Option';
Local:'Result' = '';
If: #ErrNum != '';
Inline:
-Database=$Database,-Table=$ErrorsTable,-UserName=$SiteUsername,-Password=$SitePassword,
-SQL="SELECT Code, Message, Title, Attrib
FROM " $SiteDatabase "." $ErrorsTable "
WHERE Code= '" (#ErrNum) "';";
var:'vErr' = (Error_CurrentError) ' -- '
(Error_CurrentError: -ErrorCode);
var:'vErrNo' = (Error_CurrentError: -ErrorCode);
If: $vErrNo == 0;
If: (Found_Count)== 0;
#Result += 'No Error Message Found';
Else;
// Get Attribute from database and assign coloor
If: (Field:'Attrib') == 'Pos';
Local:'HeaderColor' = (#PosColor);
Else;
Local:'HeaderColor' = (#NegColor);
/If;
// Output top of table
#Result =
'<table width="80%" border="0" cellspacing="1"
cellpadding="2">\r'
'\t<tr>\r'
'\t\t<td bgcolor="#' (#HeaderColor)'"><b><font
color="#FFFFFF">';
If: #Option != '';
#Result +=
((Field:'Title')'</font></b><br>\r\t\t</td>\r\t</tr>\r\t<tr>\r\t\t<td
bgcolor="#'(#BgColor)'">'(String_Replace: (Field:'Message'),
-Find='<form_input>', -Replace=#Option));
Else;
#Result +=
((Field:'Title')'</font></b><br>\r\t\t</td>\r\t</tr>\r\t<tr>\r\t\t<td
bgcolor="#'(#BgColor)'"><font color="#000000">'(Field:'Message'));
/If;
/If;
Else;
#Result += $vErr;
/If;
/inline;
Else;
// Output top of table
#Result =
'<table width="80%" border="0" cellspacing="1"
cellpadding="2">\r'
'\t<tr>\r'
'\t\t<td bgcolor="#'(#HeaderColor)'"><b><font
color="'(#BgColor)'">';
#Result += 'EXCEPTION: An Unknown Error Was Generated';
/If;
// Output bottom of table
#Result +=
'</font></td>\r'
'\t</tr>\r'
'</table>\r'
' <br>\r';
Return: Encode_Smart:(#Result);
/Define_Tag;
/If;
?>
--Eric
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>