Re: [code] [textadept] applescript syntax request

From: Robert Gieseke <rob.g.att.web.de>
Date: Fri, 22 May 2015 20:55:33 +0200

Hi Jay,

as for the OS question, from within Textadept's Lua state you can use
these global variables (from the API docs):

BSD (bool) Whether or not Textadept is running on BSD.

CURSES (bool) Whether or not Textadept is running in the terminal.
Curses feature incompatibilities are listed in the Appendix.

LINUX (bool) Whether or not Textadept is running on Linux.

OSX (bool) Whether or not Textadept is running on Mac OSX as a GUI
application.

WIN32 (bool) Whether or not Textadept is running on Windows.

Hope this helps,
Robert

Am 22/05/15 um 20:32 schrieb Jay Young:
> I have a syntax request. This is just for the AppleScript language. Whenever I type a single quote, Textadept considers that to be for a string, so colors it accordingly. But in AppleScript, strings can only be in double quotes. But single quotes can be used elsewhere like so:
> tell (current date) set m to (it's month) as number end tell
> Some people use "of" instead of the apostrophe-s like this:
> tell (current date) set m to (month of it) as number end tell
> but I like the apostrophe-s approach better.
> I went in my ~/.textadept/lexers/applescript.lua file and changed:
> --Strings.local sq_str = l.delimited_range("'", true)local dq_str = l.delimited_range('"', true)local string = token(l.STRING, sq_str + dq_str)
> to this:
> --Strings.local dq_str = l.delimited_range('"', true)local string = token(l.STRING, dq_str)
> I'm a total beginner at lua, so I may have editted that code incorrectly, but it does make the AppleScript syntax look a lot better. Could this applescript.lua file be adjusted in the next Textadept version?
> Also, while I'm on the subject of lua, does anyone know how to check the platform you're on with lua? Roughly an example:
> os = <platform>? if (os == 'os x') then -- stuff elseif (os == 'win') then -- stuff end
> I'm struggling finding this online, but have found:
> f = io.popen('uname', 'r') v = f:read('*a') f:close() print('Version: ' .. v)
> Which gives me "Version: Darwin".
> Thank you (and thanks for letting me sneak a lua question in).
> Jay
>

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 22 May 2015 - 14:55:33 EDT

This archive was generated by hypermail 2.2.0 : Sat 23 May 2015 - 06:25:18 EDT