mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
add erlang, more-complex shell examples
- some Erlang and escript files - .escript extension - .erlang extension - shell script with %, ##, name tokens
This commit is contained in:
@@ -59,6 +59,11 @@
|
||||
"Emacs Lisp": [
|
||||
".el"
|
||||
],
|
||||
"Erlang": [
|
||||
".erl",
|
||||
".escript",
|
||||
".script!"
|
||||
],
|
||||
"fish": [
|
||||
".fish"
|
||||
],
|
||||
@@ -300,6 +305,9 @@
|
||||
"Visual Basic": [
|
||||
".cls"
|
||||
],
|
||||
"wisp": [
|
||||
".wisp"
|
||||
],
|
||||
"XML": [
|
||||
".ant",
|
||||
".ivy",
|
||||
@@ -371,8 +379,8 @@
|
||||
".gemrc"
|
||||
]
|
||||
},
|
||||
"tokens_total": 354585,
|
||||
"languages_total": 414,
|
||||
"tokens_total": 357870,
|
||||
"languages_total": 421,
|
||||
"tokens": {
|
||||
"ABAP": {
|
||||
"*/**": 1,
|
||||
@@ -12157,6 +12165,201 @@
|
||||
"print": 1,
|
||||
")": 1
|
||||
},
|
||||
"Erlang": {
|
||||
"SHEBANG#!escript": 2,
|
||||
"%": 13,
|
||||
"-": 88,
|
||||
"*": 3,
|
||||
"erlang": 1,
|
||||
"smp": 1,
|
||||
"enable": 1,
|
||||
"sname": 1,
|
||||
"factorial": 1,
|
||||
"mnesia": 1,
|
||||
"debug": 1,
|
||||
"verbose": 1,
|
||||
"main": 3,
|
||||
"(": 172,
|
||||
"[": 46,
|
||||
"String": 2,
|
||||
"]": 41,
|
||||
")": 166,
|
||||
"try": 2,
|
||||
"N": 6,
|
||||
"list_to_integer": 1,
|
||||
"F": 16,
|
||||
"fac": 4,
|
||||
"io": 3,
|
||||
"format": 3,
|
||||
"catch": 2,
|
||||
"_": 45,
|
||||
"usage": 3,
|
||||
"end": 2,
|
||||
";": 43,
|
||||
".": 28,
|
||||
"halt": 1,
|
||||
"export": 2,
|
||||
"main/1": 1,
|
||||
"For": 1,
|
||||
"each": 1,
|
||||
"header": 1,
|
||||
"file": 3,
|
||||
"it": 2,
|
||||
"scans": 1,
|
||||
"thru": 1,
|
||||
"all": 1,
|
||||
"records": 1,
|
||||
"and": 4,
|
||||
"create": 1,
|
||||
"helper": 1,
|
||||
"functions": 2,
|
||||
"Helper": 1,
|
||||
"are": 1,
|
||||
"setters": 1,
|
||||
"getters": 1,
|
||||
"fields": 4,
|
||||
"fields_atom": 4,
|
||||
"type": 6,
|
||||
"module": 2,
|
||||
"record_helper": 1,
|
||||
"make/1": 1,
|
||||
"make/2": 1,
|
||||
"make": 3,
|
||||
"HeaderFiles": 5,
|
||||
"atom_to_list": 18,
|
||||
"X": 12,
|
||||
"||": 6,
|
||||
"<->": 5,
|
||||
"hrl": 1,
|
||||
"relative": 1,
|
||||
"to": 1,
|
||||
"current": 1,
|
||||
"dir": 1,
|
||||
"OutDir": 2,
|
||||
"ModuleName": 3,
|
||||
"HeaderComment": 2,
|
||||
"ModuleDeclaration": 2,
|
||||
"+": 208,
|
||||
"<": 1,
|
||||
"Src": 10,
|
||||
"format_src": 8,
|
||||
"lists": 6,
|
||||
"sort": 1,
|
||||
"flatten": 5,
|
||||
"read": 2,
|
||||
"generate_type_default_function": 2,
|
||||
"write_file": 1,
|
||||
"erl": 1,
|
||||
"list_to_binary": 1,
|
||||
"HeaderFile": 4,
|
||||
"epp": 1,
|
||||
"parse_file": 1,
|
||||
"of": 2,
|
||||
"{": 90,
|
||||
"ok": 22,
|
||||
"Tree": 4,
|
||||
"}": 90,
|
||||
"parse": 2,
|
||||
"error": 2,
|
||||
"Error": 4,
|
||||
"catched_error": 1,
|
||||
"end.": 2,
|
||||
"|": 15,
|
||||
"T": 24,
|
||||
"when": 29,
|
||||
"length": 6,
|
||||
"Type": 3,
|
||||
"A": 4,
|
||||
"B": 4,
|
||||
"NSrc": 4,
|
||||
"_Type": 1,
|
||||
"Type1": 2,
|
||||
"parse_record": 3,
|
||||
"attribute": 1,
|
||||
"record": 4,
|
||||
"RecordInfo": 2,
|
||||
"RecordName": 41,
|
||||
"RecordFields": 10,
|
||||
"if": 1,
|
||||
"generate_setter_getter_function": 5,
|
||||
"generate_type_function": 3,
|
||||
"true": 1,
|
||||
"generate_fields_function": 2,
|
||||
"generate_fields_atom_function": 2,
|
||||
"parse_field_name": 5,
|
||||
"record_field": 9,
|
||||
"atom": 9,
|
||||
"FieldName": 26,
|
||||
"field": 4,
|
||||
"_FieldName": 2,
|
||||
"ParentRecordName": 8,
|
||||
"parent_field": 2,
|
||||
"parse_field_name_atom": 5,
|
||||
"concat": 5,
|
||||
"_S": 3,
|
||||
"S": 6,
|
||||
"concat_ext": 4,
|
||||
"parse_field": 6,
|
||||
"AccFields": 6,
|
||||
"AccParentFields": 6,
|
||||
"case": 1,
|
||||
"Field": 2,
|
||||
"PField": 2,
|
||||
"parse_field_atom": 4,
|
||||
"zzz": 1,
|
||||
"Fields": 4,
|
||||
"field_atom": 1,
|
||||
"to_setter_getter_function": 5,
|
||||
"setter": 2,
|
||||
"getter": 2,
|
||||
"This": 1,
|
||||
"is": 1,
|
||||
"auto": 1,
|
||||
"generated": 1,
|
||||
"file.": 1,
|
||||
"Please": 1,
|
||||
"don": 1,
|
||||
"t": 1,
|
||||
"edit": 1,
|
||||
"record_utils": 1,
|
||||
"compile": 1,
|
||||
"export_all": 1,
|
||||
"include": 1,
|
||||
"abstract_message": 21,
|
||||
"async_message": 12,
|
||||
"clientId": 5,
|
||||
"destination": 5,
|
||||
"messageId": 5,
|
||||
"timestamp": 5,
|
||||
"timeToLive": 5,
|
||||
"headers": 5,
|
||||
"body": 5,
|
||||
"correlationId": 5,
|
||||
"correlationIdBytes": 5,
|
||||
"get": 12,
|
||||
"Obj": 49,
|
||||
"is_record": 25,
|
||||
"Obj#abstract_message.body": 1,
|
||||
"Obj#abstract_message.clientId": 1,
|
||||
"Obj#abstract_message.destination": 1,
|
||||
"Obj#abstract_message.headers": 1,
|
||||
"Obj#abstract_message.messageId": 1,
|
||||
"Obj#abstract_message.timeToLive": 1,
|
||||
"Obj#abstract_message.timestamp": 1,
|
||||
"Obj#async_message.correlationId": 1,
|
||||
"Obj#async_message.correlationIdBytes": 1,
|
||||
"parent": 5,
|
||||
"Obj#async_message.parent": 3,
|
||||
"ParentProperty": 6,
|
||||
"is_atom": 2,
|
||||
"set": 13,
|
||||
"Value": 33,
|
||||
"NewObj": 20,
|
||||
"Obj#abstract_message": 7,
|
||||
"Obj#async_message": 3,
|
||||
"NewParentObject": 2,
|
||||
"undefined.": 1
|
||||
},
|
||||
"fish": {
|
||||
"#": 18,
|
||||
"set": 49,
|
||||
@@ -34683,18 +34886,34 @@
|
||||
"/": 2
|
||||
},
|
||||
"Shell": {
|
||||
"SHEBANG#!bash": 6,
|
||||
"echo": 63,
|
||||
"SHEBANG#!bash": 8,
|
||||
"typeset": 5,
|
||||
"-": 364,
|
||||
"i": 1,
|
||||
"n": 22,
|
||||
"bottles": 6,
|
||||
"no": 16,
|
||||
"while": 3,
|
||||
"[": 84,
|
||||
"]": 84,
|
||||
"do": 8,
|
||||
"echo": 69,
|
||||
"case": 9,
|
||||
"{": 63,
|
||||
"}": 61,
|
||||
"in": 25,
|
||||
")": 154,
|
||||
"%": 5,
|
||||
"s": 13,
|
||||
";": 135,
|
||||
"esac": 7,
|
||||
"done": 8,
|
||||
"exit": 10,
|
||||
"/usr/bin/clear": 2,
|
||||
"##": 28,
|
||||
"if": 39,
|
||||
"[": 82,
|
||||
"-": 362,
|
||||
"z": 12,
|
||||
"]": 82,
|
||||
";": 131,
|
||||
"then": 41,
|
||||
"n": 17,
|
||||
"export": 25,
|
||||
"SCREENDIR": 2,
|
||||
"fi": 34,
|
||||
@@ -34713,9 +34932,7 @@
|
||||
"/usr/share/man": 2,
|
||||
"Random": 2,
|
||||
"ENV...": 2,
|
||||
"{": 59,
|
||||
"TERM": 4,
|
||||
"}": 57,
|
||||
"COLORTERM": 2,
|
||||
"CLICOLOR": 2,
|
||||
"#": 53,
|
||||
@@ -34735,7 +34952,6 @@
|
||||
"Fh": 2,
|
||||
"l": 8,
|
||||
"list": 3,
|
||||
"in": 24,
|
||||
"long": 2,
|
||||
"format...": 2,
|
||||
"ll": 2,
|
||||
@@ -34749,7 +34965,6 @@
|
||||
"HISTCONTROL": 2,
|
||||
"ignoreboth": 2,
|
||||
"shopt": 13,
|
||||
"s": 10,
|
||||
"cdspell": 2,
|
||||
"extglob": 2,
|
||||
"progcomp": 2,
|
||||
@@ -34878,7 +35093,6 @@
|
||||
"this": 6,
|
||||
"more": 3,
|
||||
"intelligent": 2,
|
||||
")": 152,
|
||||
"c": 2,
|
||||
"type": 5,
|
||||
"which": 10,
|
||||
@@ -34894,7 +35108,6 @@
|
||||
"directories": 2,
|
||||
"W": 2,
|
||||
"alias": 42,
|
||||
"no": 13,
|
||||
"filenames": 2,
|
||||
"for": 7,
|
||||
"PS1": 2,
|
||||
@@ -34994,7 +35207,6 @@
|
||||
"rupa/z.sh": 2,
|
||||
"fpath": 6,
|
||||
"HOME/.zsh/func": 2,
|
||||
"typeset": 2,
|
||||
"U": 2,
|
||||
"pkgname": 1,
|
||||
"stud": 4,
|
||||
@@ -35069,7 +35281,6 @@
|
||||
"makes": 1,
|
||||
"pattern": 1,
|
||||
"matching": 1,
|
||||
"case": 8,
|
||||
"insensitive": 1,
|
||||
"POSTFIX": 1,
|
||||
"URL": 1,
|
||||
@@ -35078,16 +35289,12 @@
|
||||
"true": 2,
|
||||
"print_help": 2,
|
||||
"e": 4,
|
||||
"exit": 9,
|
||||
"opt": 3,
|
||||
"@": 3,
|
||||
"do": 7,
|
||||
"k": 1,
|
||||
"local": 22,
|
||||
"false": 2,
|
||||
"h": 3,
|
||||
"esac": 6,
|
||||
"done": 7,
|
||||
".*": 2,
|
||||
"o": 3,
|
||||
"continue": 1,
|
||||
@@ -35191,7 +35398,6 @@
|
||||
"build_props_scala": 1,
|
||||
"build.scala.versions": 1,
|
||||
"versionLine##build.scala.versions": 1,
|
||||
"%": 3,
|
||||
"execRunner": 2,
|
||||
"arg": 3,
|
||||
"sbt_groupid": 3,
|
||||
@@ -35312,7 +35518,6 @@
|
||||
"get_jvm_opts": 2,
|
||||
"process_args": 2,
|
||||
"require_arg": 12,
|
||||
"while": 2,
|
||||
"gt": 1,
|
||||
"shift": 28,
|
||||
"integer": 1,
|
||||
@@ -35362,7 +35567,10 @@
|
||||
"iflast": 1,
|
||||
"#residual_args": 1,
|
||||
"SHEBANG#!sh": 2,
|
||||
"SHEBANG#!zsh": 2
|
||||
"SHEBANG#!zsh": 2,
|
||||
"name": 1,
|
||||
"foodforthought.jpg": 1,
|
||||
"name##*fo": 1
|
||||
},
|
||||
"Standard ML": {
|
||||
"signature": 2,
|
||||
@@ -36582,6 +36790,433 @@
|
||||
"Boolean": 1,
|
||||
"True": 1
|
||||
},
|
||||
"wisp": {
|
||||
";": 199,
|
||||
"#": 2,
|
||||
"wisp": 6,
|
||||
"Wisp": 13,
|
||||
"is": 20,
|
||||
"homoiconic": 1,
|
||||
"JS": 17,
|
||||
"dialect": 1,
|
||||
"with": 6,
|
||||
"a": 24,
|
||||
"clojure": 2,
|
||||
"syntax": 2,
|
||||
"s": 7,
|
||||
"-": 33,
|
||||
"expressions": 6,
|
||||
"and": 9,
|
||||
"macros.": 1,
|
||||
"code": 3,
|
||||
"compiles": 1,
|
||||
"to": 21,
|
||||
"human": 1,
|
||||
"readable": 1,
|
||||
"javascript": 1,
|
||||
"which": 3,
|
||||
"one": 3,
|
||||
"of": 16,
|
||||
"they": 3,
|
||||
"key": 3,
|
||||
"differences": 1,
|
||||
"from": 2,
|
||||
"clojurescript.": 1,
|
||||
"##": 2,
|
||||
"data": 1,
|
||||
"structures": 1,
|
||||
"nil": 4,
|
||||
"just": 3,
|
||||
"like": 2,
|
||||
"js": 1,
|
||||
"undefined": 1,
|
||||
"differenc": 1,
|
||||
"that": 7,
|
||||
"it": 10,
|
||||
"shortcut": 1,
|
||||
"for": 5,
|
||||
"void": 2,
|
||||
"(": 77,
|
||||
")": 75,
|
||||
"in": 16,
|
||||
"JS.": 2,
|
||||
"Booleans": 1,
|
||||
"booleans": 2,
|
||||
"true": 6,
|
||||
"/": 1,
|
||||
"false": 2,
|
||||
"are": 14,
|
||||
"Numbers": 1,
|
||||
"numbers": 2,
|
||||
"Strings": 2,
|
||||
"strings": 3,
|
||||
"can": 13,
|
||||
"be": 15,
|
||||
"multiline": 1,
|
||||
"Characters": 2,
|
||||
"sugar": 1,
|
||||
"single": 1,
|
||||
"char": 1,
|
||||
"Keywords": 3,
|
||||
"symbolic": 2,
|
||||
"identifiers": 2,
|
||||
"evaluate": 2,
|
||||
"themselves.": 1,
|
||||
"keyword": 1,
|
||||
"Since": 1,
|
||||
"string": 1,
|
||||
"constats": 1,
|
||||
"fulfill": 1,
|
||||
"this": 2,
|
||||
"purpose": 2,
|
||||
"keywords": 1,
|
||||
"compile": 3,
|
||||
"equivalent": 2,
|
||||
"strings.": 1,
|
||||
"window.addEventListener": 1,
|
||||
"load": 1,
|
||||
"handler": 1,
|
||||
"invoked": 2,
|
||||
"as": 4,
|
||||
"functions": 8,
|
||||
"desugars": 1,
|
||||
"plain": 2,
|
||||
"associated": 2,
|
||||
"value": 2,
|
||||
"access": 1,
|
||||
"bar": 4,
|
||||
"foo": 6,
|
||||
"[": 22,
|
||||
"]": 22,
|
||||
"Vectors": 1,
|
||||
"vectors": 1,
|
||||
"arrays.": 1,
|
||||
"Note": 3,
|
||||
"Commas": 2,
|
||||
"white": 1,
|
||||
"space": 1,
|
||||
"&": 6,
|
||||
"used": 1,
|
||||
"if": 7,
|
||||
"desired": 1,
|
||||
"Maps": 2,
|
||||
"hash": 1,
|
||||
"maps": 1,
|
||||
"objects.": 1,
|
||||
"unlike": 1,
|
||||
"keys": 1,
|
||||
"not": 4,
|
||||
"arbitary": 1,
|
||||
"types.": 1,
|
||||
"{": 4,
|
||||
"beep": 1,
|
||||
"bop": 1,
|
||||
"}": 4,
|
||||
"optional": 2,
|
||||
"but": 7,
|
||||
"come": 1,
|
||||
"handy": 1,
|
||||
"separating": 1,
|
||||
"pairs.": 1,
|
||||
"b": 5,
|
||||
"In": 5,
|
||||
"future": 2,
|
||||
"JSONs": 1,
|
||||
"may": 1,
|
||||
"made": 2,
|
||||
"compatible": 1,
|
||||
"map": 3,
|
||||
"syntax.": 1,
|
||||
"Lists": 1,
|
||||
"You": 1,
|
||||
"up": 1,
|
||||
"lists": 1,
|
||||
"representing": 1,
|
||||
"expressions.": 1,
|
||||
"The": 1,
|
||||
"first": 4,
|
||||
"item": 2,
|
||||
"the": 9,
|
||||
"expression": 6,
|
||||
"function": 7,
|
||||
"being": 1,
|
||||
"rest": 7,
|
||||
"items": 2,
|
||||
"arguments.": 2,
|
||||
"baz": 2,
|
||||
"Conventions": 1,
|
||||
"puts": 1,
|
||||
"lot": 2,
|
||||
"effort": 1,
|
||||
"making": 1,
|
||||
"naming": 1,
|
||||
"conventions": 3,
|
||||
"transparent": 1,
|
||||
"by": 2,
|
||||
"encouraning": 1,
|
||||
"lisp": 1,
|
||||
"then": 1,
|
||||
"translating": 1,
|
||||
"them": 1,
|
||||
"dash": 1,
|
||||
"delimited": 1,
|
||||
"dashDelimited": 1,
|
||||
"predicate": 1,
|
||||
"isPredicate": 1,
|
||||
"__privates__": 1,
|
||||
"list": 2,
|
||||
"vector": 1,
|
||||
"listToVector": 1,
|
||||
"As": 1,
|
||||
"side": 2,
|
||||
"effect": 1,
|
||||
"some": 2,
|
||||
"names": 1,
|
||||
"expressed": 3,
|
||||
"few": 1,
|
||||
"ways": 1,
|
||||
"although": 1,
|
||||
"third": 2,
|
||||
"expression.": 1,
|
||||
"<": 1,
|
||||
"number": 3,
|
||||
"Else": 1,
|
||||
"missing": 1,
|
||||
"conditional": 1,
|
||||
"evaluates": 2,
|
||||
"result": 2,
|
||||
"will": 6,
|
||||
".": 6,
|
||||
"monday": 1,
|
||||
"today": 1,
|
||||
"Compbining": 1,
|
||||
"everything": 1,
|
||||
"an": 1,
|
||||
"sometimes": 1,
|
||||
"might": 1,
|
||||
"want": 2,
|
||||
"compbine": 1,
|
||||
"multiple": 1,
|
||||
"into": 2,
|
||||
"usually": 3,
|
||||
"evaluating": 1,
|
||||
"have": 2,
|
||||
"effects": 1,
|
||||
"do": 4,
|
||||
"console.log": 2,
|
||||
"+": 9,
|
||||
"Also": 1,
|
||||
"special": 4,
|
||||
"form": 10,
|
||||
"many.": 1,
|
||||
"If": 2,
|
||||
"evaluation": 1,
|
||||
"nil.": 1,
|
||||
"Bindings": 1,
|
||||
"Let": 1,
|
||||
"containing": 1,
|
||||
"lexical": 1,
|
||||
"context": 1,
|
||||
"simbols": 1,
|
||||
"bindings": 1,
|
||||
"forms": 1,
|
||||
"bound": 1,
|
||||
"their": 2,
|
||||
"respective": 1,
|
||||
"results.": 1,
|
||||
"let": 2,
|
||||
"c": 1,
|
||||
"Functions": 1,
|
||||
"fn": 15,
|
||||
"x": 22,
|
||||
"named": 1,
|
||||
"similar": 2,
|
||||
"increment": 1,
|
||||
"also": 2,
|
||||
"contain": 1,
|
||||
"documentation": 1,
|
||||
"metadata.": 1,
|
||||
"Docstring": 1,
|
||||
"metadata": 1,
|
||||
"presented": 1,
|
||||
"compiled": 2,
|
||||
"yet": 1,
|
||||
"comments": 1,
|
||||
"function.": 1,
|
||||
"incerement": 1,
|
||||
"added": 1,
|
||||
"makes": 1,
|
||||
"capturing": 1,
|
||||
"arguments": 7,
|
||||
"easier": 1,
|
||||
"than": 1,
|
||||
"argument": 1,
|
||||
"follows": 1,
|
||||
"simbol": 1,
|
||||
"capture": 1,
|
||||
"all": 4,
|
||||
"args": 1,
|
||||
"array.": 1,
|
||||
"rest.reduce": 1,
|
||||
"sum": 3,
|
||||
"Overloads": 1,
|
||||
"overloaded": 1,
|
||||
"depending": 1,
|
||||
"on": 1,
|
||||
"take": 2,
|
||||
"without": 2,
|
||||
"introspection": 1,
|
||||
"version": 1,
|
||||
"y": 6,
|
||||
"more": 3,
|
||||
"more.reduce": 1,
|
||||
"does": 1,
|
||||
"has": 2,
|
||||
"variadic": 1,
|
||||
"overload": 1,
|
||||
"passed": 1,
|
||||
"throws": 1,
|
||||
"exception.": 1,
|
||||
"Other": 1,
|
||||
"Special": 1,
|
||||
"Forms": 1,
|
||||
"Instantiation": 1,
|
||||
"type": 2,
|
||||
"instantiation": 1,
|
||||
"consice": 1,
|
||||
"needs": 1,
|
||||
"suffixed": 1,
|
||||
"character": 1,
|
||||
"Type.": 1,
|
||||
"options": 2,
|
||||
"More": 1,
|
||||
"verbose": 1,
|
||||
"there": 1,
|
||||
"new": 2,
|
||||
"Class": 1,
|
||||
"Method": 1,
|
||||
"calls": 3,
|
||||
"method": 2,
|
||||
"no": 1,
|
||||
"different": 1,
|
||||
"Any": 1,
|
||||
"quoted": 1,
|
||||
"prevent": 1,
|
||||
"doesn": 1,
|
||||
"t": 1,
|
||||
"unless": 5,
|
||||
"or": 2,
|
||||
"macro": 7,
|
||||
"try": 1,
|
||||
"implemting": 1,
|
||||
"understand": 1,
|
||||
"use": 2,
|
||||
"case": 1,
|
||||
"We": 1,
|
||||
"execute": 1,
|
||||
"body": 4,
|
||||
"condition": 4,
|
||||
"defn": 2,
|
||||
"Although": 1,
|
||||
"following": 2,
|
||||
"log": 1,
|
||||
"anyway": 1,
|
||||
"since": 1,
|
||||
"exectued": 1,
|
||||
"before": 1,
|
||||
"called.": 1,
|
||||
"Macros": 2,
|
||||
"solve": 1,
|
||||
"problem": 1,
|
||||
"because": 1,
|
||||
"immediately.": 1,
|
||||
"Instead": 1,
|
||||
"you": 1,
|
||||
"get": 2,
|
||||
"choose": 1,
|
||||
"when": 1,
|
||||
"evaluated.": 1,
|
||||
"return": 1,
|
||||
"instead.": 1,
|
||||
"defmacro": 3,
|
||||
"less": 1,
|
||||
"how": 1,
|
||||
"build": 1,
|
||||
"implemented.": 1,
|
||||
"define": 4,
|
||||
"name": 2,
|
||||
"def": 1,
|
||||
"@body": 1,
|
||||
"Now": 1,
|
||||
"we": 2,
|
||||
"above": 1,
|
||||
"defined": 1,
|
||||
"expanded": 2,
|
||||
"time": 1,
|
||||
"resulting": 1,
|
||||
"diff": 1,
|
||||
"program": 1,
|
||||
"output.": 1,
|
||||
"print": 1,
|
||||
"message": 2,
|
||||
".log": 1,
|
||||
"console": 1,
|
||||
"Not": 1,
|
||||
"macros": 2,
|
||||
"via": 2,
|
||||
"templating": 1,
|
||||
"language": 1,
|
||||
"available": 1,
|
||||
"at": 1,
|
||||
"hand": 1,
|
||||
"assemble": 1,
|
||||
"form.": 1,
|
||||
"For": 2,
|
||||
"instance": 1,
|
||||
"ease": 1,
|
||||
"functional": 1,
|
||||
"chanining": 1,
|
||||
"popular": 1,
|
||||
"chaining.": 1,
|
||||
"example": 1,
|
||||
"API": 1,
|
||||
"pioneered": 1,
|
||||
"jQuery": 1,
|
||||
"very": 2,
|
||||
"common": 1,
|
||||
"open": 2,
|
||||
"target": 1,
|
||||
"keypress": 2,
|
||||
"filter": 2,
|
||||
"isEnterKey": 1,
|
||||
"getInputText": 1,
|
||||
"reduce": 3,
|
||||
"render": 2,
|
||||
"Unfortunately": 1,
|
||||
"though": 1,
|
||||
"requires": 1,
|
||||
"need": 1,
|
||||
"methods": 1,
|
||||
"dsl": 1,
|
||||
"object": 1,
|
||||
"limited.": 1,
|
||||
"Making": 1,
|
||||
"party": 1,
|
||||
"second": 1,
|
||||
"class.": 1,
|
||||
"Via": 1,
|
||||
"achieve": 1,
|
||||
"chaining": 1,
|
||||
"such": 1,
|
||||
"tradeoffs.": 1,
|
||||
"operations": 3,
|
||||
"operation": 3,
|
||||
"cons": 2,
|
||||
"tagret": 1,
|
||||
"enter": 1,
|
||||
"input": 1,
|
||||
"text": 1
|
||||
},
|
||||
"XML": {
|
||||
"<?xml>": 3,
|
||||
"version=": 4,
|
||||
@@ -37710,6 +38345,7 @@
|
||||
"edn": 227,
|
||||
"Elm": 628,
|
||||
"Emacs Lisp": 3,
|
||||
"Erlang": 1861,
|
||||
"fish": 636,
|
||||
"Forth": 1516,
|
||||
"GAS": 133,
|
||||
@@ -37769,7 +38405,7 @@
|
||||
"Scheme": 3478,
|
||||
"Scilab": 69,
|
||||
"SCSS": 39,
|
||||
"Shell": 3481,
|
||||
"Shell": 3542,
|
||||
"Standard ML": 243,
|
||||
"SuperCollider": 268,
|
||||
"Tea": 3,
|
||||
@@ -37781,6 +38417,7 @@
|
||||
"VHDL": 42,
|
||||
"VimL": 20,
|
||||
"Visual Basic": 345,
|
||||
"wisp": 1363,
|
||||
"XML": 5622,
|
||||
"XProc": 22,
|
||||
"XQuery": 801,
|
||||
@@ -37808,6 +38445,7 @@
|
||||
"edn": 1,
|
||||
"Elm": 3,
|
||||
"Emacs Lisp": 1,
|
||||
"Erlang": 4,
|
||||
"fish": 3,
|
||||
"Forth": 7,
|
||||
"GAS": 1,
|
||||
@@ -37867,7 +38505,7 @@
|
||||
"Scheme": 1,
|
||||
"Scilab": 3,
|
||||
"SCSS": 1,
|
||||
"Shell": 34,
|
||||
"Shell": 36,
|
||||
"Standard ML": 2,
|
||||
"SuperCollider": 2,
|
||||
"Tea": 1,
|
||||
@@ -37879,6 +38517,7 @@
|
||||
"VHDL": 1,
|
||||
"VimL": 2,
|
||||
"Visual Basic": 1,
|
||||
"wisp": 1,
|
||||
"XML": 3,
|
||||
"XProc": 1,
|
||||
"XQuery": 1,
|
||||
@@ -37886,5 +38525,5 @@
|
||||
"Xtend": 2,
|
||||
"YAML": 1
|
||||
},
|
||||
"md5": "059fe14f51b0d571c9790286b543ca4c"
|
||||
"md5": "b7833db14f1bfbdce7124fe6f9cff95f"
|
||||
}
|
||||
21
samples/Erlang/factorial.script!
Executable file
21
samples/Erlang/factorial.script!
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env escript
|
||||
%% -*- erlang -*-
|
||||
%%! -smp enable -sname factorial -mnesia debug verbose
|
||||
main([String]) ->
|
||||
try
|
||||
N = list_to_integer(String),
|
||||
F = fac(N),
|
||||
io:format("factorial ~w = ~w\n", [N,F])
|
||||
catch
|
||||
_:_ ->
|
||||
usage()
|
||||
end;
|
||||
main(_) ->
|
||||
usage().
|
||||
|
||||
usage() ->
|
||||
io:format("usage: factorial integer\n"),
|
||||
halt(1).
|
||||
|
||||
fac(0) -> 1;
|
||||
fac(N) -> N * fac(N-1).
|
||||
4
samples/Erlang/hello.escript
Executable file
4
samples/Erlang/hello.escript
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env escript
|
||||
-export([main/1]).
|
||||
|
||||
main([]) -> io:format("Hello, World!~n").
|
||||
136
samples/Erlang/record_helper.erl
Normal file
136
samples/Erlang/record_helper.erl
Normal file
@@ -0,0 +1,136 @@
|
||||
%% For each header file, it scans thru all records and create helper functions
|
||||
%% Helper functions are:
|
||||
%% setters, getters, fields, fields_atom, type
|
||||
|
||||
-module(record_helper).
|
||||
|
||||
-export([make/1, make/2]).
|
||||
|
||||
make(HeaderFiles) ->
|
||||
make([ atom_to_list(X) || X <- HeaderFiles ], ".").
|
||||
|
||||
%% .hrl file, relative to current dir
|
||||
make(HeaderFiles, OutDir) ->
|
||||
ModuleName = "record_utils",
|
||||
HeaderComment = "%% This is auto generated file. Please don't edit it\n\n",
|
||||
ModuleDeclaration = "-module(" ++ ModuleName ++ ").\n"
|
||||
++ "-author(\"trung@mdkt.org\").\n"
|
||||
++ "-compile(export_all).\n"
|
||||
++ [ "-include(\"" ++ X ++ "\").\n" || X <- HeaderFiles ]
|
||||
++ "\n",
|
||||
Src = format_src(lists:sort(lists:flatten([read(X) || X <- HeaderFiles] ++ [generate_type_default_function()]))),
|
||||
file:write_file(OutDir++"/" ++ ModuleName ++ ".erl", list_to_binary([HeaderComment, ModuleDeclaration, Src])).
|
||||
|
||||
read(HeaderFile) ->
|
||||
try epp:parse_file(HeaderFile,[],[]) of
|
||||
{ok, Tree} ->
|
||||
parse(Tree);
|
||||
{error, Error} ->
|
||||
{error, {"Error parsing header file", HeaderFile, Error}}
|
||||
catch
|
||||
_:Error ->
|
||||
{catched_error, {"Error parsing header file", HeaderFile, Error}}
|
||||
end.
|
||||
|
||||
format_src([{_, _, _, Src}|T]) when length(T) == 0 ->
|
||||
Src ++ ".\n\n";
|
||||
format_src([{Type, _, _, Src}|[{Type, A, B, NSrc}|T]]) ->
|
||||
Src ++ ";\n\n" ++ format_src([{Type, A, B, NSrc}|T]);
|
||||
format_src([{_Type, _, _, Src}|[{Type1, A, B, NSrc}|T]]) ->
|
||||
Src ++ ".\n\n" ++ format_src([{Type1, A, B, NSrc}|T]);
|
||||
format_src([{_, _, _, Src}|T]) when length(T) > 0 ->
|
||||
Src ++ ";\n\n" ++ format_src(T).
|
||||
|
||||
parse(Tree) ->
|
||||
[ parse_record(X) || X <- Tree ].
|
||||
|
||||
parse_record({attribute, _, record, RecordInfo}) ->
|
||||
{RecordName, RecordFields} = RecordInfo,
|
||||
if
|
||||
length(RecordFields) == 1 ->
|
||||
lists:flatten([ generate_setter_getter_function(RecordName, X) || X <- RecordFields ]
|
||||
++ [generate_type_function(RecordName)]);
|
||||
true ->
|
||||
lists:flatten([generate_fields_function(RecordName, RecordFields)]
|
||||
++ [generate_fields_atom_function(RecordName, RecordFields)]
|
||||
++ [ generate_setter_getter_function(RecordName, X) || X <- RecordFields ]
|
||||
++ [generate_type_function(RecordName)])
|
||||
end;
|
||||
parse_record(_) -> [].
|
||||
|
||||
parse_field_name({record_field, _, {atom, _, FieldName}}) ->
|
||||
{field, "\"" ++ atom_to_list(FieldName) ++ "\""};
|
||||
parse_field_name({record_field, _, {atom, _, _FieldName}, {record, _, ParentRecordName, _}}) ->
|
||||
{parent_field, "fields(" ++ atom_to_list(ParentRecordName) ++ ")"};
|
||||
parse_field_name({record_field, _, {atom, _, FieldName}, _}) ->
|
||||
{field, "\"" ++ atom_to_list(FieldName) ++ "\""}.
|
||||
|
||||
parse_field_name_atom({record_field, _, {atom, _, FieldName}}) ->
|
||||
atom_to_list(FieldName);
|
||||
parse_field_name_atom({record_field, _, {atom, _, _FieldName}, {record, _, ParentRecordName, _}}) ->
|
||||
"fields_atom(" ++ atom_to_list(ParentRecordName) ++ ")";
|
||||
parse_field_name_atom({record_field, _, {atom, _, FieldName}, _}) ->
|
||||
atom_to_list(FieldName).
|
||||
|
||||
concat([], _S) -> [];
|
||||
concat([F|T], _S) when length(T) == 0 -> F;
|
||||
concat([F|T], S) -> F ++ S ++ concat(T, S).
|
||||
|
||||
concat_ext([], _S) -> [];
|
||||
concat_ext([F|T], S) -> F ++ S ++ concat_ext(T, S).
|
||||
|
||||
parse_field([], AccFields, AccParentFields) -> concat_ext(AccParentFields, " ++ ") ++ "[" ++ concat(AccFields, ", ") ++ "]";
|
||||
%parse_field([F|T], AccFields, AccParentFields) when length(T) == 0 -> parse_field_name(F);
|
||||
parse_field([F|T], AccFields, AccParentFields) ->
|
||||
case parse_field_name(F) of
|
||||
{field, Field} ->
|
||||
parse_field(T, AccFields ++ [Field], AccParentFields);
|
||||
{parent_field, PField} ->
|
||||
parse_field(T, AccFields, AccParentFields ++ [PField])
|
||||
end.
|
||||
|
||||
parse_field_atom([F|T]) when length(T) == 0 -> parse_field_name_atom(F);
|
||||
parse_field_atom([F|T]) ->
|
||||
parse_field_name_atom(F) ++ ", " ++ parse_field_atom(T).
|
||||
|
||||
generate_type_default_function() ->
|
||||
{type, zzz, 99, "type(_) -> undefined"}.
|
||||
|
||||
generate_type_function(RecordName) ->
|
||||
{type, RecordName, 0, "type(Obj) when is_record(Obj, " ++ atom_to_list(RecordName) ++ ") -> " ++ atom_to_list(RecordName)}.
|
||||
|
||||
generate_fields_function(RecordName, RecordFields) ->
|
||||
Fields = parse_field(RecordFields, [], []),
|
||||
{field, RecordName, 1, "fields(" ++ atom_to_list(RecordName) ++ ") -> \n\t" ++ Fields}.
|
||||
|
||||
generate_fields_atom_function(RecordName, RecordFields) ->
|
||||
Fields = parse_field_atom(RecordFields),
|
||||
{field_atom, RecordName, 1, "fields_atom(" ++ atom_to_list(RecordName) ++ ") -> \n\tlists:flatten([" ++ Fields ++ "])"}.
|
||||
|
||||
generate_setter_getter_function(RecordName, {record_field, _, {atom, _, FieldName}, {record, _, ParentRecordName, _}}) ->
|
||||
to_setter_getter_function(atom_to_list(RecordName), atom_to_list(FieldName), atom_to_list(ParentRecordName));
|
||||
generate_setter_getter_function(RecordName, {record_field, _, {atom, _, FieldName}, _}) ->
|
||||
to_setter_getter_function(atom_to_list(RecordName), atom_to_list(FieldName));
|
||||
generate_setter_getter_function(RecordName, {record_field, _, {atom, _, FieldName}}) ->
|
||||
to_setter_getter_function(atom_to_list(RecordName), atom_to_list(FieldName)).
|
||||
|
||||
to_setter_getter_function(RecordName, FieldName) ->
|
||||
[{setter, RecordName, 1, "set(Obj, " ++ FieldName ++ ", Value) when is_record(Obj, " ++ RecordName ++ ") -> \n"
|
||||
++ "\tNewObj = Obj#" ++ RecordName ++ "{" ++ FieldName ++ " = Value},\n"
|
||||
++ "\t{ok, NewObj, {" ++ FieldName ++ ", Value}}"},
|
||||
{getter, RecordName, 1, "get(Obj, " ++ FieldName ++ ") when is_record(Obj, " ++ RecordName ++ ") -> \n"
|
||||
++ "\t{ok, Obj#" ++ RecordName ++ "." ++ FieldName ++ "}"}
|
||||
].
|
||||
|
||||
to_setter_getter_function(RecordName, FieldName, ParentRecordName) ->
|
||||
[{setter, RecordName, 2, "set(Obj, " ++ FieldName ++ ", Value) when is_record(Obj, " ++ RecordName ++ ") and is_record(Value, " ++ ParentRecordName ++ ") -> \n"
|
||||
++ "\tNewObj = Obj#" ++ RecordName ++ "{" ++ FieldName ++ " = Value},\n"
|
||||
++ "\t{ok, NewObj, {" ++ FieldName ++ ", Value}};\n\n"
|
||||
++ "set(Obj, ParentProperty, Value) when is_record(Obj, " ++ RecordName ++ ") and is_atom(ParentProperty) -> \n"
|
||||
++ "\t{ok, NewParentObject, _} = set(Obj#" ++ RecordName ++ ".parent, ParentProperty, Value),\n"
|
||||
++ "\tset(Obj, parent, NewParentObject)"},
|
||||
{getter, RecordName, 2, "get(Obj, " ++ FieldName ++ ") when is_record(Obj, " ++ RecordName ++ ") -> \n"
|
||||
++ "\t{ok, Obj#" ++ RecordName ++ "." ++ FieldName ++ "};\n\n"
|
||||
++ "get(Obj, ParentProperty) when is_record(Obj, " ++ RecordName ++ ") and is_atom(ParentProperty) -> \n"
|
||||
++ "\tget(Obj#" ++ RecordName ++ ".parent, ParentProperty)"}
|
||||
].
|
||||
100
samples/Erlang/record_utils.erl
Normal file
100
samples/Erlang/record_utils.erl
Normal file
@@ -0,0 +1,100 @@
|
||||
%% This is auto generated file. Please don't edit it
|
||||
|
||||
-module(record_utils).
|
||||
-compile(export_all).
|
||||
-include("messages.hrl").
|
||||
|
||||
fields(abstract_message) ->
|
||||
["clientId", "destination", "messageId", "timestamp", "timeToLive", "headers", "body"];
|
||||
|
||||
fields(async_message) ->
|
||||
fields(abstract_message) ++ ["correlationId", "correlationIdBytes"].
|
||||
|
||||
fields_atom(abstract_message) ->
|
||||
lists:flatten([clientId, destination, messageId, timestamp, timeToLive, headers, body]);
|
||||
|
||||
fields_atom(async_message) ->
|
||||
lists:flatten([fields_atom(abstract_message), correlationId, correlationIdBytes]).
|
||||
|
||||
get(Obj, body) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.body};
|
||||
|
||||
get(Obj, clientId) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.clientId};
|
||||
|
||||
get(Obj, destination) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.destination};
|
||||
|
||||
get(Obj, headers) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.headers};
|
||||
|
||||
get(Obj, messageId) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.messageId};
|
||||
|
||||
get(Obj, timeToLive) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.timeToLive};
|
||||
|
||||
get(Obj, timestamp) when is_record(Obj, abstract_message) ->
|
||||
{ok, Obj#abstract_message.timestamp};
|
||||
|
||||
get(Obj, correlationId) when is_record(Obj, async_message) ->
|
||||
{ok, Obj#async_message.correlationId};
|
||||
|
||||
get(Obj, correlationIdBytes) when is_record(Obj, async_message) ->
|
||||
{ok, Obj#async_message.correlationIdBytes};
|
||||
|
||||
get(Obj, parent) when is_record(Obj, async_message) ->
|
||||
{ok, Obj#async_message.parent};
|
||||
|
||||
get(Obj, ParentProperty) when is_record(Obj, async_message) and is_atom(ParentProperty) ->
|
||||
get(Obj#async_message.parent, ParentProperty).
|
||||
|
||||
set(Obj, body, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{body = Value},
|
||||
{ok, NewObj, {body, Value}};
|
||||
|
||||
set(Obj, clientId, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{clientId = Value},
|
||||
{ok, NewObj, {clientId, Value}};
|
||||
|
||||
set(Obj, destination, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{destination = Value},
|
||||
{ok, NewObj, {destination, Value}};
|
||||
|
||||
set(Obj, headers, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{headers = Value},
|
||||
{ok, NewObj, {headers, Value}};
|
||||
|
||||
set(Obj, messageId, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{messageId = Value},
|
||||
{ok, NewObj, {messageId, Value}};
|
||||
|
||||
set(Obj, timeToLive, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{timeToLive = Value},
|
||||
{ok, NewObj, {timeToLive, Value}};
|
||||
|
||||
set(Obj, timestamp, Value) when is_record(Obj, abstract_message) ->
|
||||
NewObj = Obj#abstract_message{timestamp = Value},
|
||||
{ok, NewObj, {timestamp, Value}};
|
||||
|
||||
set(Obj, correlationId, Value) when is_record(Obj, async_message) ->
|
||||
NewObj = Obj#async_message{correlationId = Value},
|
||||
{ok, NewObj, {correlationId, Value}};
|
||||
|
||||
set(Obj, correlationIdBytes, Value) when is_record(Obj, async_message) ->
|
||||
NewObj = Obj#async_message{correlationIdBytes = Value},
|
||||
{ok, NewObj, {correlationIdBytes, Value}};
|
||||
|
||||
set(Obj, parent, Value) when is_record(Obj, async_message) and is_record(Value, abstract_message) ->
|
||||
NewObj = Obj#async_message{parent = Value},
|
||||
{ok, NewObj, {parent, Value}};
|
||||
|
||||
set(Obj, ParentProperty, Value) when is_record(Obj, async_message) and is_atom(ParentProperty) ->
|
||||
{ok, NewParentObject, _} = set(Obj#async_message.parent, ParentProperty, Value),
|
||||
set(Obj, parent, NewParentObject).
|
||||
|
||||
type(Obj) when is_record(Obj, abstract_message) -> abstract_message;
|
||||
|
||||
type(Obj) when is_record(Obj, async_message) -> async_message;
|
||||
|
||||
type(_) -> undefined.
|
||||
28
samples/Shell/99-bottles-of-beer.script!
Executable file
28
samples/Shell/99-bottles-of-beer.script!
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Bourne Again shell version of 99 Bottles
|
||||
# Dave Plonka - plonka@carroll1.cc.edu
|
||||
|
||||
typeset -i n=99
|
||||
typeset bottles=bottles
|
||||
typeset no
|
||||
|
||||
while [ 0 != $[ n ] ]
|
||||
do
|
||||
echo "${n?} ${bottles?} of beer on the wall,"
|
||||
echo "${n?} ${bottles?} of beer,"
|
||||
echo "take one down, pass it around,"
|
||||
n=n-1
|
||||
case ${n?} in
|
||||
0)
|
||||
no=no
|
||||
bottles=${bottles%s}s
|
||||
;;
|
||||
1)
|
||||
bottles=${bottles%s}
|
||||
;;
|
||||
esac
|
||||
echo "${no:-${n}} ${bottles?} of beer on the wall."
|
||||
echo
|
||||
done
|
||||
|
||||
exit
|
||||
4
samples/Shell/string-chopping.script!
Executable file
4
samples/Shell/string-chopping.script!
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
name=foodforthought.jpg
|
||||
echo ${name##*fo}
|
||||
@@ -95,6 +95,7 @@ class TestTokenizer < Test::Unit::TestCase
|
||||
assert_equal "SHEBANG#!ruby", tokenize(:"Ruby/ruby2.script!")[0]
|
||||
assert_equal "SHEBANG#!node", tokenize(:"JavaScript/js.script!")[0]
|
||||
assert_equal "SHEBANG#!php", tokenize(:"PHP/php.script!")[0]
|
||||
assert_equal "SHEBANG#!escript", tokenize(:"Erlang/factorial.script!")[0]
|
||||
assert_equal "echo", tokenize(:"Shell/invalid-shebang.sh")[0]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user