This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tabsize=4 | |
indent.size=4 | |
use.tabs=0 | |
split.vertical=0 | |
open.dialog.in.file.directory=1 | |
statusbar.visible=1 | |
# treat Nimrod like Python | |
file.patterns.nim=*.nim | |
lexer.$(file.patterns.nim)=python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
from os import ParamCount, ParamStr | |
import tables | |
export tables.`[]` | |
#### Simple string lexer ### | |
type | |
PLexer = ref TLexer | |
TLexer = object | |
str: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import parseopt | |
from strutils import parseInt | |
from os import existsFile | |
const usage = """ | |
head [flags] filename | |
-n: number of lines (default 10) | |
-h,--help: this help | |
-v,--version: version | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- | |
-- A list class that wraps a table | |
-- @classmod List | |
import insert,concat,remove from table | |
class List | |
--- constructor passed a table `t`, which can be `nil`. | |
new: (t) => | |
@ls = t or {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctor = (C,...) -> | |
obj = setmetatable {}, C | |
init = rawget C, '_init' | |
if init | |
init(obj,...) | |
return obj | |
is_class = (C) -> | |
mt = getmetatable C | |
if mt and C._class -- this is a base class! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* lint64.c | |
* int64 nummbers for Lua | |
* Luiz Henrique de Figueiredo <[email protected]> | |
* Thu Aug 1 22:56:17 BRT 2013 | |
* This code is hereby placed in the public domain. | |
* Modified by Stevedonovan, Aug 3. | |
* __pow is defined by integer second arg | |
* new can be passed a hex literal string | |
* tohex will return a int64 as a hex string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local f = io.open('info.txt') | |
local line = f:read() | |
local Q = '"' | |
local QC = '",' | |
--local tags = dofile 'tags.lua' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'android' | |
require 'android.intents' -- needed for creating an email.. | |
feedback_email = '[email protected]' | |
_M = android.new! | |
with _M | |
-- compare to this more standard implementation: | |
--http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-forms/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- globalsplus.lua | |
-- Like globals.lua in Lua 5.1.4 -- globalsplus.lua | |
-- Like globals.lua in Lua 5.1.4 but records fields in global tables too. | |
-- Probably works but not well tested. Could be extended even further. | |
-- | |
-- usage: lua globalsplus.lua example.lua | |
-- | |
-- D.Manura, 2010-07, public domain | |
-- | |
-- See http://lua-users.org/wiki/DetectingUndefinedVariables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- struct.lua | |
--- defining a struct constructor --- | |
local function ordered_map (t) | |
local fields,keys = {},{} | |
for i,item in ipairs(t) do | |
local key,value = next(item) | |
fields[key] = value | |
keys[i] = key | |
end |